Skip to content

Commit

Permalink
1.7.1: Removed no-parse path from webpack loader, added browser main …
Browse files Browse the repository at this point in the history
…entry.
  • Loading branch information
Download committed Mar 29, 2018
1 parent 472fb3f commit 150d63d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 31 deletions.
2 changes: 1 addition & 1 deletion i18n.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var I18n = require('i18nline/lib/i18n');
var I18n = require('i18nline');
var extend = require('./dist/extensions/i18n_js');

module.exports = extend(I18n);
11 changes: 6 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "preact-i18nline",
"version": "1.7.0",
"version": "1.7.1",
"description": "Keep your translations in line - with Preact!",
"main": "main.js",
"browser": "i18n.js",
"scripts": {
"test": "eslint . && mocha --require babel-core/register \"./{,!(node_modules)/**}/*.test.js\"",
"dist": "babel -d dist ComponentInterpolator.js extensions/i18n_js.js"
Expand Down Expand Up @@ -49,13 +50,13 @@
"preact-render-to-string": "^3.7.0"
},
"peerDependencies": {
"i18nline": "^1.7.0",
"i18nline": "^1.7.1",
"preact": "^7.0.0 || ^8.0.0"
},
"dependencies": {
"esprima": "^4.0.0",
"extend": "^3.0.1",
"i18nline": "^1.7.0",
"i18nline": "^1.7.1",
"invariant": "^2.2.4",
"preact": "^8.2.7",
"recast": "^0.14.7",
Expand Down
22 changes: 0 additions & 22 deletions webpack-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,11 @@ var config = I18nline.config;
var preprocess = require("./preprocess");
var hasTranslatableText = require("./hasTranslatableText")(config);

/*
* there's code in this file that dynamically requires plugins; it's
* not needed in the browser, so we skip it ... otherwise webpack
* will load *all* of i18nline (which includes things like fs, and
* will fail).
*/
var noParsePath = "i18nline/lib/i18nline";
var addNoParse = function() {
var escapeRegExp = require("./util/escapeRegExp");
var path = require("path");
var mod = this.options.module;

mod.noParse = mod.noParse || [];
if (!Array.isArray(mod.noParse))
mod.noParse = [mod.noParse];
mod.noParse.push(new RegExp(escapeRegExp(path.normalize(noParsePath))));

addNoParse = Function.prototype;
};

module.exports = function(source) {
this.cacheable();
addNoParse.call(this);
if (hasTranslatableText(source))
source = preprocess(source, config);
return source;
};

log.log('Initialized ' + log.name);

0 comments on commit 150d63d

Please sign in to comment.