@vocab/webpack 1.2.8 → 1.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -39,8 +39,8 @@ This is the language Vocab will assume when it sees a `translation.json` file wi
|
|
|
39
39
|
```js
|
|
40
40
|
// vocab.config.js
|
|
41
41
|
module.exports = {
|
|
42
|
-
languages: [{ name: 'en' }, { name: 'fr' }]
|
|
43
|
-
devLanguage: 'en'
|
|
42
|
+
languages: [{ name: 'en' }, { name: 'fr' }],
|
|
43
|
+
devLanguage: 'en'
|
|
44
44
|
};
|
|
45
45
|
```
|
|
46
46
|
|
|
@@ -48,7 +48,7 @@ function createIdentifier(lang, resourcePath, loadedTranslation) {
|
|
|
48
48
|
langJson[key] = languageTranslations[key].message;
|
|
49
49
|
}
|
|
50
50
|
const base64 = Buffer.from(JSON.stringify(langJson), 'utf-8').toString('base64');
|
|
51
|
-
const unloader = `${virtualResourceLoader}?source=${base64}`;
|
|
51
|
+
const unloader = `${virtualResourceLoader}?source=${encodeURIComponent(base64)}`;
|
|
52
52
|
const fileIdent = path__default["default"].basename(resourcePath, 'translations.json');
|
|
53
53
|
return `./${fileIdent}-${lang}-virtual.json!=!${unloader}!`;
|
|
54
54
|
}
|
|
@@ -113,11 +113,11 @@ async function vocabLoader(source) {
|
|
|
113
113
|
const esmExports = findExportNames(source, 'esm');
|
|
114
114
|
if (esmExports.length > 0) {
|
|
115
115
|
const exportName = esmExports[0];
|
|
116
|
-
trace(`Found ESM export '${exportName}' in ${this.resourcePath}`);
|
|
116
|
+
trace(`Found ESM export '${exportName.n}' in ${this.resourcePath}`);
|
|
117
117
|
result = /* ts */`
|
|
118
118
|
import { createLanguage, createTranslationFile } from '@vocab/webpack/${target}';
|
|
119
119
|
${translations}
|
|
120
|
-
export { translations as ${exportName} };
|
|
120
|
+
export { translations as ${exportName.n} };
|
|
121
121
|
`;
|
|
122
122
|
} else {
|
|
123
123
|
// init needs to be called and waited upon
|
|
@@ -48,7 +48,7 @@ function createIdentifier(lang, resourcePath, loadedTranslation) {
|
|
|
48
48
|
langJson[key] = languageTranslations[key].message;
|
|
49
49
|
}
|
|
50
50
|
const base64 = Buffer.from(JSON.stringify(langJson), 'utf-8').toString('base64');
|
|
51
|
-
const unloader = `${virtualResourceLoader}?source=${base64}`;
|
|
51
|
+
const unloader = `${virtualResourceLoader}?source=${encodeURIComponent(base64)}`;
|
|
52
52
|
const fileIdent = path__default["default"].basename(resourcePath, 'translations.json');
|
|
53
53
|
return `./${fileIdent}-${lang}-virtual.json!=!${unloader}!`;
|
|
54
54
|
}
|
|
@@ -113,11 +113,11 @@ async function vocabLoader(source) {
|
|
|
113
113
|
const esmExports = findExportNames(source, 'esm');
|
|
114
114
|
if (esmExports.length > 0) {
|
|
115
115
|
const exportName = esmExports[0];
|
|
116
|
-
trace(`Found ESM export '${exportName}' in ${this.resourcePath}`);
|
|
116
|
+
trace(`Found ESM export '${exportName.n}' in ${this.resourcePath}`);
|
|
117
117
|
result = /* ts */`
|
|
118
118
|
import { createLanguage, createTranslationFile } from '@vocab/webpack/${target}';
|
|
119
119
|
${translations}
|
|
120
|
-
export { translations as ${exportName} };
|
|
120
|
+
export { translations as ${exportName.n} };
|
|
121
121
|
`;
|
|
122
122
|
} else {
|
|
123
123
|
// init needs to be called and waited upon
|
|
@@ -20,7 +20,7 @@ function createIdentifier(lang, resourcePath, loadedTranslation) {
|
|
|
20
20
|
langJson[key] = languageTranslations[key].message;
|
|
21
21
|
}
|
|
22
22
|
const base64 = Buffer.from(JSON.stringify(langJson), 'utf-8').toString('base64');
|
|
23
|
-
const unloader = `${virtualResourceLoader}?source=${base64}`;
|
|
23
|
+
const unloader = `${virtualResourceLoader}?source=${encodeURIComponent(base64)}`;
|
|
24
24
|
const fileIdent = path.basename(resourcePath, 'translations.json');
|
|
25
25
|
return `./${fileIdent}-${lang}-virtual.json!=!${unloader}!`;
|
|
26
26
|
}
|
|
@@ -85,11 +85,11 @@ async function vocabLoader(source) {
|
|
|
85
85
|
const esmExports = findExportNames(source, 'esm');
|
|
86
86
|
if (esmExports.length > 0) {
|
|
87
87
|
const exportName = esmExports[0];
|
|
88
|
-
trace(`Found ESM export '${exportName}' in ${this.resourcePath}`);
|
|
88
|
+
trace(`Found ESM export '${exportName.n}' in ${this.resourcePath}`);
|
|
89
89
|
result = /* ts */`
|
|
90
90
|
import { createLanguage, createTranslationFile } from '@vocab/webpack/${target}';
|
|
91
91
|
${translations}
|
|
92
|
-
export { translations as ${exportName} };
|
|
92
|
+
export { translations as ${exportName.n} };
|
|
93
93
|
`;
|
|
94
94
|
} else {
|
|
95
95
|
// init needs to be called and waited upon
|
package/package.json
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vocab/webpack",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.10",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/seek-oss/vocab.git",
|
|
7
|
+
"directory": "packages/webpack"
|
|
8
|
+
},
|
|
4
9
|
"main": "dist/vocab-webpack.cjs.js",
|
|
5
10
|
"module": "dist/vocab-webpack.esm.js",
|
|
6
11
|
"exports": {
|
|
@@ -39,12 +44,12 @@
|
|
|
39
44
|
"web"
|
|
40
45
|
],
|
|
41
46
|
"dependencies": {
|
|
42
|
-
"@vocab/core": "^1.6.2",
|
|
43
47
|
"cjs-module-lexer": "^1.2.2",
|
|
44
48
|
"debug": "^4.3.1",
|
|
45
|
-
"es-module-lexer": "^0.
|
|
49
|
+
"es-module-lexer": "^1.0.0",
|
|
46
50
|
"picocolors": "^1.0.0",
|
|
47
|
-
"
|
|
51
|
+
"@vocab/core": "^1.6.3",
|
|
52
|
+
"virtual-resource-loader": "^2.0.0"
|
|
48
53
|
},
|
|
49
54
|
"devDependencies": {
|
|
50
55
|
"@types/debug": "^4.1.5",
|