Skip to content

Commit

Permalink
Merge branch 'master' of github.com:jenseng/react-i18nliner
Browse files Browse the repository at this point in the history
# Conflicts:
#	ComponentInterpolator.js
#	__tests__/ComponentInterpolator.test.js
#	browserify-transform.js
#	dist/ComponentInterpolator.js
#	main.js
#	package.json
#	preprocess.js
#	test_utils/subjector.js
#	util/escapeRegExp.js
#	webpack-loader.js
  • Loading branch information
Download committed Mar 27, 2018
2 parents ccb9cf4 + c8d5ef1 commit 7fede68
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 117 deletions.
1 change: 1 addition & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ rules:
quotes: 'off'
radix: error
"react/jsx-uses-react": 1
"react/jsx-uses-vars": 1
require-jsdoc: 'off'
require-yield: error
rest-spread-spacing: error
Expand Down
3 changes: 1 addition & 2 deletions ComponentInterpolator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ var invariant = require('invariant');
var Component = require('preact').Component;
var h = require('preact').h;
var clone = require('extend').bind(true);

var WRAPPER_PATTERN = /(\*+)/;
var PLACEHOLDER_PATTERN = /(%\{.*?\})/;

Expand Down Expand Up @@ -68,7 +67,6 @@ class ComponentInterpolator extends Component {
child = wrappers[token],
`<ComponentInterpolator> expected '${token}' wrapper, none found`
);

child = injectNewDescendants(
child,
this.interpolateAllComponents(tokens, token),
Expand Down Expand Up @@ -112,3 +110,4 @@ class ComponentInterpolator extends Component {
}

module.exports = ComponentInterpolator;

4 changes: 3 additions & 1 deletion __tests__/preprocess.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ var expect = require('chai').expect;
var preprocess = require('../preprocess');

var subject = function() {
return preprocess.apply(null, arguments).replace(/\s+/g, ' ');
return preprocess.apply(null, arguments)
.replace(/\s+/g, ' ');
// .replace(/;$/, '');
};

describe('preprocess', function() {
Expand Down
6 changes: 2 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
var log = require('./util/createLogger')('preact-i18nline');

var recast = require("recast");

var preprocess = require("./preprocess");

module.exports = function(i18nline) {
Expand All @@ -17,7 +14,7 @@ module.exports = function(i18nline) {
fileData.skip = fileData.skip && !hasTranslatableText(source);

if (!fileData.skip) {
var ast = fileData.ast || recast.parse(source, config.recastOptions);
var ast = fileData.ast || this.parse(source);
preprocess.ast(ast, config);
fileData.ast = ast;
}
Expand All @@ -27,3 +24,4 @@ module.exports = function(i18nline) {
};

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

96 changes: 18 additions & 78 deletions package-lock.json

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

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-plugin-transform-jsx": "^2.0.0",
"babel-plugin-transform-react-jsx": "^6.24.1",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
Expand All @@ -50,12 +49,12 @@
"preact-render-to-string": "^3.7.0"
},
"peerDependencies": {
"preact": "^8.0.0"
"preact": "^7.0.0 || ^8.0.0"
},
"dependencies": {
"esprima": "^4.0.0",
"extend": "^3.0.1",
"i18nline": "^1.6.0",
"i18nline": "^1.7.0",
"invariant": "^2.2.4",
"preact": "^8.2.7",
"recast": "^0.14.7",
Expand Down
Loading

0 comments on commit 7fede68

Please sign in to comment.