described-i18n-loader
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -6,2 +6,4 @@ /* | ||
const loaderUtils = require("loader-utils"); | ||
function descendIntoObject(target) { | ||
@@ -36,2 +38,3 @@ const output = {}; | ||
this.cacheable(true); | ||
const options = loaderUtils.getOptions(this) || {}; | ||
@@ -45,3 +48,3 @@ const locale = JSON.parse(str); | ||
const module = this.version && this.version >= 2 | ||
const module = this.version && this.version >= 2 && !options.forceModuleExports | ||
? `export default ${value};` | ||
@@ -48,0 +51,0 @@ : `module.exports = ${value};`; |
{ | ||
"name": "described-i18n-loader", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Load i18n json files with key value pairs while stripping the 'desc' key from all subkeys. eg: key = 'conf.title', value = { text: \"Configuration\", desc: \"Title for config screen\" }", | ||
@@ -15,3 +15,4 @@ "main": "index.js", | ||
"webpack": "webpack", | ||
"test": "webpack test/index.js out/bundle.js" | ||
"test-node": "webpack test/node.js out/bundle-node.js", | ||
"test-es6": "webpack test/es6.js out/bundle-es6.js" | ||
}, | ||
@@ -22,3 +23,6 @@ "author": "erdii <erdiicodes@gmail.com>", | ||
"webpack": "^2.3.2" | ||
}, | ||
"dependencies": { | ||
"loader-utils": "^1.1.0" | ||
} | ||
} |
@@ -46,2 +46,3 @@ # described-18n-loader | ||
**(node)** | ||
```JSON | ||
@@ -56,1 +57,17 @@ module.exports = { | ||
``` | ||
**(es6)** | ||
```JSON | ||
export default { | ||
"conf.title": "Configuration", | ||
"app.title": "MyApp", | ||
"nav.button.home": "Home", | ||
"nav.button.about": "About", | ||
"another.pure.key": "Pure Key" | ||
} | ||
``` | ||
## Options | ||
* `forceModuleExports`: force node style module `DEFAULT - webpack 1: true, webpack 2: false` |
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
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
3039
39
72
1
+ Addedloader-utils@^1.1.0
+ Addedbig.js@5.2.2(transitive)
+ Addedemojis-list@3.0.0(transitive)
+ Addedjson5@1.0.2(transitive)
+ Addedloader-utils@1.4.2(transitive)
+ Addedminimist@1.2.8(transitive)