Comparing version 4.4.0 to 5.0.0
13
index.js
@@ -1,11 +0,2 @@ | ||
module.exports = { | ||
xliff2js: require('./xliff2js'), | ||
xliff12ToJs: require('./xliff12ToJs'), | ||
js2xliff: require('./js2xliff'), | ||
jsToXliff12: require('./jsToXliff12'), | ||
targetOfjs: require('./targetOfjs'), | ||
sourceOfjs: require('./sourceOfjs'), | ||
createjs: require('./createjs'), | ||
createxliff: require('./createxliff'), | ||
createxliff12: require('./createxliff12') | ||
}; | ||
import backend from './lib/index.js' | ||
export default backend |
{ | ||
"name": "xliff", | ||
"version": "4.4.0", | ||
"version": "5.0.0", | ||
"description": "xliff2js and js2xliff converter xliff utils", | ||
"main": "index.js", | ||
"engines": { | ||
"node": ">=6.0.0" | ||
"type": "module", | ||
"main": "./cjs/index.js", | ||
"exports": { | ||
".": { | ||
"require": "./cjs/index.js", | ||
"default": "./lib/index.js" | ||
}, | ||
"./createjs": { | ||
"require": "./cjs/createjs.js", | ||
"default": "./lib/createjs.js" | ||
}, | ||
"./createxliff": { | ||
"require": "./cjs/createxliff.js", | ||
"default": "./lib/createxliff.js" | ||
}, | ||
"./createxliff12": { | ||
"require": "./cjs/createxliff12.js", | ||
"default": "./lib/createxliff12.js" | ||
}, | ||
"./js2xliff": { | ||
"require": "./cjs/js2xliff.js", | ||
"default": "./lib/js2xliff.js" | ||
}, | ||
"./jsToXliff12": { | ||
"require": "./cjs/jsToXliff12.js", | ||
"default": "./lib/jsToXliff12.js" | ||
}, | ||
"./ofjs": { | ||
"require": "./cjs/ofjs.js", | ||
"default": "./lib/ofjs.js" | ||
}, | ||
"./sourceOfjs": { | ||
"require": "./cjs/sourceOfjs.js", | ||
"default": "./lib/sourceOfjs.js" | ||
}, | ||
"./targetOfjs": { | ||
"require": "./cjs/targetOfjs.js", | ||
"default": "./lib/targetOfjs.js" | ||
}, | ||
"./xliff2js": { | ||
"require": "./cjs/xliff2js.js", | ||
"default": "./lib/xliff2js.js" | ||
}, | ||
"./xliff12ToJs": { | ||
"require": "./cjs/xliff12ToJs.js", | ||
"default": "./lib/xliff12ToJs.js" | ||
} | ||
}, | ||
"module": "./lib/index.js", | ||
"dependencies": { | ||
@@ -13,9 +58,26 @@ "xml-js": "1.6.11" | ||
"devDependencies": { | ||
"eslint": "^5.9.0", | ||
"expect.js": "^0.3.1", | ||
"mocha": "^6.0.2" | ||
"@babel/cli": "7.8.4", | ||
"@babel/core": "7.9.0", | ||
"@babel/preset-env": "7.9.5", | ||
"babel-plugin-add-module-exports": "1.0.2", | ||
"browserify": "16.5.1", | ||
"eslint": "6.8.0", | ||
"eslint-config-standard": "14.1.1", | ||
"eslint-plugin-import": "2.20.2", | ||
"eslint-plugin-node": "11.1.0", | ||
"eslint-plugin-promise": "4.2.1", | ||
"eslint-plugin-require-path-exists": "1.1.9", | ||
"eslint-plugin-standard": "4.0.1", | ||
"expect.js": "0.3.1", | ||
"mocha": "7.1.1", | ||
"uglify-js": "3.9.1" | ||
}, | ||
"scripts": { | ||
"lint": "eslint .", | ||
"test": "npm run lint && mocha test/**" | ||
"compile": "rm -rf cjs && mkdir cjs && babel lib -d cjs --presets=@babel/preset-env --plugins=add-module-exports && echo '{\"type\":\"commonjs\"}' > cjs/package.json", | ||
"browser": "browserify --standalone xliff cjs/index.js -o xliff.js && uglifyjs xliff.js --compress --mangle -o xliff.min.js", | ||
"build": "npm run compile && npm run browser", | ||
"test": "npm run lint && npm run build && mocha test -R spec", | ||
"preversion": "npm run test && npm run build && git push", | ||
"postversion": "git push && git push --tags" | ||
}, | ||
@@ -22,0 +84,0 @@ "keywords": [ |
@@ -13,12 +13,18 @@ [![travis](https://img.shields.io/travis/locize/xliff.svg)](https://travis-ci.org/locize/xliff) [![npm](https://img.shields.io/npm/v/xliff.svg)](https://npmjs.org/package/xliff) | ||
You can then `require()` xliff as normal: | ||
You can then `import` or `require()` xliff as normal: | ||
```js | ||
const xliff = require('xliff'); | ||
import xliff from 'xliff' | ||
// or | ||
const xliff = require('xliff') | ||
xliff.xliff2js(xml, (err, res) => {}) | ||
``` | ||
Or you can directly `require()` its functions: | ||
Or you can directly `import` or `require()` its functions: | ||
```js | ||
const xliff2js = require('xliff/xliff2js'); | ||
import xliff2js from 'xliff/xliff2js' | ||
// or | ||
const xliff2js = require('xliff/cjs/xliff2js') | ||
``` | ||
@@ -53,3 +59,3 @@ | ||
</file> | ||
</xliff>`; | ||
</xliff>` | ||
@@ -75,31 +81,22 @@ const js = { | ||
"targetLanguage": "de-CH" | ||
}; | ||
} | ||
const xliff2js = require('xliff/xliff2js'); | ||
import xliff2js from 'xliff/xliff2js' | ||
xliff2js(xliff, (err, res) => { | ||
// res is like js | ||
}); | ||
}) | ||
// or without callback | ||
const res = xliff2js(xliff); | ||
const res = await xliff2js(xliff) | ||
// res is like js | ||
const js2xliff = require('xliff/js2xliff'); | ||
import js2xliff from 'xliff/js2xliff' | ||
js2xliff(js, (err, res) => { | ||
// res is like xliff | ||
}); | ||
}) | ||
// or without callback | ||
const res = js2xliff(js); | ||
const res = await js2xliff(js) | ||
// res is like xliff | ||
const targetOfjs = require('xliff/targetOfjs'); | ||
targetOfjs(js, (err, res) => { | ||
// res is: | ||
// { | ||
// "key1": "Hallo", | ||
// "key2": "Eine Applikation um XLIFF Dokumente zu manipulieren und verarbeiten", | ||
// "key.nested": "XLIFF Daten Manager" | ||
// } | ||
}); | ||
// or without callback | ||
const res = targetOfjs(js); | ||
import targetOfjs from 'xliff/targetOfjs' | ||
const res = targetOfjs(js) | ||
// res is: | ||
@@ -112,13 +109,4 @@ // { | ||
const sourceOfjs = require('xliff/sourceOfjs'); | ||
sourceOfjs(js, (err, res) => { | ||
// res is: | ||
// { | ||
// "key1": "Hello", | ||
// "key2": "An application to manipulate and process XLIFF documents", | ||
// "key.nested": "XLIFF Data Manager" | ||
// } | ||
}); | ||
// or without callback | ||
const res = sourceOfjs(js); | ||
import sourceOfjs from 'xliff/sourceOfjs' | ||
const res = sourceOfjs(js) | ||
// res is: | ||
@@ -131,3 +119,3 @@ // { | ||
const createjs = require('xliff/createjs'); | ||
import createjs from 'xliff/createjs' | ||
createjs( | ||
@@ -149,8 +137,8 @@ js.sourceLanguage, | ||
// res is like js | ||
}); | ||
}) | ||
// or without callback | ||
//const res = createjs(... | ||
//const res = await createjs(... | ||
const createxliff = require('xliff/createxliff'); | ||
import createxliff from 'xliff/createxliff' | ||
createxliff( | ||
@@ -172,5 +160,5 @@ js.sourceLanguage, | ||
// res is like xliff | ||
}); | ||
}) | ||
// or without callback | ||
//const res = createxliff(... | ||
//const res = await createxliff(... | ||
``` | ||
@@ -236,17 +224,17 @@ | ||
const xliff12ToJs = require('xliff/xliff12ToJs'); | ||
import xliff12ToJs from 'xliff/xliff12ToJs' | ||
xliff12ToJs(xliff, (err, res) => { | ||
// res is like js | ||
}); | ||
}) | ||
// or without callback | ||
//const res = xliff12ToJs(... | ||
//const res = await xliff12ToJs(... | ||
const jsToXliff12 = require('xliff/jsToXliff12'); | ||
import jsToXliff12 from 'xliff/jsToXliff12' | ||
jsToXliff12(js, (err, res) => { | ||
// res is like xliff | ||
}); | ||
}) | ||
// or without callback | ||
//const res = jsToXliff12(... | ||
//const res = await jsToXliff12(... | ||
const createxliff12 = require('xliff/createxliff12'); | ||
import createxliff12 from 'xliff/createxliff12' | ||
createxliff12( | ||
@@ -268,5 +256,5 @@ js.sourceLanguage, | ||
// res is like xliff | ||
}); | ||
}) | ||
// or without callback | ||
//const res = createxliff12(... | ||
//const res = await createxliff12(... | ||
@@ -516,6 +504,6 @@ ``` | ||
// signature: makeInlineElement(type, id, attributes, contents) | ||
var attributesObj = { ctype: 'x-python-brace-param' }; | ||
var inlineElementObj = makeInlineElement(ElementTypes.GenericSpan, 'name', attributesObj, '{name}'); | ||
var attributesObj = { ctype: 'x-python-brace-param' } | ||
var inlineElementObj = makeInlineElement(ElementTypes.GenericSpan, 'name', attributesObj, '{name}') | ||
var source = [ 'Hello ', inlineElementObj ]; | ||
var source = [ 'Hello ', inlineElementObj ] | ||
``` | ||
@@ -522,0 +510,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
474901
9565
Yes
15
47
1
534
5
1