@vocab/vite 1.0.0 → 1.0.1
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/dist/chunks.cjs +7 -7
- package/dist/chunks.cjs.map +1 -1
- package/dist/chunks.d.cts +79 -4
- package/dist/chunks.d.mts +79 -4
- package/dist/chunks.mjs +5 -6
- package/dist/chunks.mjs.map +1 -1
- package/dist/get-chunk-name.cjs +2 -2
- package/dist/get-chunk-name.mjs +1 -1
- package/dist/index.cjs +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +9 -10
- package/dist/index.mjs.map +1 -1
- package/dist/{logger-FsdiJ8PT.cjs → logger-BusUtQic.cjs} +19 -25
- package/dist/{logger-FsdiJ8PT.cjs.map → logger-BusUtQic.cjs.map} +1 -1
- package/dist/{logger-BqzBQmMo.mjs → logger-DOiEeSfu.mjs} +2 -3
- package/dist/{logger-BqzBQmMo.mjs.map → logger-DOiEeSfu.mjs.map} +1 -1
- package/dist/runtime.cjs +8 -8
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.mjs +1 -2
- package/dist/runtime.mjs.map +1 -1
- package/package.json +15 -11
package/dist/chunks.cjs
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_logger = require("./logger-BusUtQic.cjs");
|
|
3
|
+
const require_get_chunk_name = require("./get-chunk-name.cjs");
|
|
4
4
|
//#region src/create-vocab-chunks.ts
|
|
5
5
|
const trace = require_logger.trace.extend("create-vocab-chunks");
|
|
6
6
|
/**
|
|
7
7
|
* Gets vocab virtual module details and creates chunks for each language
|
|
8
8
|
*/
|
|
9
|
-
const createVocabChunks = (id,
|
|
9
|
+
const createVocabChunks = (id, ctx) => {
|
|
10
10
|
const match = /virtual:vocab-(\w+)/.exec(id);
|
|
11
11
|
if (!match) return;
|
|
12
12
|
const language = match[1];
|
|
13
13
|
const dependentEntryPoints = [];
|
|
14
|
-
const rootModuleInfo = getModuleInfo(id);
|
|
14
|
+
const rootModuleInfo = ctx.getModuleInfo(id);
|
|
15
15
|
if (!rootModuleInfo) {
|
|
16
16
|
trace(`No module info found for ${id}`);
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
const idsToHandle = new Set(rootModuleInfo.dynamicImporters);
|
|
20
20
|
for (const moduleId of idsToHandle) {
|
|
21
|
-
const moduleInfo = getModuleInfo(moduleId);
|
|
21
|
+
const moduleInfo = ctx.getModuleInfo(moduleId);
|
|
22
22
|
if (!moduleInfo) {
|
|
23
23
|
trace(`No module info found for ${moduleId}`);
|
|
24
24
|
continue;
|
|
@@ -29,8 +29,8 @@ const createVocabChunks = (id, { getModuleInfo }) => {
|
|
|
29
29
|
}
|
|
30
30
|
if (dependentEntryPoints.length > 0) return require_get_chunk_name.getChunkName(language);
|
|
31
31
|
};
|
|
32
|
-
|
|
33
32
|
//#endregion
|
|
34
33
|
exports.createVocabChunks = createVocabChunks;
|
|
35
34
|
exports.getChunkName = require_get_chunk_name.getChunkName;
|
|
35
|
+
|
|
36
36
|
//# sourceMappingURL=chunks.cjs.map
|
package/dist/chunks.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunks.cjs","names":["_trace","
|
|
1
|
+
{"version":3,"file":"chunks.cjs","names":["_trace","getChunkName"],"sources":["../src/create-vocab-chunks.ts"],"sourcesContent":["import type { ChunkingContext } from 'rolldown';\nimport { trace as _trace } from './logger';\nimport { getChunkName } from './get-chunk-name';\n\nconst trace = _trace.extend('create-vocab-chunks');\n\n/**\n * Gets vocab virtual module details and creates chunks for each language\n */\nexport const createVocabChunks = (id: string, ctx: ChunkingContext) => {\n const match = /virtual:vocab-(\\w+)/.exec(id);\n if (!match) {\n return;\n }\n\n const language = match[1];\n const dependentEntryPoints: string[] = [];\n\n const rootModuleInfo = ctx.getModuleInfo(id);\n\n if (!rootModuleInfo) {\n trace(`No module info found for ${id}`);\n return;\n }\n\n const idsToHandle = new Set<string>(rootModuleInfo.dynamicImporters);\n\n for (const moduleId of idsToHandle) {\n const moduleInfo = ctx.getModuleInfo(moduleId);\n if (!moduleInfo) {\n trace(`No module info found for ${moduleId}`);\n continue;\n }\n\n const { isEntry, dynamicImporters, importers } = moduleInfo;\n\n if (isEntry || dynamicImporters.length > 0) {\n dependentEntryPoints.push(moduleId);\n }\n\n for (const importerId of importers) {\n idsToHandle.add(importerId);\n }\n }\n\n if (dependentEntryPoints.length > 0) {\n return getChunkName(language);\n }\n};\n"],"mappings":";;;;AAIA,MAAM,QAAQA,eAAAA,MAAO,OAAO,sBAAsB;;;;AAKlD,MAAa,qBAAqB,IAAY,QAAyB;CACrE,MAAM,QAAQ,sBAAsB,KAAK,GAAG;AAC5C,KAAI,CAAC,MACH;CAGF,MAAM,WAAW,MAAM;CACvB,MAAM,uBAAiC,EAAE;CAEzC,MAAM,iBAAiB,IAAI,cAAc,GAAG;AAE5C,KAAI,CAAC,gBAAgB;AACnB,QAAM,4BAA4B,KAAK;AACvC;;CAGF,MAAM,cAAc,IAAI,IAAY,eAAe,iBAAiB;AAEpE,MAAK,MAAM,YAAY,aAAa;EAClC,MAAM,aAAa,IAAI,cAAc,SAAS;AAC9C,MAAI,CAAC,YAAY;AACf,SAAM,4BAA4B,WAAW;AAC7C;;EAGF,MAAM,EAAE,SAAS,kBAAkB,cAAc;AAEjD,MAAI,WAAW,iBAAiB,SAAS,EACvC,sBAAqB,KAAK,SAAS;AAGrC,OAAK,MAAM,cAAc,UACvB,aAAY,IAAI,WAAW;;AAI/B,KAAI,qBAAqB,SAAS,EAChC,QAAOC,uBAAAA,aAAa,SAAS"}
|
package/dist/chunks.d.cts
CHANGED
|
@@ -1,13 +1,88 @@
|
|
|
1
1
|
import { getChunkName } from "./get-chunk-name.cjs";
|
|
2
|
-
import { Rollup } from "vite";
|
|
3
2
|
|
|
3
|
+
//#region ../../node_modules/.pnpm/rolldown@1.0.0-rc.9/node_modules/rolldown/dist/shared/define-config-cG45vHwf.d.mts
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/types/module-info.d.ts
|
|
6
|
+
/** @category Plugin APIs */
|
|
7
|
+
interface ModuleInfo extends ModuleOptions {
|
|
8
|
+
/**
|
|
9
|
+
* @hidden Not supported by Rolldown
|
|
10
|
+
*/
|
|
11
|
+
ast: any;
|
|
12
|
+
/**
|
|
13
|
+
* The source code of the module.
|
|
14
|
+
*
|
|
15
|
+
* `null` if external or not yet available.
|
|
16
|
+
*/
|
|
17
|
+
code: string | null;
|
|
18
|
+
/**
|
|
19
|
+
* The id of the module for convenience
|
|
20
|
+
*/
|
|
21
|
+
id: string;
|
|
22
|
+
/**
|
|
23
|
+
* The ids of all modules that statically import this module.
|
|
24
|
+
*/
|
|
25
|
+
importers: string[];
|
|
26
|
+
/**
|
|
27
|
+
* The ids of all modules that dynamically import this module.
|
|
28
|
+
*/
|
|
29
|
+
dynamicImporters: string[];
|
|
30
|
+
/**
|
|
31
|
+
* The module ids statically imported by this module.
|
|
32
|
+
*/
|
|
33
|
+
importedIds: string[];
|
|
34
|
+
/**
|
|
35
|
+
* The module ids dynamically imported by this module.
|
|
36
|
+
*/
|
|
37
|
+
dynamicallyImportedIds: string[];
|
|
38
|
+
/**
|
|
39
|
+
* All exported variables
|
|
40
|
+
*/
|
|
41
|
+
exports: string[];
|
|
42
|
+
/**
|
|
43
|
+
* Whether this module is a user- or plugin-defined entry point.
|
|
44
|
+
*/
|
|
45
|
+
isEntry: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* The detected format of the module, based on both its syntax and module definition
|
|
48
|
+
* metadata (such as `package.json` `type` and file extensions like `.mjs`/`.cjs`/`.mts`/`.cts`).
|
|
49
|
+
* - "esm" for ES modules (has `import`/`export` statements or is defined as ESM by module metadata)
|
|
50
|
+
* - "cjs" for CommonJS modules (uses `module.exports`, `exports`, top-level `return`, or is defined as CommonJS by module metadata)
|
|
51
|
+
* - "unknown" when the format could not be determined from either syntax or module definition metadata
|
|
52
|
+
*
|
|
53
|
+
* @experimental
|
|
54
|
+
*/
|
|
55
|
+
inputFormat: "es" | "cjs" | "unknown";
|
|
56
|
+
} //#endregion
|
|
57
|
+
//#region src/utils/asset-source.d.ts
|
|
58
|
+
/** @inline */
|
|
59
|
+
/** @inline */
|
|
60
|
+
interface ChunkingContext {
|
|
61
|
+
getModuleInfo(moduleId: string): ModuleInfo | null;
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/plugin/index.d.ts
|
|
65
|
+
type ModuleSideEffects = boolean | "no-treeshake" | null;
|
|
66
|
+
/** @category Plugin APIs */
|
|
67
|
+
/** @category Plugin APIs */
|
|
68
|
+
interface CustomPluginOptions {
|
|
69
|
+
[plugin: string]: any;
|
|
70
|
+
}
|
|
71
|
+
/** @category Plugin APIs */
|
|
72
|
+
interface ModuleOptions {
|
|
73
|
+
moduleSideEffects: ModuleSideEffects;
|
|
74
|
+
/** See [Custom module meta-data section](https://rolldown.rs/apis/plugin-api/inter-plugin-communication#custom-module-meta-data) for more details. */
|
|
75
|
+
meta: CustomPluginOptions;
|
|
76
|
+
invalidate?: boolean;
|
|
77
|
+
packageJsonPath?: string;
|
|
78
|
+
}
|
|
79
|
+
/** @category Plugin APIs */
|
|
80
|
+
//#endregion
|
|
4
81
|
//#region src/create-vocab-chunks.d.ts
|
|
5
82
|
/**
|
|
6
83
|
* Gets vocab virtual module details and creates chunks for each language
|
|
7
84
|
*/
|
|
8
|
-
declare const createVocabChunks: (id: string,
|
|
9
|
-
getModuleInfo
|
|
10
|
-
}: Rollup.ManualChunkMeta) => string | undefined;
|
|
85
|
+
declare const createVocabChunks: (id: string, ctx: ChunkingContext) => string | undefined;
|
|
11
86
|
//#endregion
|
|
12
87
|
export { createVocabChunks, getChunkName };
|
|
13
88
|
//# sourceMappingURL=chunks.d.cts.map
|
package/dist/chunks.d.mts
CHANGED
|
@@ -1,13 +1,88 @@
|
|
|
1
1
|
import { getChunkName } from "./get-chunk-name.mjs";
|
|
2
|
-
import { Rollup } from "vite";
|
|
3
2
|
|
|
3
|
+
//#region ../../node_modules/.pnpm/rolldown@1.0.0-rc.9/node_modules/rolldown/dist/shared/define-config-cG45vHwf.d.mts
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/types/module-info.d.ts
|
|
6
|
+
/** @category Plugin APIs */
|
|
7
|
+
interface ModuleInfo extends ModuleOptions {
|
|
8
|
+
/**
|
|
9
|
+
* @hidden Not supported by Rolldown
|
|
10
|
+
*/
|
|
11
|
+
ast: any;
|
|
12
|
+
/**
|
|
13
|
+
* The source code of the module.
|
|
14
|
+
*
|
|
15
|
+
* `null` if external or not yet available.
|
|
16
|
+
*/
|
|
17
|
+
code: string | null;
|
|
18
|
+
/**
|
|
19
|
+
* The id of the module for convenience
|
|
20
|
+
*/
|
|
21
|
+
id: string;
|
|
22
|
+
/**
|
|
23
|
+
* The ids of all modules that statically import this module.
|
|
24
|
+
*/
|
|
25
|
+
importers: string[];
|
|
26
|
+
/**
|
|
27
|
+
* The ids of all modules that dynamically import this module.
|
|
28
|
+
*/
|
|
29
|
+
dynamicImporters: string[];
|
|
30
|
+
/**
|
|
31
|
+
* The module ids statically imported by this module.
|
|
32
|
+
*/
|
|
33
|
+
importedIds: string[];
|
|
34
|
+
/**
|
|
35
|
+
* The module ids dynamically imported by this module.
|
|
36
|
+
*/
|
|
37
|
+
dynamicallyImportedIds: string[];
|
|
38
|
+
/**
|
|
39
|
+
* All exported variables
|
|
40
|
+
*/
|
|
41
|
+
exports: string[];
|
|
42
|
+
/**
|
|
43
|
+
* Whether this module is a user- or plugin-defined entry point.
|
|
44
|
+
*/
|
|
45
|
+
isEntry: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* The detected format of the module, based on both its syntax and module definition
|
|
48
|
+
* metadata (such as `package.json` `type` and file extensions like `.mjs`/`.cjs`/`.mts`/`.cts`).
|
|
49
|
+
* - "esm" for ES modules (has `import`/`export` statements or is defined as ESM by module metadata)
|
|
50
|
+
* - "cjs" for CommonJS modules (uses `module.exports`, `exports`, top-level `return`, or is defined as CommonJS by module metadata)
|
|
51
|
+
* - "unknown" when the format could not be determined from either syntax or module definition metadata
|
|
52
|
+
*
|
|
53
|
+
* @experimental
|
|
54
|
+
*/
|
|
55
|
+
inputFormat: "es" | "cjs" | "unknown";
|
|
56
|
+
} //#endregion
|
|
57
|
+
//#region src/utils/asset-source.d.ts
|
|
58
|
+
/** @inline */
|
|
59
|
+
/** @inline */
|
|
60
|
+
interface ChunkingContext {
|
|
61
|
+
getModuleInfo(moduleId: string): ModuleInfo | null;
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/plugin/index.d.ts
|
|
65
|
+
type ModuleSideEffects = boolean | "no-treeshake" | null;
|
|
66
|
+
/** @category Plugin APIs */
|
|
67
|
+
/** @category Plugin APIs */
|
|
68
|
+
interface CustomPluginOptions {
|
|
69
|
+
[plugin: string]: any;
|
|
70
|
+
}
|
|
71
|
+
/** @category Plugin APIs */
|
|
72
|
+
interface ModuleOptions {
|
|
73
|
+
moduleSideEffects: ModuleSideEffects;
|
|
74
|
+
/** See [Custom module meta-data section](https://rolldown.rs/apis/plugin-api/inter-plugin-communication#custom-module-meta-data) for more details. */
|
|
75
|
+
meta: CustomPluginOptions;
|
|
76
|
+
invalidate?: boolean;
|
|
77
|
+
packageJsonPath?: string;
|
|
78
|
+
}
|
|
79
|
+
/** @category Plugin APIs */
|
|
80
|
+
//#endregion
|
|
4
81
|
//#region src/create-vocab-chunks.d.ts
|
|
5
82
|
/**
|
|
6
83
|
* Gets vocab virtual module details and creates chunks for each language
|
|
7
84
|
*/
|
|
8
|
-
declare const createVocabChunks: (id: string,
|
|
9
|
-
getModuleInfo
|
|
10
|
-
}: Rollup.ManualChunkMeta) => string | undefined;
|
|
85
|
+
declare const createVocabChunks: (id: string, ctx: ChunkingContext) => string | undefined;
|
|
11
86
|
//#endregion
|
|
12
87
|
export { createVocabChunks, getChunkName };
|
|
13
88
|
//# sourceMappingURL=chunks.d.mts.map
|
package/dist/chunks.mjs
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import { t as trace$1 } from "./logger-
|
|
1
|
+
import { t as trace$1 } from "./logger-DOiEeSfu.mjs";
|
|
2
2
|
import { getChunkName } from "./get-chunk-name.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/create-vocab-chunks.ts
|
|
5
4
|
const trace = trace$1.extend("create-vocab-chunks");
|
|
6
5
|
/**
|
|
7
6
|
* Gets vocab virtual module details and creates chunks for each language
|
|
8
7
|
*/
|
|
9
|
-
const createVocabChunks = (id,
|
|
8
|
+
const createVocabChunks = (id, ctx) => {
|
|
10
9
|
const match = /virtual:vocab-(\w+)/.exec(id);
|
|
11
10
|
if (!match) return;
|
|
12
11
|
const language = match[1];
|
|
13
12
|
const dependentEntryPoints = [];
|
|
14
|
-
const rootModuleInfo = getModuleInfo(id);
|
|
13
|
+
const rootModuleInfo = ctx.getModuleInfo(id);
|
|
15
14
|
if (!rootModuleInfo) {
|
|
16
15
|
trace(`No module info found for ${id}`);
|
|
17
16
|
return;
|
|
18
17
|
}
|
|
19
18
|
const idsToHandle = new Set(rootModuleInfo.dynamicImporters);
|
|
20
19
|
for (const moduleId of idsToHandle) {
|
|
21
|
-
const moduleInfo = getModuleInfo(moduleId);
|
|
20
|
+
const moduleInfo = ctx.getModuleInfo(moduleId);
|
|
22
21
|
if (!moduleInfo) {
|
|
23
22
|
trace(`No module info found for ${moduleId}`);
|
|
24
23
|
continue;
|
|
@@ -29,7 +28,7 @@ const createVocabChunks = (id, { getModuleInfo }) => {
|
|
|
29
28
|
}
|
|
30
29
|
if (dependentEntryPoints.length > 0) return getChunkName(language);
|
|
31
30
|
};
|
|
32
|
-
|
|
33
31
|
//#endregion
|
|
34
32
|
export { createVocabChunks, getChunkName };
|
|
33
|
+
|
|
35
34
|
//# sourceMappingURL=chunks.mjs.map
|
package/dist/chunks.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunks.mjs","names":["_trace"
|
|
1
|
+
{"version":3,"file":"chunks.mjs","names":["_trace"],"sources":["../src/create-vocab-chunks.ts"],"sourcesContent":["import type { ChunkingContext } from 'rolldown';\nimport { trace as _trace } from './logger';\nimport { getChunkName } from './get-chunk-name';\n\nconst trace = _trace.extend('create-vocab-chunks');\n\n/**\n * Gets vocab virtual module details and creates chunks for each language\n */\nexport const createVocabChunks = (id: string, ctx: ChunkingContext) => {\n const match = /virtual:vocab-(\\w+)/.exec(id);\n if (!match) {\n return;\n }\n\n const language = match[1];\n const dependentEntryPoints: string[] = [];\n\n const rootModuleInfo = ctx.getModuleInfo(id);\n\n if (!rootModuleInfo) {\n trace(`No module info found for ${id}`);\n return;\n }\n\n const idsToHandle = new Set<string>(rootModuleInfo.dynamicImporters);\n\n for (const moduleId of idsToHandle) {\n const moduleInfo = ctx.getModuleInfo(moduleId);\n if (!moduleInfo) {\n trace(`No module info found for ${moduleId}`);\n continue;\n }\n\n const { isEntry, dynamicImporters, importers } = moduleInfo;\n\n if (isEntry || dynamicImporters.length > 0) {\n dependentEntryPoints.push(moduleId);\n }\n\n for (const importerId of importers) {\n idsToHandle.add(importerId);\n }\n }\n\n if (dependentEntryPoints.length > 0) {\n return getChunkName(language);\n }\n};\n"],"mappings":";;;AAIA,MAAM,QAAQA,QAAO,OAAO,sBAAsB;;;;AAKlD,MAAa,qBAAqB,IAAY,QAAyB;CACrE,MAAM,QAAQ,sBAAsB,KAAK,GAAG;AAC5C,KAAI,CAAC,MACH;CAGF,MAAM,WAAW,MAAM;CACvB,MAAM,uBAAiC,EAAE;CAEzC,MAAM,iBAAiB,IAAI,cAAc,GAAG;AAE5C,KAAI,CAAC,gBAAgB;AACnB,QAAM,4BAA4B,KAAK;AACvC;;CAGF,MAAM,cAAc,IAAI,IAAY,eAAe,iBAAiB;AAEpE,MAAK,MAAM,YAAY,aAAa;EAClC,MAAM,aAAa,IAAI,cAAc,SAAS;AAC9C,MAAI,CAAC,YAAY;AACf,SAAM,4BAA4B,WAAW;AAC7C;;EAGF,MAAM,EAAE,SAAS,kBAAkB,cAAc;AAEjD,MAAI,WAAW,iBAAiB,SAAS,EACvC,sBAAqB,KAAK,SAAS;AAGrC,OAAK,MAAM,cAAc,UACvB,aAAY,IAAI,WAAW;;AAI/B,KAAI,qBAAqB,SAAS,EAChC,QAAO,aAAa,SAAS"}
|
package/dist/get-chunk-name.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/get-chunk-name.ts
|
|
3
3
|
function getChunkName(lang) {
|
|
4
4
|
return `${lang}-translations`;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
6
|
//#endregion
|
|
8
7
|
exports.getChunkName = getChunkName;
|
|
8
|
+
|
|
9
9
|
//# sourceMappingURL=get-chunk-name.cjs.map
|
package/dist/get-chunk-name.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_logger = require("./logger-BusUtQic.cjs");
|
|
2
3
|
let _vocab_core = require("@vocab/core");
|
|
3
4
|
let es_module_lexer = require("es-module-lexer");
|
|
4
5
|
es_module_lexer = require_logger.__toESM(es_module_lexer);
|
|
5
6
|
let cjs_module_lexer = require("cjs-module-lexer");
|
|
6
7
|
cjs_module_lexer = require_logger.__toESM(cjs_module_lexer);
|
|
7
|
-
|
|
8
8
|
//#region src/consts.ts
|
|
9
9
|
/**
|
|
10
10
|
* @deprecated Import from `@vocab/core` instead
|
|
@@ -12,17 +12,16 @@ cjs_module_lexer = require_logger.__toESM(cjs_module_lexer);
|
|
|
12
12
|
const compiledVocabFileFilter = _vocab_core.compiledVocabFileFilter;
|
|
13
13
|
const virtualModuleId = "virtual:vocab";
|
|
14
14
|
const sourceQueryKey = "?source=";
|
|
15
|
-
|
|
16
15
|
//#endregion
|
|
17
16
|
//#region src/transform-vocab-file.ts
|
|
18
17
|
const trace = require_logger.trace.extend("transform");
|
|
19
18
|
function findExportNames(source, mode) {
|
|
20
19
|
if (mode === "esm") {
|
|
21
|
-
const [, exports
|
|
22
|
-
return exports
|
|
20
|
+
const [, exports] = es_module_lexer.parse(source);
|
|
21
|
+
return exports;
|
|
23
22
|
}
|
|
24
|
-
const { exports
|
|
25
|
-
return exports
|
|
23
|
+
const { exports } = cjs_module_lexer.parse(source);
|
|
24
|
+
return exports;
|
|
26
25
|
}
|
|
27
26
|
const transformVocabFile = async (code, id, config) => {
|
|
28
27
|
trace("Transforming vocab file", id);
|
|
@@ -69,11 +68,9 @@ const createIdentifier = (lang, loadedTranslation) => {
|
|
|
69
68
|
for (const key of loadedTranslation.keys) langJson[key] = languageTranslations[key].message;
|
|
70
69
|
return `${virtualModuleId}-${lang}.json${`${sourceQueryKey}${Buffer.from(JSON.stringify(langJson), "utf-8").toString("base64")}`}`;
|
|
71
70
|
};
|
|
72
|
-
|
|
73
71
|
//#endregion
|
|
74
72
|
//#region src/virtual-resource-loader.ts
|
|
75
73
|
const virtualResourceLoader = (path) => Buffer.from(path.split(sourceQueryKey)[1], "base64").toString("utf-8");
|
|
76
|
-
|
|
77
74
|
//#endregion
|
|
78
75
|
//#region src/index.ts
|
|
79
76
|
const vitePluginVocab = ({ vocabConfig }) => {
|
|
@@ -86,10 +83,13 @@ const vitePluginVocab = ({ vocabConfig }) => {
|
|
|
86
83
|
return env.name === "client";
|
|
87
84
|
},
|
|
88
85
|
resolveId(id) {
|
|
89
|
-
if (id.includes(
|
|
86
|
+
if (id.includes("virtual:vocab")) return `\0${id}`;
|
|
90
87
|
},
|
|
91
88
|
load(id) {
|
|
92
|
-
if (id.includes(`\
|
|
89
|
+
if (id.includes(`\0virtual:vocab`)) return {
|
|
90
|
+
code: virtualResourceLoader(id),
|
|
91
|
+
moduleType: "json"
|
|
92
|
+
};
|
|
93
93
|
},
|
|
94
94
|
async transform(code, id) {
|
|
95
95
|
if (compiledVocabFileFilter.test(id)) return {
|
|
@@ -99,7 +99,7 @@ const vitePluginVocab = ({ vocabConfig }) => {
|
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
|
-
|
|
103
102
|
//#endregion
|
|
104
103
|
exports.vitePluginVocab = vitePluginVocab;
|
|
104
|
+
|
|
105
105
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["_compiledVocabFileFilter","_trace","
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["_compiledVocabFileFilter","_trace","esModuleLexer","cjsModuleLexer"],"sources":["../src/consts.ts","../src/transform-vocab-file.ts","../src/virtual-resource-loader.ts","../src/index.ts"],"sourcesContent":["import { compiledVocabFileFilter as _compiledVocabFileFilter } from '@vocab/core';\n\n/**\n * @deprecated Import from `@vocab/core` instead\n */\nexport const compiledVocabFileFilter = _compiledVocabFileFilter;\nexport const virtualModuleId = 'virtual:vocab';\nexport const sourceQueryKey = '?source=';\n","import {\n getDevLanguageFileFromTsFile,\n type LoadedTranslation,\n loadTranslation,\n type TranslationMessagesByKey,\n type UserConfig,\n} from '@vocab/core';\n\nimport * as esModuleLexer from 'es-module-lexer';\nimport * as cjsModuleLexer from 'cjs-module-lexer';\n\nimport { sourceQueryKey, virtualModuleId } from './consts';\n\nimport { trace as _trace } from './logger';\n\nconst trace = _trace.extend('transform');\n\nfunction findExportNames(source: string, mode: 'cjs'): string[];\nfunction findExportNames(\n source: string,\n mode: 'esm',\n): esModuleLexer.ExportSpecifier[];\nfunction findExportNames(source: string, mode: 'cjs' | 'esm') {\n if (mode === 'esm') {\n const [, exports] = esModuleLexer.parse(source);\n return exports;\n }\n const { exports } = cjsModuleLexer.parse(source);\n return exports;\n}\n\nexport const transformVocabFile = async (\n code: string,\n id: string,\n config: UserConfig,\n) => {\n trace('Transforming vocab file', id);\n\n let result = code;\n\n const devJsonFilePath = getDevLanguageFileFromTsFile(id);\n\n const loadedTranslation = loadTranslation(\n { filePath: devJsonFilePath, fallbacks: 'all' },\n config,\n );\n\n const renderLanguageLoader = renderLanguageLoaderAsync(loadedTranslation);\n\n const translations = /* ts */ `\n const translations = createTranslationFile({\n ${Object.keys(loadedTranslation.languages)\n .map((lang) => `${JSON.stringify(lang)}: ${renderLanguageLoader(lang)}`)\n .join(',\\n')}\n });\n `;\n\n await esModuleLexer.init;\n const esmExports = findExportNames(code, 'esm');\n if (esmExports.length > 0) {\n const exportName = esmExports[0];\n trace(`Found ESM export '${exportName.n}' in ${id}`);\n\n result = /* ts */ `\n import { createLanguage, createTranslationFile } from '@vocab/vite/runtime';\n ${translations}\n export { translations as ${exportName.n} };\n `;\n } else {\n // init needs to be called and waited upon\n await cjsModuleLexer.init();\n\n const exportName = findExportNames(code, 'cjs')[0];\n trace(`Found CJS export '${exportName}' in ${id}`);\n\n result = /* ts */ `\n import { createLanguage, createTranslationFile } from '@vocab/vite/runtime';\n ${translations}\n exports.${exportName} = translations;\n `;\n }\n trace('Created translation file', result);\n\n return result;\n};\n\nconst renderLanguageLoaderAsync =\n (loadedTranslation: LoadedTranslation) => (lang: string) => {\n const identifier = JSON.stringify(\n createIdentifier(lang, loadedTranslation),\n );\n\n return /* ts */ `createLanguage(() => import(${identifier}))`.trim();\n };\n\nconst createIdentifier = (\n lang: string,\n loadedTranslation: LoadedTranslation,\n) => {\n const languageTranslations = loadedTranslation.languages[lang] ?? {};\n\n const langJson: TranslationMessagesByKey = {};\n\n for (const key of loadedTranslation.keys) {\n langJson[key] = languageTranslations[key].message;\n }\n\n const base64 = Buffer.from(JSON.stringify(langJson), 'utf-8').toString(\n 'base64',\n );\n\n const encodedResource = `${sourceQueryKey}${base64}`;\n\n return `${virtualModuleId}-${lang}.json${encodedResource}`;\n};\n","import { sourceQueryKey } from './consts';\n\nexport const virtualResourceLoader = (path: string) =>\n Buffer.from(path.split(sourceQueryKey)[1] as string, 'base64').toString(\n 'utf-8',\n );\n","import type { Plugin as VitePlugin } from 'vite';\nimport type { UserConfig } from '@vocab/core';\n\nimport { transformVocabFile } from './transform-vocab-file';\nimport { virtualResourceLoader } from './virtual-resource-loader';\n\nimport { trace } from './logger';\n\nimport { compiledVocabFileFilter, virtualModuleId } from './consts';\n\nexport type VocabPluginOptions = {\n vocabConfig: UserConfig;\n};\n\nexport const vitePluginVocab = ({\n vocabConfig,\n}: VocabPluginOptions): VitePlugin => {\n trace(\n `Creating Vocab plugin${\n vocabConfig ? ` with config file ${vocabConfig}` : ''\n }`,\n );\n\n return {\n name: 'vite-plugin-vocab',\n apply: 'build',\n enforce: 'pre',\n applyToEnvironment(env) {\n return env.name === 'client';\n },\n resolveId(id) {\n if (id.includes(virtualModuleId)) {\n return `\\0${id}`;\n }\n },\n load(id) {\n if (id.includes(`\\0${virtualModuleId}`)) {\n return {\n code: virtualResourceLoader(id),\n moduleType: 'json',\n };\n }\n },\n async transform(code, id) {\n if (compiledVocabFileFilter.test(id)) {\n const transformedCode = await transformVocabFile(code, id, vocabConfig);\n\n return {\n code: transformedCode,\n map: null, // provide source map if available\n };\n }\n },\n };\n};\n"],"mappings":";;;;;;;;;;;AAKA,MAAa,0BAA0BA,YAAAA;AACvC,MAAa,kBAAkB;AAC/B,MAAa,iBAAiB;;;ACQ9B,MAAM,QAAQC,eAAAA,MAAO,OAAO,YAAY;AAOxC,SAAS,gBAAgB,QAAgB,MAAqB;AAC5D,KAAI,SAAS,OAAO;EAClB,MAAM,GAAG,WAAWC,gBAAc,MAAM,OAAO;AAC/C,SAAO;;CAET,MAAM,EAAE,YAAYC,iBAAe,MAAM,OAAO;AAChD,QAAO;;AAGT,MAAa,qBAAqB,OAChC,MACA,IACA,WACG;AACH,OAAM,2BAA2B,GAAG;CAEpC,IAAI,SAAS;CAIb,MAAM,qBAAA,GAAA,YAAA,iBACJ;EAAE,WAAA,GAAA,YAAA,8BAHiD,GAAG;EAGzB,WAAW;EAAO,EAC/C,OACD;CAED,MAAM,uBAAuB,0BAA0B,kBAAkB;CAEzE,MAAM,eAAwB;;QAExB,OAAO,KAAK,kBAAkB,UAAU,CACvC,KAAK,SAAS,GAAG,KAAK,UAAU,KAAK,CAAC,IAAI,qBAAqB,KAAK,GAAG,CACvE,KAAK,MAAM,CAAC;;;AAInB,OAAMD,gBAAc;CACpB,MAAM,aAAa,gBAAgB,MAAM,MAAM;AAC/C,KAAI,WAAW,SAAS,GAAG;EACzB,MAAM,aAAa,WAAW;AAC9B,QAAM,qBAAqB,WAAW,EAAE,OAAO,KAAK;AAEpD,WAAkB;;QAEd,aAAa;iCACY,WAAW,EAAE;;QAErC;AAEL,QAAMC,iBAAe,MAAM;EAE3B,MAAM,aAAa,gBAAgB,MAAM,MAAM,CAAC;AAChD,QAAM,qBAAqB,WAAW,OAAO,KAAK;AAElD,WAAkB;;QAEd,aAAa;gBACL,WAAW;;;AAGzB,OAAM,4BAA4B,OAAO;AAEzC,QAAO;;AAGT,MAAM,6BACH,uBAA0C,SAAiB;AAK1D,QAAgB,+BAJG,KAAK,UACtB,iBAAiB,MAAM,kBAAkB,CAC1C,CAEyD,IAAI,MAAM;;AAGxE,MAAM,oBACJ,MACA,sBACG;CACH,MAAM,uBAAuB,kBAAkB,UAAU,SAAS,EAAE;CAEpE,MAAM,WAAqC,EAAE;AAE7C,MAAK,MAAM,OAAO,kBAAkB,KAClC,UAAS,OAAO,qBAAqB,KAAK;AAS5C,QAAO,GAAG,gBAAgB,GAAG,KAAK,OAFV,GAAG,iBAJZ,OAAO,KAAK,KAAK,UAAU,SAAS,EAAE,QAAQ,CAAC,SAC5D,SACD;;;;AC3GH,MAAa,yBAAyB,SACpC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC,IAAc,SAAS,CAAC,SAC7D,QACD;;;ACSH,MAAa,mBAAmB,EAC9B,kBACoC;AACpC,gBAAA,MACE,wBACE,cAAc,qBAAqB,gBAAgB,KAEtD;AAED,QAAO;EACL,MAAM;EACN,OAAO;EACP,SAAS;EACT,mBAAmB,KAAK;AACtB,UAAO,IAAI,SAAS;;EAEtB,UAAU,IAAI;AACZ,OAAI,GAAG,SAAA,gBAAyB,CAC9B,QAAO,KAAK;;EAGhB,KAAK,IAAI;AACP,OAAI,GAAG,SAAS,kBAAuB,CACrC,QAAO;IACL,MAAM,sBAAsB,GAAG;IAC/B,YAAY;IACb;;EAGL,MAAM,UAAU,MAAM,IAAI;AACxB,OAAI,wBAAwB,KAAK,GAAG,CAGlC,QAAO;IACL,MAHsB,MAAM,mBAAmB,MAAM,IAAI,YAAY;IAIrE,KAAK;IACN;;EAGN"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { t as trace$1 } from "./logger-
|
|
1
|
+
import { t as trace$1 } from "./logger-DOiEeSfu.mjs";
|
|
2
2
|
import { compiledVocabFileFilter, getDevLanguageFileFromTsFile, loadTranslation } from "@vocab/core";
|
|
3
3
|
import * as esModuleLexer from "es-module-lexer";
|
|
4
4
|
import * as cjsModuleLexer from "cjs-module-lexer";
|
|
5
|
-
|
|
6
5
|
//#region src/consts.ts
|
|
7
6
|
/**
|
|
8
7
|
* @deprecated Import from `@vocab/core` instead
|
|
@@ -10,14 +9,13 @@ import * as cjsModuleLexer from "cjs-module-lexer";
|
|
|
10
9
|
const compiledVocabFileFilter$1 = compiledVocabFileFilter;
|
|
11
10
|
const virtualModuleId = "virtual:vocab";
|
|
12
11
|
const sourceQueryKey = "?source=";
|
|
13
|
-
|
|
14
12
|
//#endregion
|
|
15
13
|
//#region src/transform-vocab-file.ts
|
|
16
14
|
const trace = trace$1.extend("transform");
|
|
17
15
|
function findExportNames(source, mode) {
|
|
18
16
|
if (mode === "esm") {
|
|
19
|
-
const [, exports
|
|
20
|
-
return exports
|
|
17
|
+
const [, exports] = esModuleLexer.parse(source);
|
|
18
|
+
return exports;
|
|
21
19
|
}
|
|
22
20
|
const { exports } = cjsModuleLexer.parse(source);
|
|
23
21
|
return exports;
|
|
@@ -67,11 +65,9 @@ const createIdentifier = (lang, loadedTranslation) => {
|
|
|
67
65
|
for (const key of loadedTranslation.keys) langJson[key] = languageTranslations[key].message;
|
|
68
66
|
return `${virtualModuleId}-${lang}.json${`${sourceQueryKey}${Buffer.from(JSON.stringify(langJson), "utf-8").toString("base64")}`}`;
|
|
69
67
|
};
|
|
70
|
-
|
|
71
68
|
//#endregion
|
|
72
69
|
//#region src/virtual-resource-loader.ts
|
|
73
70
|
const virtualResourceLoader = (path) => Buffer.from(path.split(sourceQueryKey)[1], "base64").toString("utf-8");
|
|
74
|
-
|
|
75
71
|
//#endregion
|
|
76
72
|
//#region src/index.ts
|
|
77
73
|
const vitePluginVocab = ({ vocabConfig }) => {
|
|
@@ -84,10 +80,13 @@ const vitePluginVocab = ({ vocabConfig }) => {
|
|
|
84
80
|
return env.name === "client";
|
|
85
81
|
},
|
|
86
82
|
resolveId(id) {
|
|
87
|
-
if (id.includes(
|
|
83
|
+
if (id.includes("virtual:vocab")) return `\0${id}`;
|
|
88
84
|
},
|
|
89
85
|
load(id) {
|
|
90
|
-
if (id.includes(`\
|
|
86
|
+
if (id.includes(`\0virtual:vocab`)) return {
|
|
87
|
+
code: virtualResourceLoader(id),
|
|
88
|
+
moduleType: "json"
|
|
89
|
+
};
|
|
91
90
|
},
|
|
92
91
|
async transform(code, id) {
|
|
93
92
|
if (compiledVocabFileFilter$1.test(id)) return {
|
|
@@ -97,7 +96,7 @@ const vitePluginVocab = ({ vocabConfig }) => {
|
|
|
97
96
|
}
|
|
98
97
|
};
|
|
99
98
|
};
|
|
100
|
-
|
|
101
99
|
//#endregion
|
|
102
100
|
export { vitePluginVocab };
|
|
101
|
+
|
|
103
102
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["compiledVocabFileFilter","_compiledVocabFileFilter","_trace","
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["compiledVocabFileFilter","_compiledVocabFileFilter","_trace","compiledVocabFileFilter"],"sources":["../src/consts.ts","../src/transform-vocab-file.ts","../src/virtual-resource-loader.ts","../src/index.ts"],"sourcesContent":["import { compiledVocabFileFilter as _compiledVocabFileFilter } from '@vocab/core';\n\n/**\n * @deprecated Import from `@vocab/core` instead\n */\nexport const compiledVocabFileFilter = _compiledVocabFileFilter;\nexport const virtualModuleId = 'virtual:vocab';\nexport const sourceQueryKey = '?source=';\n","import {\n getDevLanguageFileFromTsFile,\n type LoadedTranslation,\n loadTranslation,\n type TranslationMessagesByKey,\n type UserConfig,\n} from '@vocab/core';\n\nimport * as esModuleLexer from 'es-module-lexer';\nimport * as cjsModuleLexer from 'cjs-module-lexer';\n\nimport { sourceQueryKey, virtualModuleId } from './consts';\n\nimport { trace as _trace } from './logger';\n\nconst trace = _trace.extend('transform');\n\nfunction findExportNames(source: string, mode: 'cjs'): string[];\nfunction findExportNames(\n source: string,\n mode: 'esm',\n): esModuleLexer.ExportSpecifier[];\nfunction findExportNames(source: string, mode: 'cjs' | 'esm') {\n if (mode === 'esm') {\n const [, exports] = esModuleLexer.parse(source);\n return exports;\n }\n const { exports } = cjsModuleLexer.parse(source);\n return exports;\n}\n\nexport const transformVocabFile = async (\n code: string,\n id: string,\n config: UserConfig,\n) => {\n trace('Transforming vocab file', id);\n\n let result = code;\n\n const devJsonFilePath = getDevLanguageFileFromTsFile(id);\n\n const loadedTranslation = loadTranslation(\n { filePath: devJsonFilePath, fallbacks: 'all' },\n config,\n );\n\n const renderLanguageLoader = renderLanguageLoaderAsync(loadedTranslation);\n\n const translations = /* ts */ `\n const translations = createTranslationFile({\n ${Object.keys(loadedTranslation.languages)\n .map((lang) => `${JSON.stringify(lang)}: ${renderLanguageLoader(lang)}`)\n .join(',\\n')}\n });\n `;\n\n await esModuleLexer.init;\n const esmExports = findExportNames(code, 'esm');\n if (esmExports.length > 0) {\n const exportName = esmExports[0];\n trace(`Found ESM export '${exportName.n}' in ${id}`);\n\n result = /* ts */ `\n import { createLanguage, createTranslationFile } from '@vocab/vite/runtime';\n ${translations}\n export { translations as ${exportName.n} };\n `;\n } else {\n // init needs to be called and waited upon\n await cjsModuleLexer.init();\n\n const exportName = findExportNames(code, 'cjs')[0];\n trace(`Found CJS export '${exportName}' in ${id}`);\n\n result = /* ts */ `\n import { createLanguage, createTranslationFile } from '@vocab/vite/runtime';\n ${translations}\n exports.${exportName} = translations;\n `;\n }\n trace('Created translation file', result);\n\n return result;\n};\n\nconst renderLanguageLoaderAsync =\n (loadedTranslation: LoadedTranslation) => (lang: string) => {\n const identifier = JSON.stringify(\n createIdentifier(lang, loadedTranslation),\n );\n\n return /* ts */ `createLanguage(() => import(${identifier}))`.trim();\n };\n\nconst createIdentifier = (\n lang: string,\n loadedTranslation: LoadedTranslation,\n) => {\n const languageTranslations = loadedTranslation.languages[lang] ?? {};\n\n const langJson: TranslationMessagesByKey = {};\n\n for (const key of loadedTranslation.keys) {\n langJson[key] = languageTranslations[key].message;\n }\n\n const base64 = Buffer.from(JSON.stringify(langJson), 'utf-8').toString(\n 'base64',\n );\n\n const encodedResource = `${sourceQueryKey}${base64}`;\n\n return `${virtualModuleId}-${lang}.json${encodedResource}`;\n};\n","import { sourceQueryKey } from './consts';\n\nexport const virtualResourceLoader = (path: string) =>\n Buffer.from(path.split(sourceQueryKey)[1] as string, 'base64').toString(\n 'utf-8',\n );\n","import type { Plugin as VitePlugin } from 'vite';\nimport type { UserConfig } from '@vocab/core';\n\nimport { transformVocabFile } from './transform-vocab-file';\nimport { virtualResourceLoader } from './virtual-resource-loader';\n\nimport { trace } from './logger';\n\nimport { compiledVocabFileFilter, virtualModuleId } from './consts';\n\nexport type VocabPluginOptions = {\n vocabConfig: UserConfig;\n};\n\nexport const vitePluginVocab = ({\n vocabConfig,\n}: VocabPluginOptions): VitePlugin => {\n trace(\n `Creating Vocab plugin${\n vocabConfig ? ` with config file ${vocabConfig}` : ''\n }`,\n );\n\n return {\n name: 'vite-plugin-vocab',\n apply: 'build',\n enforce: 'pre',\n applyToEnvironment(env) {\n return env.name === 'client';\n },\n resolveId(id) {\n if (id.includes(virtualModuleId)) {\n return `\\0${id}`;\n }\n },\n load(id) {\n if (id.includes(`\\0${virtualModuleId}`)) {\n return {\n code: virtualResourceLoader(id),\n moduleType: 'json',\n };\n }\n },\n async transform(code, id) {\n if (compiledVocabFileFilter.test(id)) {\n const transformedCode = await transformVocabFile(code, id, vocabConfig);\n\n return {\n code: transformedCode,\n map: null, // provide source map if available\n };\n }\n },\n };\n};\n"],"mappings":";;;;;;;;AAKA,MAAaA,4BAA0BC;AACvC,MAAa,kBAAkB;AAC/B,MAAa,iBAAiB;;;ACQ9B,MAAM,QAAQC,QAAO,OAAO,YAAY;AAOxC,SAAS,gBAAgB,QAAgB,MAAqB;AAC5D,KAAI,SAAS,OAAO;EAClB,MAAM,GAAG,WAAW,cAAc,MAAM,OAAO;AAC/C,SAAO;;CAET,MAAM,EAAE,YAAY,eAAe,MAAM,OAAO;AAChD,QAAO;;AAGT,MAAa,qBAAqB,OAChC,MACA,IACA,WACG;AACH,OAAM,2BAA2B,GAAG;CAEpC,IAAI,SAAS;CAIb,MAAM,oBAAoB,gBACxB;EAAE,UAHoB,6BAA6B,GAAG;EAGzB,WAAW;EAAO,EAC/C,OACD;CAED,MAAM,uBAAuB,0BAA0B,kBAAkB;CAEzE,MAAM,eAAwB;;QAExB,OAAO,KAAK,kBAAkB,UAAU,CACvC,KAAK,SAAS,GAAG,KAAK,UAAU,KAAK,CAAC,IAAI,qBAAqB,KAAK,GAAG,CACvE,KAAK,MAAM,CAAC;;;AAInB,OAAM,cAAc;CACpB,MAAM,aAAa,gBAAgB,MAAM,MAAM;AAC/C,KAAI,WAAW,SAAS,GAAG;EACzB,MAAM,aAAa,WAAW;AAC9B,QAAM,qBAAqB,WAAW,EAAE,OAAO,KAAK;AAEpD,WAAkB;;QAEd,aAAa;iCACY,WAAW,EAAE;;QAErC;AAEL,QAAM,eAAe,MAAM;EAE3B,MAAM,aAAa,gBAAgB,MAAM,MAAM,CAAC;AAChD,QAAM,qBAAqB,WAAW,OAAO,KAAK;AAElD,WAAkB;;QAEd,aAAa;gBACL,WAAW;;;AAGzB,OAAM,4BAA4B,OAAO;AAEzC,QAAO;;AAGT,MAAM,6BACH,uBAA0C,SAAiB;AAK1D,QAAgB,+BAJG,KAAK,UACtB,iBAAiB,MAAM,kBAAkB,CAC1C,CAEyD,IAAI,MAAM;;AAGxE,MAAM,oBACJ,MACA,sBACG;CACH,MAAM,uBAAuB,kBAAkB,UAAU,SAAS,EAAE;CAEpE,MAAM,WAAqC,EAAE;AAE7C,MAAK,MAAM,OAAO,kBAAkB,KAClC,UAAS,OAAO,qBAAqB,KAAK;AAS5C,QAAO,GAAG,gBAAgB,GAAG,KAAK,OAFV,GAAG,iBAJZ,OAAO,KAAK,KAAK,UAAU,SAAS,EAAE,QAAQ,CAAC,SAC5D,SACD;;;;AC3GH,MAAa,yBAAyB,SACpC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC,IAAc,SAAS,CAAC,SAC7D,QACD;;;ACSH,MAAa,mBAAmB,EAC9B,kBACoC;AACpC,SACE,wBACE,cAAc,qBAAqB,gBAAgB,KAEtD;AAED,QAAO;EACL,MAAM;EACN,OAAO;EACP,SAAS;EACT,mBAAmB,KAAK;AACtB,UAAO,IAAI,SAAS;;EAEtB,UAAU,IAAI;AACZ,OAAI,GAAG,SAAA,gBAAyB,CAC9B,QAAO,KAAK;;EAGhB,KAAK,IAAI;AACP,OAAI,GAAG,SAAS,kBAAuB,CACrC,QAAO;IACL,MAAM,sBAAsB,GAAG;IAC/B,YAAY;IACb;;EAGL,MAAM,UAAU,MAAM,IAAI;AACxB,OAAIC,0BAAwB,KAAK,GAAG,CAGlC,QAAO;IACL,MAHsB,MAAM,mBAAmB,MAAM,IAAI,YAAY;IAIrE,KAAK;IACN;;EAGN"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -6,16 +6,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
19
15
|
}
|
|
20
16
|
return to;
|
|
21
17
|
};
|
|
@@ -23,26 +19,24 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
19
|
value: mod,
|
|
24
20
|
enumerable: true
|
|
25
21
|
}) : target, mod));
|
|
26
|
-
|
|
27
22
|
//#endregion
|
|
28
23
|
require("picocolors");
|
|
29
24
|
let debug = require("debug");
|
|
30
25
|
debug = __toESM(debug);
|
|
31
|
-
|
|
32
26
|
//#region src/logger.ts
|
|
33
27
|
const trace = (0, debug.default)(`vocab:vite`);
|
|
34
|
-
|
|
35
28
|
//#endregion
|
|
36
|
-
Object.defineProperty(exports,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
29
|
+
Object.defineProperty(exports, "__toESM", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function() {
|
|
32
|
+
return __toESM;
|
|
33
|
+
}
|
|
41
34
|
});
|
|
42
|
-
Object.defineProperty(exports,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
35
|
+
Object.defineProperty(exports, "trace", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function() {
|
|
38
|
+
return trace;
|
|
39
|
+
}
|
|
47
40
|
});
|
|
48
|
-
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=logger-BusUtQic.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger-
|
|
1
|
+
{"version":3,"file":"logger-BusUtQic.cjs","names":[],"sources":["../src/logger.ts"],"sourcesContent":["import pc from 'picocolors';\nimport debug from 'debug';\n\nexport const trace = debug(`vocab:vite`);\n\nexport const log = (...params: unknown[]) => {\n // eslint-disable-next-line no-console\n console.log(pc.yellow('Vocab'), ...params);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAa,SAAA,GAAA,MAAA,SAAc,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger-
|
|
1
|
+
{"version":3,"file":"logger-DOiEeSfu.mjs","names":[],"sources":["../src/logger.ts"],"sourcesContent":["import pc from 'picocolors';\nimport debug from 'debug';\n\nexport const trace = debug(`vocab:vite`);\n\nexport const log = (...params: unknown[]) => {\n // eslint-disable-next-line no-console\n console.log(pc.yellow('Vocab'), ...params);\n};\n"],"mappings":";;;AAGA,MAAa,QAAQ,MAAM,aAAa"}
|
package/dist/runtime.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./logger-BusUtQic.cjs");
|
|
2
3
|
let _vocab_core_translation_file = require("@vocab/core/translation-file");
|
|
3
4
|
let _vocab_core_icu_handler = require("@vocab/core/icu-handler");
|
|
4
|
-
|
|
5
5
|
//#region src/create-language.ts
|
|
6
6
|
const createLanguage = (loadImport) => {
|
|
7
7
|
let promiseValue;
|
|
@@ -22,13 +22,13 @@ const createLanguage = (loadImport) => {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
|
-
|
|
26
25
|
//#endregion
|
|
27
26
|
exports.createLanguage = createLanguage;
|
|
28
|
-
Object.defineProperty(exports,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
Object.defineProperty(exports, "createTranslationFile", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function() {
|
|
30
|
+
return _vocab_core_translation_file.createTranslationFile;
|
|
31
|
+
}
|
|
33
32
|
});
|
|
33
|
+
|
|
34
34
|
//# sourceMappingURL=runtime.cjs.map
|
package/dist/runtime.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.cjs","names":[
|
|
1
|
+
{"version":3,"file":"runtime.cjs","names":[],"sources":["../src/create-language.ts"],"sourcesContent":["import type { TranslationModule } from '@vocab/core';\nimport { getParsedICUMessages } from '@vocab/core/icu-handler';\n\nexport const createLanguage = (\n loadImport: () => Promise<any>,\n): TranslationModule<any> => {\n let promiseValue: Promise<any>;\n let resolvedValue: any;\n\n return {\n getValue: (locale) => {\n if (!resolvedValue) {\n return undefined;\n }\n return getParsedICUMessages(resolvedValue, locale);\n },\n load: () => {\n if (!promiseValue) {\n promiseValue = loadImport();\n promiseValue.then((value) => {\n resolvedValue = value.default;\n });\n }\n return promiseValue;\n },\n };\n};\n"],"mappings":";;;;;AAGA,MAAa,kBACX,eAC2B;CAC3B,IAAI;CACJ,IAAI;AAEJ,QAAO;EACL,WAAW,WAAW;AACpB,OAAI,CAAC,cACH;AAEF,WAAA,GAAA,wBAAA,sBAA4B,eAAe,OAAO;;EAEpD,YAAY;AACV,OAAI,CAAC,cAAc;AACjB,mBAAe,YAAY;AAC3B,iBAAa,MAAM,UAAU;AAC3B,qBAAgB,MAAM;MACtB;;AAEJ,UAAO;;EAEV"}
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createTranslationFile } from "@vocab/core/translation-file";
|
|
2
2
|
import { getParsedICUMessages } from "@vocab/core/icu-handler";
|
|
3
|
-
|
|
4
3
|
//#region src/create-language.ts
|
|
5
4
|
const createLanguage = (loadImport) => {
|
|
6
5
|
let promiseValue;
|
|
@@ -21,7 +20,7 @@ const createLanguage = (loadImport) => {
|
|
|
21
20
|
}
|
|
22
21
|
};
|
|
23
22
|
};
|
|
24
|
-
|
|
25
23
|
//#endregion
|
|
26
24
|
export { createLanguage, createTranslationFile };
|
|
25
|
+
|
|
27
26
|
//# sourceMappingURL=runtime.mjs.map
|
package/dist/runtime.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.mjs","names":[
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":[],"sources":["../src/create-language.ts"],"sourcesContent":["import type { TranslationModule } from '@vocab/core';\nimport { getParsedICUMessages } from '@vocab/core/icu-handler';\n\nexport const createLanguage = (\n loadImport: () => Promise<any>,\n): TranslationModule<any> => {\n let promiseValue: Promise<any>;\n let resolvedValue: any;\n\n return {\n getValue: (locale) => {\n if (!resolvedValue) {\n return undefined;\n }\n return getParsedICUMessages(resolvedValue, locale);\n },\n load: () => {\n if (!promiseValue) {\n promiseValue = loadImport();\n promiseValue.then((value) => {\n resolvedValue = value.default;\n });\n }\n return promiseValue;\n },\n };\n};\n"],"mappings":";;;AAGA,MAAa,kBACX,eAC2B;CAC3B,IAAI;CACJ,IAAI;AAEJ,QAAO;EACL,WAAW,WAAW;AACpB,OAAI,CAAC,cACH;AAEF,UAAO,qBAAqB,eAAe,OAAO;;EAEpD,YAAY;AACV,OAAI,CAAC,cAAc;AACjB,mBAAe,YAAY;AAC3B,iBAAa,MAAM,UAAU;AAC3B,qBAAgB,MAAM;MACtB;;AAEJ,UAAO;;EAEV"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vocab/vite",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"author": "SEEK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -13,20 +13,20 @@
|
|
|
13
13
|
"types": "./dist/index.d.cts",
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
|
-
"
|
|
17
|
-
"
|
|
16
|
+
"import": "./dist/index.mjs",
|
|
17
|
+
"require": "./dist/index.cjs"
|
|
18
18
|
},
|
|
19
19
|
"./chunks": {
|
|
20
|
-
"
|
|
21
|
-
"
|
|
20
|
+
"import": "./dist/chunks.mjs",
|
|
21
|
+
"require": "./dist/chunks.cjs"
|
|
22
22
|
},
|
|
23
23
|
"./get-chunk-name": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"import": "./dist/get-chunk-name.mjs",
|
|
25
|
+
"require": "./dist/get-chunk-name.cjs"
|
|
26
26
|
},
|
|
27
27
|
"./runtime": {
|
|
28
|
-
"
|
|
29
|
-
"
|
|
28
|
+
"import": "./dist/runtime.mjs",
|
|
29
|
+
"require": "./dist/runtime.cjs"
|
|
30
30
|
},
|
|
31
31
|
"./package.json": "./package.json"
|
|
32
32
|
},
|
|
@@ -42,9 +42,13 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/debug": "^4.1.5",
|
|
45
|
-
"
|
|
45
|
+
"rolldown": "^1.0.0-rc.9",
|
|
46
|
+
"vite": "^8.0.0"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
48
|
-
"vite": "^6.0.0 || ^7.0.0"
|
|
49
|
+
"vite": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
50
|
+
},
|
|
51
|
+
"inlinedDependencies": {
|
|
52
|
+
"rolldown": "1.0.0-rc.9"
|
|
49
53
|
}
|
|
50
54
|
}
|