@vocab/webpack 0.0.0-package-files-20231142931

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.
Files changed (33) hide show
  1. package/CHANGELOG.md +268 -0
  2. package/chunk-name/dist/vocab-webpack-chunk-name.cjs.d.ts +1 -0
  3. package/chunk-name/dist/vocab-webpack-chunk-name.cjs.dev.js +9 -0
  4. package/chunk-name/dist/vocab-webpack-chunk-name.cjs.js +7 -0
  5. package/chunk-name/dist/vocab-webpack-chunk-name.cjs.prod.js +9 -0
  6. package/chunk-name/dist/vocab-webpack-chunk-name.esm.js +5 -0
  7. package/chunk-name/package.json +4 -0
  8. package/dist/declarations/src/chunk-name.d.ts +1 -0
  9. package/dist/declarations/src/index.d.ts +11 -0
  10. package/dist/declarations/src/loader.d.ts +8 -0
  11. package/dist/declarations/src/logger.d.ts +3 -0
  12. package/dist/declarations/src/web.d.ts +3 -0
  13. package/dist/logger-403e7dbd.cjs.dev.js +12 -0
  14. package/dist/logger-ca502069.cjs.prod.js +12 -0
  15. package/dist/logger-e1862ea1.esm.js +6 -0
  16. package/dist/vocab-webpack.cjs.d.ts +1 -0
  17. package/dist/vocab-webpack.cjs.dev.js +45 -0
  18. package/dist/vocab-webpack.cjs.js +7 -0
  19. package/dist/vocab-webpack.cjs.prod.js +45 -0
  20. package/dist/vocab-webpack.esm.js +41 -0
  21. package/loader/dist/vocab-webpack-loader.cjs.d.ts +2 -0
  22. package/loader/dist/vocab-webpack-loader.cjs.dev.js +81 -0
  23. package/loader/dist/vocab-webpack-loader.cjs.js +7 -0
  24. package/loader/dist/vocab-webpack-loader.cjs.prod.js +81 -0
  25. package/loader/dist/vocab-webpack-loader.esm.js +73 -0
  26. package/loader/package.json +4 -0
  27. package/package.json +53 -0
  28. package/web/dist/vocab-webpack-web.cjs.d.ts +1 -0
  29. package/web/dist/vocab-webpack-web.cjs.dev.js +38 -0
  30. package/web/dist/vocab-webpack-web.cjs.js +7 -0
  31. package/web/dist/vocab-webpack-web.cjs.prod.js +38 -0
  32. package/web/dist/vocab-webpack-web.esm.js +28 -0
  33. package/web/package.json +4 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,268 @@
