astro-intlayer 8.4.4 → 8.4.6
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/cjs/index.cjs +59 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.mjs +58 -1
- package/dist/esm/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,2 +1,60 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let node_path = require("node:path");
|
|
3
|
+
let _intlayer_chokidar_build = require("@intlayer/chokidar/build");
|
|
4
|
+
let _intlayer_chokidar_watcher = require("@intlayer/chokidar/watcher");
|
|
5
|
+
let _intlayer_config_node = require("@intlayer/config/node");
|
|
6
|
+
let _intlayer_config_utils = require("@intlayer/config/utils");
|
|
7
|
+
let vite_intlayer = require("vite-intlayer");
|
|
8
|
+
|
|
9
|
+
//#region src/index.ts
|
|
10
|
+
/**
|
|
11
|
+
* Astro integration for Intlayer.
|
|
12
|
+
*
|
|
13
|
+
* It handles:
|
|
14
|
+
* 1. Preparing Intlayer resources (dictionaries) at config setup.
|
|
15
|
+
* 2. Injecting Vite plugins for aliases, locale-based routing (middleware), and build optimizations (prune).
|
|
16
|
+
* 3. Configuring Vite aliases for dictionary access.
|
|
17
|
+
* 4. Starting a file watcher for dictionary changes during development.
|
|
18
|
+
*
|
|
19
|
+
* @returns An Astro integration object.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* // astro.config.mjs
|
|
24
|
+
* import { defineConfig } from 'astro/config';
|
|
25
|
+
* import { intlayer } from 'astro-intlayer';
|
|
26
|
+
*
|
|
27
|
+
* export default defineConfig({
|
|
28
|
+
* integrations: [intlayer()],
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
const intlayer = () => ({
|
|
33
|
+
name: "astro-intlayer",
|
|
34
|
+
hooks: {
|
|
35
|
+
"astro:config:setup": async ({ updateConfig }) => {
|
|
36
|
+
const configuration = (0, _intlayer_config_node.getConfiguration)();
|
|
37
|
+
const { optimize } = configuration.build;
|
|
38
|
+
await (0, _intlayer_chokidar_build.prepareIntlayer)(configuration);
|
|
39
|
+
updateConfig({ vite: {
|
|
40
|
+
plugins: [
|
|
41
|
+
(0, vite_intlayer.intlayer)(),
|
|
42
|
+
(0, vite_intlayer.intlayerMiddleware)(),
|
|
43
|
+
...optimize ? [(0, vite_intlayer.intlayerPrune)(configuration)] : []
|
|
44
|
+
],
|
|
45
|
+
resolve: { alias: { ...(0, _intlayer_config_utils.getAlias)({
|
|
46
|
+
configuration,
|
|
47
|
+
formatter: (value) => (0, node_path.resolve)(value)
|
|
48
|
+
}) } }
|
|
49
|
+
} });
|
|
50
|
+
},
|
|
51
|
+
"astro:server:setup": async () => {
|
|
52
|
+
const configuration = (0, _intlayer_config_node.getConfiguration)();
|
|
53
|
+
if (configuration.content.watch) (0, _intlayer_chokidar_watcher.watch)({ configuration });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
exports.intlayer = intlayer;
|
|
2
60
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/index.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport type { AstroIntegration } from 'astro';\nimport {\n intlayerPrune,\n intlayerMiddleware as viteIntlayerMiddlewarePlugin,\n intlayer as viteIntlayerPlugin,\n} from 'vite-intlayer';\n\n/**\n * Astro integration for Intlayer.\n *\n * It handles:\n * 1. Preparing Intlayer resources (dictionaries) at config setup.\n * 2. Injecting Vite plugins for aliases, locale-based routing (middleware), and build optimizations (prune).\n * 3. Configuring Vite aliases for dictionary access.\n * 4. Starting a file watcher for dictionary changes during development.\n *\n * @returns An Astro integration object.\n *\n * @example\n * ```ts\n * // astro.config.mjs\n * import { defineConfig } from 'astro/config';\n * import { intlayer } from 'astro-intlayer';\n *\n * export default defineConfig({\n * integrations: [intlayer()],\n * });\n * ```\n */\nexport const intlayer = (): AstroIntegration =>\n ({\n name: 'astro-intlayer',\n hooks: {\n 'astro:config:setup': async ({ updateConfig }) => {\n const configuration = getConfiguration();\n const { optimize } = configuration.build;\n\n // Prepare once per process start to ensure generated entries exist\n await prepareIntlayer(configuration);\n\n updateConfig({\n vite: {\n plugins: [\n // Aliases + watcher + buildStart prep\n viteIntlayerPlugin(),\n // Dev-time middleware for locale routing\n viteIntlayerMiddlewarePlugin(),\n // Tree-shake/prune content when enabled\n ...(optimize ? [intlayerPrune(configuration) as any] : []),\n ],\n resolve: {\n alias: {\n ...getAlias({\n configuration,\n formatter: (value: string) => resolve(value),\n }),\n },\n },\n },\n });\n },\n\n 'astro:server:setup': async () => {\n const configuration = getConfiguration();\n if (configuration.content.watch) {\n watch({ configuration });\n }\n },\n },\n }) satisfies AstroIntegration;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/index.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport type { AstroIntegration } from 'astro';\nimport {\n intlayerPrune,\n intlayerMiddleware as viteIntlayerMiddlewarePlugin,\n intlayer as viteIntlayerPlugin,\n} from 'vite-intlayer';\n\n/**\n * Astro integration for Intlayer.\n *\n * It handles:\n * 1. Preparing Intlayer resources (dictionaries) at config setup.\n * 2. Injecting Vite plugins for aliases, locale-based routing (middleware), and build optimizations (prune).\n * 3. Configuring Vite aliases for dictionary access.\n * 4. Starting a file watcher for dictionary changes during development.\n *\n * @returns An Astro integration object.\n *\n * @example\n * ```ts\n * // astro.config.mjs\n * import { defineConfig } from 'astro/config';\n * import { intlayer } from 'astro-intlayer';\n *\n * export default defineConfig({\n * integrations: [intlayer()],\n * });\n * ```\n */\nexport const intlayer = (): AstroIntegration =>\n ({\n name: 'astro-intlayer',\n hooks: {\n 'astro:config:setup': async ({ updateConfig }) => {\n const configuration = getConfiguration();\n const { optimize } = configuration.build;\n\n // Prepare once per process start to ensure generated entries exist\n await prepareIntlayer(configuration);\n\n updateConfig({\n vite: {\n plugins: [\n // Aliases + watcher + buildStart prep\n viteIntlayerPlugin(),\n // Dev-time middleware for locale routing\n viteIntlayerMiddlewarePlugin(),\n // Tree-shake/prune content when enabled\n ...(optimize ? [intlayerPrune(configuration) as any] : []),\n ],\n resolve: {\n alias: {\n ...getAlias({\n configuration,\n formatter: (value: string) => resolve(value),\n }),\n },\n },\n },\n });\n },\n\n 'astro:server:setup': async () => {\n const configuration = getConfiguration();\n if (configuration.content.watch) {\n watch({ configuration });\n }\n },\n },\n }) satisfies AstroIntegration;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,kBACV;CACC,MAAM;CACN,OAAO;EACL,sBAAsB,OAAO,EAAE,mBAAmB;GAChD,MAAM,6DAAkC;GACxC,MAAM,EAAE,aAAa,cAAc;AAGnC,uDAAsB,cAAc;AAEpC,gBAAa,EACX,MAAM;IACJ,SAAS;kCAEa;4CAEU;KAE9B,GAAI,WAAW,kCAAe,cAAc,CAAQ,GAAG,EAAE;KAC1D;IACD,SAAS,EACP,OAAO,EACL,wCAAY;KACV;KACA,YAAY,iCAA0B,MAAM;KAC7C,CAAC,EACH,EACF;IACF,EACF,CAAC;;EAGJ,sBAAsB,YAAY;GAChC,MAAM,6DAAkC;AACxC,OAAI,cAAc,QAAQ,MACxB,uCAAM,EAAE,eAAe,CAAC;;EAG7B;CACF"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,2 +1,59 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { prepareIntlayer } from "@intlayer/chokidar/build";
|
|
3
|
+
import { watch } from "@intlayer/chokidar/watcher";
|
|
4
|
+
import { getConfiguration } from "@intlayer/config/node";
|
|
5
|
+
import { getAlias } from "@intlayer/config/utils";
|
|
6
|
+
import { intlayer as intlayer$1, intlayerMiddleware, intlayerPrune } from "vite-intlayer";
|
|
7
|
+
|
|
8
|
+
//#region src/index.ts
|
|
9
|
+
/**
|
|
10
|
+
* Astro integration for Intlayer.
|
|
11
|
+
*
|
|
12
|
+
* It handles:
|
|
13
|
+
* 1. Preparing Intlayer resources (dictionaries) at config setup.
|
|
14
|
+
* 2. Injecting Vite plugins for aliases, locale-based routing (middleware), and build optimizations (prune).
|
|
15
|
+
* 3. Configuring Vite aliases for dictionary access.
|
|
16
|
+
* 4. Starting a file watcher for dictionary changes during development.
|
|
17
|
+
*
|
|
18
|
+
* @returns An Astro integration object.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* // astro.config.mjs
|
|
23
|
+
* import { defineConfig } from 'astro/config';
|
|
24
|
+
* import { intlayer } from 'astro-intlayer';
|
|
25
|
+
*
|
|
26
|
+
* export default defineConfig({
|
|
27
|
+
* integrations: [intlayer()],
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
const intlayer = () => ({
|
|
32
|
+
name: "astro-intlayer",
|
|
33
|
+
hooks: {
|
|
34
|
+
"astro:config:setup": async ({ updateConfig }) => {
|
|
35
|
+
const configuration = getConfiguration();
|
|
36
|
+
const { optimize } = configuration.build;
|
|
37
|
+
await prepareIntlayer(configuration);
|
|
38
|
+
updateConfig({ vite: {
|
|
39
|
+
plugins: [
|
|
40
|
+
intlayer$1(),
|
|
41
|
+
intlayerMiddleware(),
|
|
42
|
+
...optimize ? [intlayerPrune(configuration)] : []
|
|
43
|
+
],
|
|
44
|
+
resolve: { alias: { ...getAlias({
|
|
45
|
+
configuration,
|
|
46
|
+
formatter: (value) => resolve(value)
|
|
47
|
+
}) } }
|
|
48
|
+
} });
|
|
49
|
+
},
|
|
50
|
+
"astro:server:setup": async () => {
|
|
51
|
+
const configuration = getConfiguration();
|
|
52
|
+
if (configuration.content.watch) watch({ configuration });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
export { intlayer };
|
|
2
59
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["viteIntlayerPlugin","viteIntlayerMiddlewarePlugin"],"sources":["../../src/index.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport type { AstroIntegration } from 'astro';\nimport {\n intlayerPrune,\n intlayerMiddleware as viteIntlayerMiddlewarePlugin,\n intlayer as viteIntlayerPlugin,\n} from 'vite-intlayer';\n\n/**\n * Astro integration for Intlayer.\n *\n * It handles:\n * 1. Preparing Intlayer resources (dictionaries) at config setup.\n * 2. Injecting Vite plugins for aliases, locale-based routing (middleware), and build optimizations (prune).\n * 3. Configuring Vite aliases for dictionary access.\n * 4. Starting a file watcher for dictionary changes during development.\n *\n * @returns An Astro integration object.\n *\n * @example\n * ```ts\n * // astro.config.mjs\n * import { defineConfig } from 'astro/config';\n * import { intlayer } from 'astro-intlayer';\n *\n * export default defineConfig({\n * integrations: [intlayer()],\n * });\n * ```\n */\nexport const intlayer = (): AstroIntegration =>\n ({\n name: 'astro-intlayer',\n hooks: {\n 'astro:config:setup': async ({ updateConfig }) => {\n const configuration = getConfiguration();\n const { optimize } = configuration.build;\n\n // Prepare once per process start to ensure generated entries exist\n await prepareIntlayer(configuration);\n\n updateConfig({\n vite: {\n plugins: [\n // Aliases + watcher + buildStart prep\n viteIntlayerPlugin(),\n // Dev-time middleware for locale routing\n viteIntlayerMiddlewarePlugin(),\n // Tree-shake/prune content when enabled\n ...(optimize ? [intlayerPrune(configuration) as any] : []),\n ],\n resolve: {\n alias: {\n ...getAlias({\n configuration,\n formatter: (value: string) => resolve(value),\n }),\n },\n },\n },\n });\n },\n\n 'astro:server:setup': async () => {\n const configuration = getConfiguration();\n if (configuration.content.watch) {\n watch({ configuration });\n }\n },\n },\n }) satisfies AstroIntegration;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["viteIntlayerPlugin","viteIntlayerMiddlewarePlugin"],"sources":["../../src/index.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport type { AstroIntegration } from 'astro';\nimport {\n intlayerPrune,\n intlayerMiddleware as viteIntlayerMiddlewarePlugin,\n intlayer as viteIntlayerPlugin,\n} from 'vite-intlayer';\n\n/**\n * Astro integration for Intlayer.\n *\n * It handles:\n * 1. Preparing Intlayer resources (dictionaries) at config setup.\n * 2. Injecting Vite plugins for aliases, locale-based routing (middleware), and build optimizations (prune).\n * 3. Configuring Vite aliases for dictionary access.\n * 4. Starting a file watcher for dictionary changes during development.\n *\n * @returns An Astro integration object.\n *\n * @example\n * ```ts\n * // astro.config.mjs\n * import { defineConfig } from 'astro/config';\n * import { intlayer } from 'astro-intlayer';\n *\n * export default defineConfig({\n * integrations: [intlayer()],\n * });\n * ```\n */\nexport const intlayer = (): AstroIntegration =>\n ({\n name: 'astro-intlayer',\n hooks: {\n 'astro:config:setup': async ({ updateConfig }) => {\n const configuration = getConfiguration();\n const { optimize } = configuration.build;\n\n // Prepare once per process start to ensure generated entries exist\n await prepareIntlayer(configuration);\n\n updateConfig({\n vite: {\n plugins: [\n // Aliases + watcher + buildStart prep\n viteIntlayerPlugin(),\n // Dev-time middleware for locale routing\n viteIntlayerMiddlewarePlugin(),\n // Tree-shake/prune content when enabled\n ...(optimize ? [intlayerPrune(configuration) as any] : []),\n ],\n resolve: {\n alias: {\n ...getAlias({\n configuration,\n formatter: (value: string) => resolve(value),\n }),\n },\n },\n },\n });\n },\n\n 'astro:server:setup': async () => {\n const configuration = getConfiguration();\n if (configuration.content.watch) {\n watch({ configuration });\n }\n },\n },\n }) satisfies AstroIntegration;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,kBACV;CACC,MAAM;CACN,OAAO;EACL,sBAAsB,OAAO,EAAE,mBAAmB;GAChD,MAAM,gBAAgB,kBAAkB;GACxC,MAAM,EAAE,aAAa,cAAc;AAGnC,SAAM,gBAAgB,cAAc;AAEpC,gBAAa,EACX,MAAM;IACJ,SAAS;KAEPA,YAAoB;KAEpBC,oBAA8B;KAE9B,GAAI,WAAW,CAAC,cAAc,cAAc,CAAQ,GAAG,EAAE;KAC1D;IACD,SAAS,EACP,OAAO,EACL,GAAG,SAAS;KACV;KACA,YAAY,UAAkB,QAAQ,MAAM;KAC7C,CAAC,EACH,EACF;IACF,EACF,CAAC;;EAGJ,sBAAsB,YAAY;GAChC,MAAM,gBAAgB,kBAAkB;AACxC,OAAI,cAAc,QAAQ,MACxB,OAAM,EAAE,eAAe,CAAC;;EAG7B;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-intlayer",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Nuxt applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -78,11 +78,11 @@
|
|
|
78
78
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@intlayer/chokidar": "8.4.
|
|
82
|
-
"@intlayer/config": "8.4.
|
|
83
|
-
"@intlayer/core": "8.4.
|
|
84
|
-
"@intlayer/types": "8.4.
|
|
85
|
-
"vite-intlayer": "8.4.
|
|
81
|
+
"@intlayer/chokidar": "8.4.6",
|
|
82
|
+
"@intlayer/config": "8.4.6",
|
|
83
|
+
"@intlayer/core": "8.4.6",
|
|
84
|
+
"@intlayer/types": "8.4.6",
|
|
85
|
+
"vite-intlayer": "8.4.6"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@types/node": "25.5.0",
|