From 150d63d15ce63e491a6d4bbc2653305a47e0e6ff Mon Sep 17 00:00:00 2001 From: Stijn de Witt Date: Thu, 29 Mar 2018 15:06:20 +0200 Subject: [PATCH] 1.7.1: Removed no-parse path from webpack loader, added browser main entry. --- i18n.js | 2 +- package-lock.json | 11 ++++++----- package.json | 7 ++++--- webpack-loader.js | 22 ---------------------- 4 files changed, 11 insertions(+), 31 deletions(-) diff --git a/i18n.js b/i18n.js index a6c8f8a..e5e6553 100644 --- a/i18n.js +++ b/i18n.js @@ -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); diff --git a/package-lock.json b/package-lock.json index 227ee0e..89fbf77 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "preact-i18nline", - "version": "1.7.0", + "version": "1.7.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2402,7 +2402,8 @@ "jsbn": { "version": "0.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "json-schema": { "version": "0.2.3", @@ -2997,9 +2998,9 @@ "integrity": "sha512-u144MQhV/8mz4Y5wP86SQAWMwS8gpe/JavIa9hugSI4WreezGgbhJPdk2Q60KcdIltKLiNefGtHNh1N8SSmQqQ==" }, "i18nline": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/i18nline/-/i18nline-1.7.0.tgz", - "integrity": "sha512-Gm1V4SoXpms0py7YT2qiyc9LplVz1odEoJPXAf2Z8H8jVRU05Xcjnctzp1dgdhVvGRO0yDaEK7aBzmyjB61CMQ==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/i18nline/-/i18nline-1.7.1.tgz", + "integrity": "sha512-/wS5ztVUq10kiH5JicG0a3IEm3MEcMd1X2/XZyFbY7AcvSTPEGlcPKJdXI+VsFdz1OZ03j7uY2R3nrsOFwR9xw==", "requires": { "babel-traverse": "6.26.0", "babylon": "6.18.0", diff --git a/package.json b/package.json index d8d68ef..3b03aae 100644 --- a/package.json +++ b/package.json @@ -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" @@ -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", diff --git a/webpack-loader.js b/webpack-loader.js index 0cf1b42..5da82d1 100644 --- a/webpack-loader.js +++ b/webpack-loader.js @@ -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); -