1
+ # @vocab/webpack
2
+
3
+ ## 0.0.0-package-files-20231142931
4
+
5
+ ### Patch Changes
6
+
7
+ - [`29c81d3`](https://github.com/seek-oss/vocab/commit/29c81d370799f631d97c45e727b8cf81453bd398) Thanks [@askoufis](https://github.com/askoufis)! - Exclude source files from package build
8
+
9
+ - Updated dependencies [[`29c81d3`](https://github.com/seek-oss/vocab/commit/29c81d370799f631d97c45e727b8cf81453bd398)]:
10
+ - @vocab/types@0.0.0-package-files-20231142931
11
+ - virtual-resource-loader@0.0.0-package-files-20231142931
12
+
13
+ ## 1.1.1
14
+
15
+ ### Patch Changes
16
+
17
+ - [`09a698a`](https://github.com/seek-oss/vocab/commit/09a698af6aff86a851e4f829916b8f1f6beaca58) [#89](https://github.com/seek-oss/vocab/pull/89) Thanks [@mikebarkmin](https://github.com/mikebarkmin)! - Add exports to packages with multiple entry points. This fixes
18
+ `ERR_UNSUPPORTED_DIR_IMPORT` issues e.g. with NextJS or other setups, which
19
+ rely on the new node resolver when using ESM packages.
20
+ - Updated dependencies [[`09a698a`](https://github.com/seek-oss/vocab/commit/09a698af6aff86a851e4f829916b8f1f6beaca58)]:
21
+ - @vocab/core@1.1.1
22
+
23
+ ## 1.1.0
24
+
25
+ ### Minor Changes
26
+
27
+ - [`87333d7`](https://github.com/seek-oss/vocab/commit/87333d79c4a883b07d7d8f2c272b16e2243c49bd) [#80](https://github.com/seek-oss/vocab/pull/80) Thanks [@askoufis](https://github.com/askoufis)! - Enable the creation of generated languages via the `generatedLanguages` config.
28
+ See [the docs] for more information and examples.
29
+
30
+ [the docs]: https://github.com/seek-oss/vocab#generated-languages
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies [[`87333d7`](https://github.com/seek-oss/vocab/commit/87333d79c4a883b07d7d8f2c272b16e2243c49bd)]:
35
+ - @vocab/core@1.1.0
36
+ - @vocab/types@1.1.0
37
+
38
+ ## 1.0.3
39
+
40
+ ### Patch Changes
41
+
42
+ - [`3751301`](https://github.com/seek-oss/vocab/commit/37513013d869d6813c20d9ae9d53ac1fe2be2629) [#68](https://github.com/seek-oss/vocab/pull/68) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Remove compiler target warning
43
+
44
+ ## 1.0.2
45
+
46
+ ### Patch Changes
47
+
48
+ - [`304f404`](https://github.com/seek-oss/vocab/commit/304f404e812c4e7459e5d111612db69d42c6b376) [#67](https://github.com/seek-oss/vocab/pull/67) Thanks [@jahredhope](https://github.com/jahredhope)! - Provide additional information when Plugin is applied to incorrect target
49
+
50
+ - Updated dependencies [[`3ec6dba`](https://github.com/seek-oss/vocab/commit/3ec6dbaad590299cc33e2d9d4a877576eb05853a)]:
51
+ - @vocab/core@1.0.2
52
+ - @vocab/types@1.0.1
53
+
54
+ ## 1.0.1
55
+
56
+ ### Patch Changes
57
+
58
+ - [`aeee7fa`](https://github.com/seek-oss/vocab/commit/aeee7fa4081b0d732d271ce39d5865c51160f546) [#57](https://github.com/seek-oss/vocab/pull/57) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Fix encoding when languages have special characters
59
+
60
+ ## 1.0.0
61
+
62
+ ### Major Changes
63
+
64
+ - [`3031054`](https://github.com/seek-oss/vocab/commit/303105440851db6126f0606e1607745b27dd981c) [#51](https://github.com/seek-oss/vocab/pull/51) Thanks [@jahredhope](https://github.com/jahredhope)! - Release v1.0.0
65
+
66
+ Release Vocab as v1.0.0 to signify a stable API and support future [semver versioning](https://semver.org/) releases.
67
+
68
+ Vocab has seen a lot of iteration and changes since it was first published on 20 November 2020. We are now confident with the API and believe Vocab is ready for common use.
69
+
70
+ ### Patch Changes
71
+
72
+ - [`102556f`](https://github.com/seek-oss/vocab/commit/102556ff5ddae4d6f031e6ea6d119b12259b0a97) [#49](https://github.com/seek-oss/vocab/pull/49) Thanks [@jahredhope](https://github.com/jahredhope)! - Change VocabWebpackPlugin to a named export
73
+
74
+ * [`d62f256`](https://github.com/seek-oss/vocab/commit/d62f2564cd33d9a206984786701575d2a2690fae) [#53](https://github.com/seek-oss/vocab/pull/53) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Update `@vocab/unloader` usage to new `virtual-resource-loader`
75
+
76
+ * Updated dependencies [[`0074382`](https://github.com/seek-oss/vocab/commit/007438273ef70f5d5ded45777933651ad8df36f6), [`3031054`](https://github.com/seek-oss/vocab/commit/303105440851db6126f0606e1607745b27dd981c)]:
77
+ - @vocab/core@1.0.0
78
+ - @vocab/types@1.0.0
79
+
80
+ ## 0.0.19
81
+
82
+ ### Patch Changes
83
+
84
+ - [`5b1fdc0`](https://github.com/seek-oss/vocab/commit/5b1fdc019522b12e7ef94b2fec57b54a9310d41c) [#46](https://github.com/seek-oss/vocab/pull/46) Thanks [@jahredhope](https://github.com/jahredhope)! - Enable the use of translation files directly with 3 new documented methods for working with translations.
85
+
86
+ ```typescript
87
+ /**
88
+ * Retrieve messages. If not available, will attempt to load messages and resolve once complete.
89
+ */
90
+ translations.getMessages(language);
91
+ /**
92
+ * Retrieve already loaded messages. Will return null if messages haven't been loaded.
93
+ */
94
+ translations.getLoadedMessages(language);
95
+ /**
96
+ * Load messages for the given language. Resolving once complete.
97
+ */
98
+ translations.load(language);
99
+ ```
100
+
101
+ - Updated dependencies [[`5b1fdc0`](https://github.com/seek-oss/vocab/commit/5b1fdc019522b12e7ef94b2fec57b54a9310d41c)]:
102
+ - @vocab/core@0.0.11
103
+ - @vocab/types@0.0.9
104
+
105
+ ## 0.0.18
106
+
107
+ ### Patch Changes
108
+
109
+ - Updated dependencies [[`7c96a14`](https://github.com/seek-oss/vocab/commit/7c96a142f602132d38c1df1a47a1f4657dc5c94c)]:
110
+ - @vocab/core@0.0.10
111
+
112
+ ## 0.0.17
113
+
114
+ ### Patch Changes
115
+
116
+ - Updated dependencies [[`3034bd3`](https://github.com/seek-oss/vocab/commit/3034bd3de610a9d1f3bfbd8caefa27064dee2710), [`c110745`](https://github.com/seek-oss/vocab/commit/c110745b79df1a8ade6b1d8a49e798b04a7b95e1)]:
117
+ - @vocab/core@0.0.9
118
+
119
+ ## 0.0.16
120
+
121
+ ### Patch Changes
122
+
123
+ - [`3d4fa18`](https://github.com/seek-oss/vocab/commit/3d4fa18b2b8c8f640d778ba30603df323a563a38) [#37](https://github.com/seek-oss/vocab/pull/37) Thanks [@jahredhope](https://github.com/jahredhope)! - Apply loader to all vocab translation index files
124
+
125
+ * [`f2fca67`](https://github.com/seek-oss/vocab/commit/f2fca679c66ae65405a0aa24f0a0e472026aad0d) [#36](https://github.com/seek-oss/vocab/pull/36) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Support custom locales for ICU message parsing
126
+
127
+ * Updated dependencies [[`f2fca67`](https://github.com/seek-oss/vocab/commit/f2fca679c66ae65405a0aa24f0a0e472026aad0d)]:
128
+ - @vocab/core@0.0.8
129
+ - @vocab/types@0.0.8
130
+
131
+ ## 0.0.15
132
+
133
+ ### Patch Changes
134
+
135
+ - [`283bcad`](https://github.com/seek-oss/vocab/commit/283bcada06e622ab14ed891743ed3f55cf09e245) [#33](https://github.com/seek-oss/vocab/pull/33) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Move all vocab files to single directory with configurable suffix
136
+
137
+ * [`ad0d240`](https://github.com/seek-oss/vocab/commit/ad0d2404545ded8e11621eae8f29467ff3352366) [#31](https://github.com/seek-oss/vocab/pull/31) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Move the node runtime from @vocab/webpack to @vocab/core
138
+
139
+ * Updated dependencies [[`283bcad`](https://github.com/seek-oss/vocab/commit/283bcada06e622ab14ed891743ed3f55cf09e245), [`ad0d240`](https://github.com/seek-oss/vocab/commit/ad0d2404545ded8e11621eae8f29467ff3352366), [`f3992ef`](https://github.com/seek-oss/vocab/commit/f3992efbf08939ebf853fac650a49cc46dc51dfb), [`f3992ef`](https://github.com/seek-oss/vocab/commit/f3992efbf08939ebf853fac650a49cc46dc51dfb)]:
140
+ - @vocab/core@0.0.7
141
+ - @vocab/types@0.0.7
142
+
143
+ ## 0.0.14
144
+
145
+ ### Patch Changes
146
+
147
+ - [`80f85e9`](https://github.com/seek-oss/vocab/commit/80f85e9c45051da233a3edae062d8af6d7ca50e5) [#29](https://github.com/seek-oss/vocab/pull/29) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Fix mismatched file hashes across systems
148
+
149
+ ## 0.0.13
150
+
151
+ ### Patch Changes
152
+
153
+ - Updated dependencies [[`80a46c0`](https://github.com/seek-oss/vocab/commit/80a46c01a55408675f5822c3618519f80136c3ab), [`80a46c0`](https://github.com/seek-oss/vocab/commit/80a46c01a55408675f5822c3618519f80136c3ab)]:
154
+ - @vocab/core@0.0.6
155
+ - @vocab/types@0.0.6
156
+
157
+ ## 0.0.12
158
+
159
+ ### Patch Changes
160
+
161
+ - [`3504706`](https://github.com/seek-oss/vocab/commit/35047069de334f62986518ff0be1bc3a08cc644f) [#20](https://github.com/seek-oss/vocab/pull/20) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Remove unnecessary webpack dependecies on alt language files
162
+
163
+ - Updated dependencies [[`371ed16`](https://github.com/seek-oss/vocab/commit/371ed16a232a04dab13afa7e2b352dfb6724eea4), [`c222d68`](https://github.com/seek-oss/vocab/commit/c222d68a3c0c24723a338eccb959798881f6a118)]:
164
+ - @vocab/core@0.0.5
165
+
166
+ ## 0.0.11
167
+
168
+ ### Patch Changes
169
+
170
+ - [`5f5c581`](https://github.com/seek-oss/vocab/commit/5f5c581a65bff28729ee19e1ec0bdea488a9d6c2) [#19](https://github.com/seek-oss/vocab/pull/19) Thanks [@jahredhope](https://github.com/jahredhope)! - Compile useable TypeScript importable files with `vocab compile`.
171
+
172
+ The new `vocab compile` step replaces `vocab generate-types` in creating a fully functional **translations.ts** file.
173
+
174
+ This allows vocab to be used **without the Webpack Plugin**, however use of the plugin is still heavily advised to ensure optimal loading of translation content on the web.
175
+
176
+ Support for unit testing is now better than ever! The newly created **translations.ts** means your unit test code will see the same code as available while rendering.
177
+
178
+ See the [documentation](https://github.com/seek-oss/vocab) for further usage details.
179
+
180
+ * [`02f943c`](https://github.com/seek-oss/vocab/commit/02f943ca892913b41f9e4720a72400777cf14b3d) [#17](https://github.com/seek-oss/vocab/pull/17) Thanks [@jahredhope](https://github.com/jahredhope)! - Add additional debug traces
181
+
182
+ * Updated dependencies [[`5f5c581`](https://github.com/seek-oss/vocab/commit/5f5c581a65bff28729ee19e1ec0bdea488a9d6c2), [`02f943c`](https://github.com/seek-oss/vocab/commit/02f943ca892913b41f9e4720a72400777cf14b3d)]:
183
+ - @vocab/core@0.0.4
184
+ - @vocab/types@0.0.5
185
+
186
+ ## 0.0.10
187
+
188
+ ### Patch Changes
189
+
190
+ - [`08de30d`](https://github.com/seek-oss/vocab/commit/08de30d338c2a5ebdcf14da7c736dddf22e7ca9e) [#14](https://github.com/seek-oss/vocab/pull/14) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Only add neccesary data to translation build output
191
+
192
+ * [`26b52f4`](https://github.com/seek-oss/vocab/commit/26b52f4878ded440841e08c858bdc9e685500c2a) [#16](https://github.com/seek-oss/vocab/pull/16) Thanks [@jahredhope](https://github.com/jahredhope)! - Enable debugging with DEBUG environment variable
193
+
194
+ - [`e4b5faa`](https://github.com/seek-oss/vocab/commit/e4b5faacf1381892bcdb68ac3f0c178263d810aa) [#10](https://github.com/seek-oss/vocab/pull/10) Thanks [@jahredhope](https://github.com/jahredhope)! - Allow no parameters in Webpack plugin
195
+
196
+ - Updated dependencies [[`08de30d`](https://github.com/seek-oss/vocab/commit/08de30d338c2a5ebdcf14da7c736dddf22e7ca9e), [`ed6cf40`](https://github.com/seek-oss/vocab/commit/ed6cf408973f2e9c4d07a71fcb52f40294ebaf65), [`26b52f4`](https://github.com/seek-oss/vocab/commit/26b52f4878ded440841e08c858bdc9e685500c2a), [`b5a5a05`](https://github.com/seek-oss/vocab/commit/b5a5a05a5bb87b48e6e9160af75f555728143ea2)]:
197
+ - @vocab/core@0.0.3
198
+ - @vocab/types@0.0.4
199
+
200
+ ## 0.0.9
201
+
202
+ ### Patch Changes
203
+
204
+ - [`4710f34`](https://github.com/seek-oss/vocab/commit/4710f341f2827643e3eff69ef7e26d44ec6e8a2b) [#8](https://github.com/seek-oss/vocab/pull/8) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Convert from webpack loader to plugin
205
+
206
+ The plugin supports passing custom config options as well as resolving `vocab.config.js`.
207
+
208
+ - Updated dependencies [[`4710f34`](https://github.com/seek-oss/vocab/commit/4710f341f2827643e3eff69ef7e26d44ec6e8a2b), [`4710f34`](https://github.com/seek-oss/vocab/commit/4710f341f2827643e3eff69ef7e26d44ec6e8a2b)]:
209
+ - @vocab/types@0.0.3
210
+ - @vocab/core@0.0.2
211
+
212
+ ## 0.0.8
213
+
214
+ ### Patch Changes
215
+
216
+ - Updated dependencies [[`2c7779f`](https://github.com/seek-oss/vocab/commit/2c7779f5384793af6a178f5ab4d56b6a9f09bc02)]:
217
+ - @vocab/utils@0.0.6
218
+
219
+ ## 0.0.7
220
+
221
+ ### Patch Changes
222
+
223
+ - [`504a808`](https://github.com/seek-oss/vocab/commit/504a808d61f359336f3b2bd95f61cb051d98922f) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Ensure virtual file uniqueness
224
+
225
+ * [`f7b6b5c`](https://github.com/seek-oss/vocab/commit/f7b6b5c1cdb3f72bb0a3d0c5c7a3da844b2a1c87) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Fix language fallbacks
226
+
227
+ * Updated dependencies [[`f7b6b5c`](https://github.com/seek-oss/vocab/commit/f7b6b5c1cdb3f72bb0a3d0c5c7a3da844b2a1c87)]:
228
+ - @vocab/utils@0.0.5
229
+
230
+ ## 0.0.6
231
+
232
+ ### Patch Changes
233
+
234
+ - [`4589bce`](https://github.com/seek-oss/vocab/commit/4589bce912b7a8fb869e1c3a65d0c4c417043faf) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Support language fallbacks through `extends` config
235
+
236
+ * [`870a74b`](https://github.com/seek-oss/vocab/commit/870a74b9a15ec2cb493c3de526c599b24fd5830d) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Support custom config file locations
237
+
238
+ * Updated dependencies [[`4589bce`](https://github.com/seek-oss/vocab/commit/4589bce912b7a8fb869e1c3a65d0c4c417043faf), [`215eeba`](https://github.com/seek-oss/vocab/commit/215eeba619260b349a39d99a79fc69503dba5ccf), [`bf36f86`](https://github.com/seek-oss/vocab/commit/bf36f86a74ced4f42271b2f8fb128e995bb8c849), [`870a74b`](https://github.com/seek-oss/vocab/commit/870a74b9a15ec2cb493c3de526c599b24fd5830d)]:
239
+ - @vocab/utils@0.0.4
240
+
241
+ ## 0.0.5
242
+
243
+ ### Patch Changes
244
+
245
+ - Updated dependencies [[`6f2c084`](https://github.com/seek-oss/vocab/commit/6f2c08419ce5773c589901fafa7bec7a1c94d2a5)]:
246
+ - @vocab/utils@0.0.3
247
+
248
+ ## 0.0.4
249
+
250
+ ### Patch Changes
251
+
252
+ - [`4e3d94f`](https://github.com/seek-oss/vocab/commit/4e3d94f2e63f669bb11c7f0e89b1da1d94def87e) Thanks [@jahredhope](https://github.com/jahredhope)! - Fix webpack returning error on success
253
+
254
+ ## 0.0.3
255
+
256
+ ### Patch Changes
257
+
258
+ - [`0830756`](https://github.com/seek-oss/vocab/commit/0830756273c9d53664815b487fa69989419f102b) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Fix runtime import path
259
+
260
+ ## 0.0.2
261
+
262
+ ### Patch Changes
263
+
264
+ - [`9f99ea7`](https://github.com/seek-oss/vocab/commit/9f99ea7c827ec4d7c21a485e17e3adbbd1c49319) Thanks [@jahredhope](https://github.com/jahredhope)! - Remove React as dependency and target node
265
+
266
+ - Updated dependencies [[`9f99ea7`](https://github.com/seek-oss/vocab/commit/9f99ea7c827ec4d7c21a485e17e3adbbd1c49319)]:
267
+ - @vocab/types@0.0.2
268
+ - @vocab/utils@0.0.2
@@ -0,0 +1 @@
1
+ export * from "../../dist/declarations/src/chunk-name";
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function getChunkName(lang) {
6
+ return `${lang}-translations`;
7
+ }
8
+
9
+ exports.getChunkName = getChunkName;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./vocab-webpack-chunk-name.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./vocab-webpack-chunk-name.cjs.dev.js");
7
+ }
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function getChunkName(lang) {
6
+ return `${lang}-translations`;
7
+ }
8
+
9
+ exports.getChunkName = getChunkName;
@@ -0,0 +1,5 @@
1
+ function getChunkName(lang) {
2
+ return `${lang}-translations`;
3
+ }
4
+
5
+ export { getChunkName };
@@ -0,0 +1,4 @@
1
+ {
2
+ "main": "dist/vocab-webpack-chunk-name.cjs.js",
3
+ "module": "dist/vocab-webpack-chunk-name.esm.js"
4
+ }
@@ -0,0 +1 @@
1
+ export declare function getChunkName(lang: string): string;
@@ -0,0 +1,11 @@
1
+ import { UserConfig } from '@vocab/types';
2
+ import type { Compiler } from 'webpack';
3
+ interface UserOptions extends Partial<UserConfig> {
4
+ configFile?: string;
5
+ }
6
+ export declare class VocabWebpackPlugin {
7
+ options: UserConfig;
8
+ constructor({ configFile, ...rest }?: UserOptions);
9
+ apply(compiler: Compiler): void;
10
+ }
11
+ export {};
@@ -0,0 +1,8 @@
1
+ interface LoaderContext {
2
+ addDependency: (filePath: string) => void;
3
+ target: string;
4
+ resourcePath: string;
5
+ async: () => (err: unknown, result?: string) => void;
6
+ }
7
+ export default function vocabLoader(this: LoaderContext): Promise<void>;
8
+ export {};
@@ -0,0 +1,3 @@
1
+ import debug from 'debug';
2
+ export declare const trace: debug.Debugger;
3
+ export declare const log: (...params: unknown[]) => void;
@@ -0,0 +1,3 @@
1
+ import type { TranslationModule } from '@vocab/types';
2
+ export { createTranslationFile } from '@vocab/core/translation-file';
3
+ export declare const createLanguage: (moduleId: string, loadImport: () => Promise<any>) => TranslationModule<any>;
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ require('chalk');
4
+ var debug = require('debug');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
7
+
8
+ var debug__default = /*#__PURE__*/_interopDefault(debug);
9
+
10
+ const trace = debug__default['default'](`vocab:webpack`);
11
+
12
+ exports.trace = trace;
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ require('chalk');
4
+ var debug = require('debug');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
7
+
8
+ var debug__default = /*#__PURE__*/_interopDefault(debug);
9
+
10
+ const trace = debug__default['default'](`vocab:webpack`);
11
+
12
+ exports.trace = trace;
@@ -0,0 +1,6 @@
1
+ import 'chalk';
2
+ import debug from 'debug';
3
+
4
+ const trace = debug(`vocab:webpack`);
5
+
6
+ export { trace as t };
@@ -0,0 +1 @@
1
+ export * from "./declarations/src/index";
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var core = require('@vocab/core');
6
+ var logger = require('./logger-403e7dbd.cjs.dev.js');
7
+ require('chalk');
8
+ require('debug');
9
+
10
+ class VocabWebpackPlugin {
11
+ constructor({
12
+ configFile,
13
+ ...rest
14
+ } = {}) {
15
+ logger.trace(`Creating Vocab plugin${configFile ? ` with config file ${configFile}` : ''}`);
16
+ this.options = { ...core.resolveConfigSync(configFile),
17
+ ...rest
18
+ };
19
+ core.validateConfig(this.options);
20
+ }
21
+
22
+ apply(compiler) {
23
+ logger.trace(`Applying plugin: ${compiler.options.name} (${compiler.options.target})`);
24
+
25
+ if (!compiler.options.module) {
26
+ // @ts-expect-error Support for older versions of webpack that may not have module defined at this stage
27
+ compiler.options.module = {
28
+ rules: []
29
+ };
30
+ }
31
+
32
+ if (!compiler.options.module.rules) {
33
+ compiler.options.module.rules = [];
34
+ }
35
+
36
+ compiler.options.module.rules.splice(0, 0, {
37
+ test: /\.vocab[\\\/]index\.ts$/,
38
+ loader: require.resolve('@vocab/webpack/loader'),
39
+ options: this.options
40
+ });
41
+ }
42
+
43
+ }
44
+
45
+ exports.VocabWebpackPlugin = VocabWebpackPlugin;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./vocab-webpack.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./vocab-webpack.cjs.dev.js");
7
+ }
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var core = require('@vocab/core');
6
+ var logger = require('./logger-ca502069.cjs.prod.js');
7
+ require('chalk');
8
+ require('debug');
9
+
10
+ class VocabWebpackPlugin {
11
+ constructor({
12
+ configFile,
13
+ ...rest
14
+ } = {}) {
15
+ logger.trace(`Creating Vocab plugin${configFile ? ` with config file ${configFile}` : ''}`);
16
+ this.options = { ...core.resolveConfigSync(configFile),
17
+ ...rest
18
+ };
19
+ core.validateConfig(this.options);
20
+ }
21
+
22
+ apply(compiler) {
23
+ logger.trace(`Applying plugin: ${compiler.options.name} (${compiler.options.target})`);
24
+
25
+ if (!compiler.options.module) {
26
+ // @ts-expect-error Support for older versions of webpack that may not have module defined at this stage
27
+ compiler.options.module = {
28
+ rules: []
29
+ };
30
+ }
31
+
32
+ if (!compiler.options.module.rules) {
33
+ compiler.options.module.rules = [];
34
+ }
35
+
36
+ compiler.options.module.rules.splice(0, 0, {
37
+ test: /\.vocab[\\\/]index\.ts$/,
38
+ loader: require.resolve('@vocab/webpack/loader'),
39
+ options: this.options
40
+ });
41
+ }
42
+
43
+ }
44
+
45
+ exports.VocabWebpackPlugin = VocabWebpackPlugin;
@@ -0,0 +1,41 @@
1
+ import { resolveConfigSync, validateConfig } from '@vocab/core';
2
+ import { t as trace } from './logger-e1862ea1.esm.js';
3
+ import 'chalk';
4
+ import 'debug';
5
+
6
+ class VocabWebpackPlugin {
7
+ constructor({
8
+ configFile,
9
+ ...rest
10
+ } = {}) {
11
+ trace(`Creating Vocab plugin${configFile ? ` with config file ${configFile}` : ''}`);
12
+ this.options = { ...resolveConfigSync(configFile),
13
+ ...rest
14
+ };
15
+ validateConfig(this.options);
16
+ }
17
+
18
+ apply(compiler) {
19
+ trace(`Applying plugin: ${compiler.options.name} (${compiler.options.target})`);
20
+
21
+ if (!compiler.options.module) {
22
+ // @ts-expect-error Support for older versions of webpack that may not have module defined at this stage
23
+ compiler.options.module = {
24
+ rules: []
25
+ };
26
+ }
27
+
28
+ if (!compiler.options.module.rules) {
29
+ compiler.options.module.rules = [];
30
+ }
31
+
32
+ compiler.options.module.rules.splice(0, 0, {
33
+ test: /\.vocab[\\\/]index\.ts$/,
34
+ loader: require.resolve('@vocab/webpack/loader'),
35
+ options: this.options
36
+ });
37
+ }
38
+
39
+ }
40
+
41
+ export { VocabWebpackPlugin };
@@ -0,0 +1,2 @@
1
+ export * from "../../dist/declarations/src/loader";
2
+ export { default } from "../../dist/declarations/src/loader";
@@ -0,0 +1,81 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var path = require('path');
6
+ var core = require('@vocab/core');
7
+ var loaderUtils = require('loader-utils');
8
+ var chunkName_dist_vocabWebpackChunkName = require('../../chunk-name/dist/vocab-webpack-chunk-name.cjs.dev.js');
9
+ var logger = require('../../dist/logger-403e7dbd.cjs.dev.js');
10
+ require('chalk');
11
+ require('debug');
12
+
13
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
14
+
15
+ var path__default = /*#__PURE__*/_interopDefault(path);
16
+
17
+ const trace = logger.trace.extend('loader');
18
+
19
+ const encodeWithinSingleQuotes = v => v.replace(/'/g, "\\'");
20
+
21
+ function createIdentifier(lang, resourcePath, loadedTranslation) {
22
+ var _loadedTranslation$la;
23
+
24
+ trace('Creating identifier for language ', lang);
25
+ const languageTranslations = (_loadedTranslation$la = loadedTranslation.languages[lang]) !== null && _loadedTranslation$la !== void 0 ? _loadedTranslation$la : {};
26
+ const langJson = {};
27
+
28
+ for (const key of loadedTranslation.keys) {
29
+ langJson[key] = languageTranslations[key].message;
30
+ }
31
+
32
+ const base64 = Buffer.from(JSON.stringify(langJson), 'utf-8').toString('base64');
33
+ const unloader = `virtual-resource-loader?source=${base64}`;
34
+ const fileIdent = path__default['default'].basename(resourcePath, 'translations.json');
35
+ return `./${fileIdent}-${lang}-virtual.json!=!${unloader}!json-loader!`;
36
+ }
37
+
38
+ const renderLanguageLoaderAsync = (resourcePath, loadedTranslation) => lang => {
39
+ const identifier = createIdentifier(lang, resourcePath, loadedTranslation);
40
+ return `'${encodeWithinSingleQuotes(lang)}': createLanguage(require.resolveWeak('${identifier}'), () => import(
41
+ /* webpackChunkName: "${chunkName_dist_vocabWebpackChunkName.getChunkName(lang)}" */
42
+ '${identifier}'
43
+ ))`;
44
+ };
45
+
46
+ async function vocabLoader() {
47
+ trace(`Using vocab loader for ${this.resourcePath}`);
48
+ const callback = this.async();
49
+
50
+ if (!callback) {
51
+ throw new Error(`Webpack didn't provide an async callback`);
52
+ }
53
+
54
+ const config = loaderUtils.getOptions(this);
55
+ const devJsonFilePath = core.getDevLanguageFileFromTsFile(this.resourcePath);
56
+ const loadedTranslation = core.loadTranslation({
57
+ filePath: devJsonFilePath,
58
+ fallbacks: 'all'
59
+ }, config);
60
+ const target = this.target;
61
+
62
+ if (target && target !== 'web') {
63
+ trace(`Why are you using the loader on ${target}?`);
64
+ callback(new Error('Called Vocab Loader with non-web target'));
65
+ return;
66
+ }
67
+
68
+ const renderLanguageLoader = renderLanguageLoaderAsync(devJsonFilePath, loadedTranslation);
69
+ const loadedLanguages = Object.keys(loadedTranslation.languages);
70
+ const result = `
71
+ import { createLanguage, createTranslationFile } from '@vocab/webpack/${target}';
72
+
73
+ export default createTranslationFile({
74
+ ${loadedLanguages.map(lang => renderLanguageLoader(lang)).join(',')}
75
+ });
76
+ `;
77
+ trace('Created translation file', result);
78
+ callback(null, result);
79
+ }
80
+
81
+ exports['default'] = vocabLoader;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./vocab-webpack-loader.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./vocab-webpack-loader.cjs.dev.js");
7
+ }
@@ -0,0 +1,81 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var path = require('path');
6
+ var core = require('@vocab/core');
7
+ var loaderUtils = require('loader-utils');
8
+ var chunkName_dist_vocabWebpackChunkName = require('../../chunk-name/dist/vocab-webpack-chunk-name.cjs.prod.js');
9
+ var logger = require('../../dist/logger-ca502069.cjs.prod.js');
10
+ require('chalk');
11
+ require('debug');
12
+
13
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
14
+
15
+ var path__default = /*#__PURE__*/_interopDefault(path);
16
+
17
+ const trace = logger.trace.extend('loader');
18
+
19
+ const encodeWithinSingleQuotes = v => v.replace(/'/g, "\\'");
20
+
21
+ function createIdentifier(lang, resourcePath, loadedTranslation) {
22
+ var _loadedTranslation$la;
23
+
24
+ trace('Creating identifier for language ', lang);
25
+ const languageTranslations = (_loadedTranslation$la = loadedTranslation.languages[lang]) !== null && _loadedTranslation$la !== void 0 ? _loadedTranslation$la : {};
26
+ const langJson = {};
27
+
28
+ for (const key of loadedTranslation.keys) {
29
+ langJson[key] = languageTranslations[key].message;
30
+ }
31
+
32
+ const base64 = Buffer.from(JSON.stringify(langJson), 'utf-8').toString('base64');
33
+ const unloader = `virtual-resource-loader?source=${base64}`;
34
+ const fileIdent = path__default['default'].basename(resourcePath, 'translations.json');
35
+ return `./${fileIdent}-${lang}-virtual.json!=!${unloader}!json-loader!`;
36
+ }
37
+
38
+ const renderLanguageLoaderAsync = (resourcePath, loadedTranslation) => lang => {
39
+ const identifier = createIdentifier(lang, resourcePath, loadedTranslation);
40
+ return `'${encodeWithinSingleQuotes(lang)}': createLanguage(require.resolveWeak('${identifier}'), () => import(
41
+ /* webpackChunkName: "${chunkName_dist_vocabWebpackChunkName.getChunkName(lang)}" */
42
+ '${identifier}'
43
+ ))`;
44
+ };
45
+
46
+ async function vocabLoader() {
47
+ trace(`Using vocab loader for ${this.resourcePath}`);
48
+ const callback = this.async();
49
+
50
+ if (!callback) {
51
+ throw new Error(`Webpack didn't provide an async callback`);
52
+ }
53
+
54
+ const config = loaderUtils.getOptions(this);
55
+ const devJsonFilePath = core.getDevLanguageFileFromTsFile(this.resourcePath);
56
+ const loadedTranslation = core.loadTranslation({
57
+ filePath: devJsonFilePath,
58
+ fallbacks: 'all'
59
+ }, config);
60
+ const target = this.target;
61
+
62
+ if (target && target !== 'web') {
63
+ trace(`Why are you using the loader on ${target}?`);
64
+ callback(new Error('Called Vocab Loader with non-web target'));
65
+ return;
66
+ }
67
+
68
+ const renderLanguageLoader = renderLanguageLoaderAsync(devJsonFilePath, loadedTranslation);
69
+ const loadedLanguages = Object.keys(loadedTranslation.languages);
70
+ const result = `
71
+ import { createLanguage, createTranslationFile } from '@vocab/webpack/${target}';
72
+
73
+ export default createTranslationFile({
74
+ ${loadedLanguages.map(lang => renderLanguageLoader(lang)).join(',')}
75
+ });
76
+ `;
77
+ trace('Created translation file', result);
78
+ callback(null, result);
79
+ }
80
+
81
+ exports['default'] = vocabLoader;
@@ -0,0 +1,73 @@
1
+ import path from 'path';
2
+ import { getDevLanguageFileFromTsFile, loadTranslation } from '@vocab/core';
3
+ import { getOptions } from 'loader-utils';
4
+ import { getChunkName } from '../../chunk-name/dist/vocab-webpack-chunk-name.esm.js';
5
+ import { t as trace$1 } from '../../dist/logger-e1862ea1.esm.js';
6
+ import 'chalk';
7
+ import 'debug';
8
+
9
+ const trace = trace$1.extend('loader');
10
+
11
+ const encodeWithinSingleQuotes = v => v.replace(/'/g, "\\'");
12
+
13
+ function createIdentifier(lang, resourcePath, loadedTranslation) {
14
+ var _loadedTranslation$la;
15
+
16
+ trace('Creating identifier for language ', lang);
17
+ const languageTranslations = (_loadedTranslation$la = loadedTranslation.languages[lang]) !== null && _loadedTranslation$la !== void 0 ? _loadedTranslation$la : {};
18
+ const langJson = {};
19
+
20
+ for (const key of loadedTranslation.keys) {
21
+ langJson[key] = languageTranslations[key].message;
22
+ }
23
+
24
+ const base64 = Buffer.from(JSON.stringify(langJson), 'utf-8').toString('base64');
25
+ const unloader = `virtual-resource-loader?source=${base64}`;
26
+ const fileIdent = path.basename(resourcePath, 'translations.json');
27
+ return `./${fileIdent}-${lang}-virtual.json!=!${unloader}!json-loader!`;
28
+ }
29
+
30
+ const renderLanguageLoaderAsync = (resourcePath, loadedTranslation) => lang => {
31
+ const identifier = createIdentifier(lang, resourcePath, loadedTranslation);
32
+ return `'${encodeWithinSingleQuotes(lang)}': createLanguage(require.resolveWeak('${identifier}'), () => import(
33
+ /* webpackChunkName: "${getChunkName(lang)}" */
34
+ '${identifier}'
35
+ ))`;
36
+ };
37
+
38
+ async function vocabLoader() {
39
+ trace(`Using vocab loader for ${this.resourcePath}`);
40
+ const callback = this.async();
41
+
42
+ if (!callback) {
43
+ throw new Error(`Webpack didn't provide an async callback`);
44
+ }
45
+
46
+ const config = getOptions(this);
47
+ const devJsonFilePath = getDevLanguageFileFromTsFile(this.resourcePath);
48
+ const loadedTranslation = loadTranslation({
49
+ filePath: devJsonFilePath,
50
+ fallbacks: 'all'
51
+ }, config);
52
+ const target = this.target;
53
+
54
+ if (target && target !== 'web') {
55
+ trace(`Why are you using the loader on ${target}?`);
56
+ callback(new Error('Called Vocab Loader with non-web target'));
57
+ return;
58
+ }
59
+
60
+ const renderLanguageLoader = renderLanguageLoaderAsync(devJsonFilePath, loadedTranslation);
61
+ const loadedLanguages = Object.keys(loadedTranslation.languages);
62
+ const result = `
63
+ import { createLanguage, createTranslationFile } from '@vocab/webpack/${target}';
64
+
65
+ export default createTranslationFile({
66
+ ${loadedLanguages.map(lang => renderLanguageLoader(lang)).join(',')}
67
+ });
68
+ `;
69
+ trace('Created translation file', result);
70
+ callback(null, result);
71
+ }
72
+
73
+ export { vocabLoader as default };
@@ -0,0 +1,4 @@
1
+ {
2
+ "main": "dist/vocab-webpack-loader.cjs.js",
3
+ "module": "dist/vocab-webpack-loader.esm.js"
4
+ }
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@vocab/webpack",
3
+ "version": "0.0.0-package-files-20231142931",
4
+ "main": "dist/vocab-webpack.cjs.js",
5
+ "module": "dist/vocab-webpack.esm.js",
6
+ "exports": {
7
+ "./package.json": "./package.json",
8
+ ".": {
9
+ "module": "./dist/vocab-webpack.esm.js",
10
+ "default": "./dist/vocab-webpack.cjs.js"
11
+ },
12
+ "./chunk-name": {
13
+ "module": "./chunk-name/dist/vocab-webpack-chunk-name.esm.js",
14
+ "default": "./chunk-name/dist/vocab-webpack-chunk-name.cjs.js"
15
+ },
16
+ "./loader": {
17
+ "module": "./loader/dist/vocab-webpack-loader.esm.js",
18
+ "default": "./loader/dist/vocab-webpack-loader.cjs.js"
19
+ },
20
+ "./web": {
21
+ "module": "./web/dist/vocab-webpack-web.esm.js",
22
+ "default": "./web/dist/vocab-webpack-web.cjs.js"
23
+ }
24
+ },
25
+ "author": "SEEK",
26
+ "license": "MIT",
27
+ "preconstruct": {
28
+ "entrypoints": [
29
+ "index.ts",
30
+ "loader.ts",
31
+ "web.ts",
32
+ "chunk-name.ts"
33
+ ]
34
+ },
35
+ "files": [
36
+ "chunk-name",
37
+ "dist",
38
+ "loader",
39
+ "web"
40
+ ],
41
+ "dependencies": {
42
+ "@vocab/core": "^1.1.1",
43
+ "@vocab/types": "^0.0.0-package-files-20231142931",
44
+ "chalk": "^4.1.0",
45
+ "debug": "^4.3.1",
46
+ "json-loader": "^0.5.7",
47
+ "loader-utils": "^2.0.0",
48
+ "virtual-resource-loader": "^0.0.0-package-files-20231142931"
49
+ },
50
+ "devDependencies": {
51
+ "@types/loader-utils": "^2.0.1"
52
+ }
53
+ }
@@ -0,0 +1 @@
1
+ export * from "../../dist/declarations/src/web";
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var icuHandler = require('@vocab/core/icu-handler');
6
+ var translationFile = require('@vocab/core/translation-file');
7
+
8
+ const createLanguage = (moduleId, loadImport) => {
9
+ let promiseValue;
10
+ return {
11
+ getValue: locale => {
12
+ // @ts-expect-error Missing webpack types
13
+ if (!__webpack_modules__[moduleId]) {
14
+ return undefined;
15
+ } // @ts-expect-error Missing webpack types
16
+
17
+
18
+ const m = __webpack_require__(moduleId);
19
+
20
+ return icuHandler.getParsedICUMessages(m, locale);
21
+ },
22
+ load: () => {
23
+ if (!promiseValue) {
24
+ promiseValue = loadImport();
25
+ }
26
+
27
+ return promiseValue;
28
+ }
29
+ };
30
+ };
31
+
32
+ Object.defineProperty(exports, 'createTranslationFile', {
33
+ enumerable: true,
34
+ get: function () {
35
+ return translationFile.createTranslationFile;
36
+ }
37
+ });
38
+ exports.createLanguage = createLanguage;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./vocab-webpack-web.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./vocab-webpack-web.cjs.dev.js");
7
+ }
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var icuHandler = require('@vocab/core/icu-handler');
6
+ var translationFile = require('@vocab/core/translation-file');
7
+
8
+ const createLanguage = (moduleId, loadImport) => {
9
+ let promiseValue;
10
+ return {
11
+ getValue: locale => {
12
+ // @ts-expect-error Missing webpack types
13
+ if (!__webpack_modules__[moduleId]) {
14
+ return undefined;
15
+ } // @ts-expect-error Missing webpack types
16
+
17
+
18
+ const m = __webpack_require__(moduleId);
19
+
20
+ return icuHandler.getParsedICUMessages(m, locale);
21
+ },
22
+ load: () => {
23
+ if (!promiseValue) {
24
+ promiseValue = loadImport();
25
+ }
26
+
27
+ return promiseValue;
28
+ }
29
+ };
30
+ };
31
+
32
+ Object.defineProperty(exports, 'createTranslationFile', {
33
+ enumerable: true,
34
+ get: function () {
35
+ return translationFile.createTranslationFile;
36
+ }
37
+ });
38
+ exports.createLanguage = createLanguage;
@@ -0,0 +1,28 @@
1
+ import { getParsedICUMessages } from '@vocab/core/icu-handler';
2
+ export { createTranslationFile } from '@vocab/core/translation-file';
3
+
4
+ const createLanguage = (moduleId, loadImport) => {
5
+ let promiseValue;
6
+ return {
7
+ getValue: locale => {
8
+ // @ts-expect-error Missing webpack types
9
+ if (!__webpack_modules__[moduleId]) {
10
+ return undefined;
11
+ } // @ts-expect-error Missing webpack types
12
+
13
+
14
+ const m = __webpack_require__(moduleId);
15
+
16
+ return getParsedICUMessages(m, locale);
17
+ },
18
+ load: () => {
19
+ if (!promiseValue) {
20
+ promiseValue = loadImport();
21
+ }
22
+
23
+ return promiseValue;
24
+ }
25
+ };
26
+ };
27
+
28
+ export { createLanguage };
@@ -0,0 +1,4 @@
1
+ {
2
+ "main": "dist/vocab-webpack-web.cjs.js",
3
+ "module": "dist/vocab-webpack-web.esm.js"
4
+ }