angular-intlayer 8.10.1 → 8.11.0
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/esbuild/index.cjs +4 -0
- package/dist/cjs/esbuild/plugin.cjs +100 -0
- package/dist/cjs/esbuild/plugin.cjs.map +1 -0
- package/dist/esm/esbuild/index.mjs +3 -0
- package/dist/esm/esbuild/plugin.mjs +98 -0
- package/dist/esm/esbuild/plugin.mjs.map +1 -0
- package/dist/types/client/useDictionaryDynamic.d.ts +1 -2
- package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
- package/dist/types/client/useLocaleStorage.d.ts +4 -5
- package/dist/types/client/useLocaleStorage.d.ts.map +1 -1
- package/dist/types/esbuild/index.d.ts +2 -0
- package/dist/types/esbuild/plugin.d.ts +67 -0
- package/dist/types/esbuild/plugin.d.ts.map +1 -0
- package/dist/types/format/useCompact.d.ts +1 -3
- package/dist/types/format/useCompact.d.ts.map +1 -1
- package/dist/types/format/useCurrency.d.ts +1 -3
- package/dist/types/format/useCurrency.d.ts.map +1 -1
- package/dist/types/format/useDate.d.ts +1 -3
- package/dist/types/format/useDate.d.ts.map +1 -1
- package/dist/types/format/useList.d.ts +1 -3
- package/dist/types/format/useList.d.ts.map +1 -1
- package/dist/types/format/useNumber.d.ts +1 -3
- package/dist/types/format/useNumber.d.ts.map +1 -1
- package/dist/types/format/usePercentage.d.ts +1 -3
- package/dist/types/format/usePercentage.d.ts.map +1 -1
- package/dist/types/format/useRelativeTime.d.ts +1 -3
- package/dist/types/format/useRelativeTime.d.ts.map +1 -1
- package/dist/types/format/useUnit.d.ts +1 -3
- package/dist/types/format/useUnit.d.ts.map +1 -1
- package/package.json +23 -8
- package/dist/types/intlayer/dist/types/index.d.ts +0 -4
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let node_path = require("node:path");
|
|
4
|
+
let _intlayer_config_node = require("@intlayer/config/node");
|
|
5
|
+
let _intlayer_config_utils = require("@intlayer/config/utils");
|
|
6
|
+
let _intlayer_chokidar_build = require("@intlayer/chokidar/build");
|
|
7
|
+
let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
|
|
8
|
+
let _intlayer_chokidar_watcher = require("@intlayer/chokidar/watcher");
|
|
9
|
+
let _intlayer_config_envVars = require("@intlayer/config/envVars");
|
|
10
|
+
let _intlayer_config_logger = require("@intlayer/config/logger");
|
|
11
|
+
let _intlayer_dictionaries_entry = require("@intlayer/dictionaries-entry");
|
|
12
|
+
|
|
13
|
+
//#region src/esbuild/plugin.ts
|
|
14
|
+
/**
|
|
15
|
+
* esbuild plugin that integrates Intlayer into the Angular (or any esbuild-based) build process.
|
|
16
|
+
*
|
|
17
|
+
* Handles:
|
|
18
|
+
* 1. Injecting `alias` entries so `@intlayer/dictionaries-entry` etc. resolve to
|
|
19
|
+
* the generated files under `.intlayer/`.
|
|
20
|
+
* 2. Defining `process.env.*` tree-shaking constants for production builds.
|
|
21
|
+
* 3. Running `prepareIntlayer` (dictionary generation) before the first build.
|
|
22
|
+
* 4. Starting the chokidar file-watcher in dev / serve mode.
|
|
23
|
+
*
|
|
24
|
+
* Compatible with:
|
|
25
|
+
* - `@angular-builders/custom-esbuild` (`application` or `browser-esbuild` builder)
|
|
26
|
+
* - NX `@nx/angular:browser-esbuild`
|
|
27
|
+
* - Any raw esbuild setup that accepts the standard `Plugin` interface
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* // esbuild.plugins.ts (referenced from angular.json "plugins" option)
|
|
32
|
+
* import { intlayerEsbuildPlugin } from 'angular-intlayer/esbuild';
|
|
33
|
+
* export default [intlayerEsbuildPlugin()];
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
const intlayerEsbuildPlugin = (options) => {
|
|
37
|
+
let config = null;
|
|
38
|
+
let alias = null;
|
|
39
|
+
let preparePromise = null;
|
|
40
|
+
let watcherStarted = false;
|
|
41
|
+
let isBuildMode = false;
|
|
42
|
+
return {
|
|
43
|
+
name: "intlayer",
|
|
44
|
+
async setup(build) {
|
|
45
|
+
if (!config) {
|
|
46
|
+
const baseDir = build.initialOptions.absWorkingDir ?? options?.configOptions?.baseDir ?? process.cwd();
|
|
47
|
+
config = (0, _intlayer_config_node.getConfiguration)({
|
|
48
|
+
baseDir,
|
|
49
|
+
...options?.configOptions
|
|
50
|
+
});
|
|
51
|
+
(0, _intlayer_chokidar_cli.logConfigDetails)({
|
|
52
|
+
baseDir,
|
|
53
|
+
...options?.configOptions
|
|
54
|
+
});
|
|
55
|
+
alias = (0, _intlayer_config_utils.getAlias)({
|
|
56
|
+
configuration: config,
|
|
57
|
+
formatter: (value) => (0, node_path.join)(config.system.baseDir, value)
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const appLogger = (0, _intlayer_config_logger.getAppLogger)(config);
|
|
61
|
+
const nodeEnvDefine = build.initialOptions.define?.["process.env.NODE_ENV"];
|
|
62
|
+
const isProduction = nodeEnvDefine === "\"production\"" || nodeEnvDefine === "'production'" || build.initialOptions.minify === true || build.initialOptions.define?.["ngDevMode"] === "false";
|
|
63
|
+
if (isProduction) isBuildMode = true;
|
|
64
|
+
const envVars = {
|
|
65
|
+
INTLAYER: "true",
|
|
66
|
+
NODE_ENV: isProduction ? "production" : "development"
|
|
67
|
+
};
|
|
68
|
+
if (isProduction) {
|
|
69
|
+
const dictionaries = (0, _intlayer_dictionaries_entry.getDictionaries)(config);
|
|
70
|
+
if (Object.keys(dictionaries).length === 0) appLogger("No dictionaries found. Please check your configuration.", { isVerbose: true });
|
|
71
|
+
const unusedNodeTypes = await (0, _intlayer_config_utils.getUnusedNodeTypesAsync)(dictionaries);
|
|
72
|
+
Object.assign(envVars, (0, _intlayer_config_envVars.formatNodeTypeToEnvVar)(unusedNodeTypes), (0, _intlayer_config_envVars.getConfigEnvVars)(config));
|
|
73
|
+
}
|
|
74
|
+
build.initialOptions.alias = {
|
|
75
|
+
...alias,
|
|
76
|
+
...build.initialOptions.alias ?? {}
|
|
77
|
+
};
|
|
78
|
+
for (const [from, to] of Object.entries(alias)) {
|
|
79
|
+
const escapedFrom = from.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
80
|
+
build.onResolve({ filter: new RegExp(`^${escapedFrom}$`) }, () => ({ path: to }));
|
|
81
|
+
}
|
|
82
|
+
if (!preparePromise) preparePromise = (0, _intlayer_chokidar_build.prepareIntlayer)(config, {
|
|
83
|
+
clean: isProduction,
|
|
84
|
+
cacheTimeoutMs: isProduction ? 1e3 * 30 : 1e3 * 60 * 60,
|
|
85
|
+
env: isProduction ? "prod" : "dev"
|
|
86
|
+
});
|
|
87
|
+
await preparePromise;
|
|
88
|
+
build.onStart(async () => {
|
|
89
|
+
if ((options?.watch ?? !isBuildMode) && !watcherStarted) {
|
|
90
|
+
watcherStarted = true;
|
|
91
|
+
await (0, _intlayer_chokidar_watcher.watch)({ configuration: config });
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
//#endregion
|
|
99
|
+
exports.intlayerEsbuildPlugin = intlayerEsbuildPlugin;
|
|
100
|
+
//# sourceMappingURL=plugin.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs","names":[],"sources":["../../../src/esbuild/plugin.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { logConfigDetails } from '@intlayer/chokidar/cli';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport {\n formatNodeTypeToEnvVar,\n getConfigEnvVars,\n} from '@intlayer/config/envVars';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getAlias, getUnusedNodeTypesAsync } from '@intlayer/config/utils';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\n\n// Minimal subset of the esbuild Plugin interface to avoid a hard dependency on\n// the `esbuild` package for type resolution. The shape is compatible with\n// esbuild >=0.17, `@angular-builders/custom-esbuild`, and NX esbuild builders.\nexport interface EsbuildPluginBuild {\n initialOptions: {\n alias?: Record<string, string>;\n define?: Record<string, string>;\n minify?: boolean;\n watch?: unknown;\n /** Absolute working directory of the esbuild context (set by Angular's builder). */\n absWorkingDir?: string;\n };\n onStart(callback: () => void | Promise<void>): void;\n /** Intercept module resolution — works even for imports inside node_modules. */\n onResolve(\n options: { filter: RegExp; namespace?: string },\n callback: (args: {\n path: string;\n importer: string;\n namespace: string;\n resolveDir: string;\n }) => { path: string; namespace?: string } | null | undefined\n ): void;\n}\n\nexport interface EsbuildPlugin {\n name: string;\n setup(build: EsbuildPluginBuild): void | Promise<void>;\n}\n\nexport type IntlayerEsbuildPluginOptions = {\n configOptions?: GetConfigurationOptions;\n /**\n * Whether to start the Intlayer file watcher for dictionary regeneration.\n * - `true`: always start the watcher (useful for `ng serve`)\n * - `false`: never start the watcher (useful for `ng build`)\n * - `undefined` (default): auto-detect based on the build context\n * (skips the watcher when a production build is detected)\n */\n watch?: boolean;\n};\n\n/**\n * esbuild plugin that integrates Intlayer into the Angular (or any esbuild-based) build process.\n *\n * Handles:\n * 1. Injecting `alias` entries so `@intlayer/dictionaries-entry` etc. resolve to\n * the generated files under `.intlayer/`.\n * 2. Defining `process.env.*` tree-shaking constants for production builds.\n * 3. Running `prepareIntlayer` (dictionary generation) before the first build.\n * 4. Starting the chokidar file-watcher in dev / serve mode.\n *\n * Compatible with:\n * - `@angular-builders/custom-esbuild` (`application` or `browser-esbuild` builder)\n * - NX `@nx/angular:browser-esbuild`\n * - Any raw esbuild setup that accepts the standard `Plugin` interface\n *\n * @example\n * ```ts\n * // esbuild.plugins.ts (referenced from angular.json \"plugins\" option)\n * import { intlayerEsbuildPlugin } from 'angular-intlayer/esbuild';\n * export default [intlayerEsbuildPlugin()];\n * ```\n */\nexport const intlayerEsbuildPlugin = (\n options?: IntlayerEsbuildPluginOptions\n): EsbuildPlugin => {\n // All Node.js-heavy initialization (getConfiguration, getAlias, …) is deferred\n // into setup() so it runs in esbuild's Node.js context, not at module-evaluation\n // time. @angular/build loads the plugin file through Vite's SSR module runner\n // (ESM) where CommonJS globals like __filename are undefined. Calling\n // getConfiguration() here would trigger: buildSync → worker threads →\n // __filename → ReferenceError, crashing the plugin before setup() ever runs.\n let config: ReturnType<typeof getConfiguration> | null = null;\n let alias: Record<string, string> | null = null;\n\n // Shared across parallel setup() calls (Angular spawns one per bundle context).\n let preparePromise: Promise<void> | null = null;\n let watcherStarted = false;\n // Once any esbuild context (browser or server) detects a production build,\n // suppress the watcher for all contexts so `ng build` can exit cleanly.\n let isBuildMode = false;\n\n return {\n name: 'intlayer',\n\n async setup(build) {\n if (!config) {\n const baseDir =\n build.initialOptions.absWorkingDir ??\n options?.configOptions?.baseDir ??\n process.cwd();\n\n config = getConfiguration({ baseDir, ...options?.configOptions });\n logConfigDetails({ baseDir, ...options?.configOptions });\n\n alias = getAlias({\n configuration: config,\n formatter: (value: string) => join(config!.system.baseDir, value),\n });\n }\n\n const appLogger = getAppLogger(config);\n const nodeEnvDefine =\n build.initialOptions.define?.['process.env.NODE_ENV'];\n\n // Angular's esbuild builder doesn't set `minify` or `process.env.NODE_ENV`\n // on initialOptions — it handles optimisation through its own pipeline.\n // Instead, Angular defines `ngDevMode` as `\"false\"` in production builds.\n const isProduction =\n nodeEnvDefine === '\"production\"' ||\n nodeEnvDefine === \"'production'\" ||\n build.initialOptions.minify === true ||\n build.initialOptions.define?.['ngDevMode'] === 'false';\n\n if (isProduction) {\n isBuildMode = true;\n }\n\n const envVars: Record<string, string> = {\n INTLAYER: 'true',\n NODE_ENV: isProduction ? 'production' : 'development',\n };\n\n if (isProduction) {\n const dictionaries = getDictionaries(config);\n if (Object.keys(dictionaries).length === 0) {\n appLogger('No dictionaries found. Please check your configuration.', {\n isVerbose: true,\n });\n }\n\n const unusedNodeTypes = await getUnusedNodeTypesAsync(dictionaries);\n Object.assign(\n envVars,\n formatNodeTypeToEnvVar(unusedNodeTypes),\n getConfigEnvVars(config)\n );\n }\n\n build.initialOptions.alias = {\n ...alias,\n ...(build.initialOptions.alias ?? {}),\n };\n\n for (const [from, to] of Object.entries(alias!)) {\n const escapedFrom = from.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n build.onResolve({ filter: new RegExp(`^${escapedFrom}$`) }, () => ({\n path: to,\n }));\n }\n\n if (!preparePromise) {\n preparePromise = prepareIntlayer(config, {\n clean: isProduction,\n cacheTimeoutMs: isProduction ? 1000 * 30 : 1000 * 60 * 60,\n env: isProduction ? 'prod' : 'dev',\n });\n }\n\n await preparePromise;\n\n build.onStart(async () => {\n // Determine whether the watcher should run:\n // 1. Explicit option from the caller takes precedence\n // 2. If any esbuild context detected a production build, skip\n // 3. esbuild's own watch mode is a positive signal\n const shouldWatch = options?.watch ?? !isBuildMode;\n\n if (shouldWatch && !watcherStarted) {\n watcherStarted = true;\n\n await watch({ configuration: config! });\n }\n });\n },\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFA,MAAa,yBACX,YACkB;CAOlB,IAAI,SAAqD;CACzD,IAAI,QAAuC;CAG3C,IAAI,iBAAuC;CAC3C,IAAI,iBAAiB;CAGrB,IAAI,cAAc;CAElB,OAAO;EACL,MAAM;EAEN,MAAM,MAAM,OAAO;GACjB,IAAI,CAAC,QAAQ;IACX,MAAM,UACJ,MAAM,eAAe,iBACrB,SAAS,eAAe,WACxB,QAAQ,IAAI;IAEd,qDAA0B;KAAE;KAAS,GAAG,SAAS;IAAc,CAAC;IAChE,6CAAiB;KAAE;KAAS,GAAG,SAAS;IAAc,CAAC;IAEvD,6CAAiB;KACf,eAAe;KACf,YAAY,8BAAuB,OAAQ,OAAO,SAAS,KAAK;IAClE,CAAC;GACH;GAEA,MAAM,sDAAyB,MAAM;GACrC,MAAM,gBACJ,MAAM,eAAe,SAAS;GAKhC,MAAM,eACJ,kBAAkB,oBAClB,kBAAkB,kBAClB,MAAM,eAAe,WAAW,QAChC,MAAM,eAAe,SAAS,iBAAiB;GAEjD,IAAI,cACF,cAAc;GAGhB,MAAM,UAAkC;IACtC,UAAU;IACV,UAAU,eAAe,eAAe;GAC1C;GAEA,IAAI,cAAc;IAChB,MAAM,iEAA+B,MAAM;IAC3C,IAAI,OAAO,KAAK,YAAY,EAAE,WAAW,GACvC,UAAU,2DAA2D,EACnE,WAAW,KACb,CAAC;IAGH,MAAM,kBAAkB,0DAA8B,YAAY;IAClE,OAAO,OACL,8DACuB,eAAe,kDACrB,MAAM,CACzB;GACF;GAEA,MAAM,eAAe,QAAQ;IAC3B,GAAG;IACH,GAAI,MAAM,eAAe,SAAS,CAAC;GACrC;GAEA,KAAK,MAAM,CAAC,MAAM,OAAO,OAAO,QAAQ,KAAM,GAAG;IAC/C,MAAM,cAAc,KAAK,QAAQ,uBAAuB,MAAM;IAE9D,MAAM,UAAU,EAAE,QAAQ,IAAI,OAAO,IAAI,YAAY,EAAE,EAAE,UAAU,EACjE,MAAM,GACR,EAAE;GACJ;GAEA,IAAI,CAAC,gBACH,+DAAiC,QAAQ;IACvC,OAAO;IACP,gBAAgB,eAAe,MAAO,KAAK,MAAO,KAAK;IACvD,KAAK,eAAe,SAAS;GAC/B,CAAC;GAGH,MAAM;GAEN,MAAM,QAAQ,YAAY;IAOxB,KAFoB,SAAS,SAAS,CAAC,gBAEpB,CAAC,gBAAgB;KAClC,iBAAiB;KAEjB,4CAAY,EAAE,eAAe,OAAQ,CAAC;IACxC;GACF,CAAC;EACH;CACF;AACF"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { getConfiguration } from "@intlayer/config/node";
|
|
3
|
+
import { getAlias, getUnusedNodeTypesAsync } from "@intlayer/config/utils";
|
|
4
|
+
import { prepareIntlayer } from "@intlayer/chokidar/build";
|
|
5
|
+
import { logConfigDetails } from "@intlayer/chokidar/cli";
|
|
6
|
+
import { watch } from "@intlayer/chokidar/watcher";
|
|
7
|
+
import { formatNodeTypeToEnvVar, getConfigEnvVars } from "@intlayer/config/envVars";
|
|
8
|
+
import { getAppLogger } from "@intlayer/config/logger";
|
|
9
|
+
import { getDictionaries } from "@intlayer/dictionaries-entry";
|
|
10
|
+
|
|
11
|
+
//#region src/esbuild/plugin.ts
|
|
12
|
+
/**
|
|
13
|
+
* esbuild plugin that integrates Intlayer into the Angular (or any esbuild-based) build process.
|
|
14
|
+
*
|
|
15
|
+
* Handles:
|
|
16
|
+
* 1. Injecting `alias` entries so `@intlayer/dictionaries-entry` etc. resolve to
|
|
17
|
+
* the generated files under `.intlayer/`.
|
|
18
|
+
* 2. Defining `process.env.*` tree-shaking constants for production builds.
|
|
19
|
+
* 3. Running `prepareIntlayer` (dictionary generation) before the first build.
|
|
20
|
+
* 4. Starting the chokidar file-watcher in dev / serve mode.
|
|
21
|
+
*
|
|
22
|
+
* Compatible with:
|
|
23
|
+
* - `@angular-builders/custom-esbuild` (`application` or `browser-esbuild` builder)
|
|
24
|
+
* - NX `@nx/angular:browser-esbuild`
|
|
25
|
+
* - Any raw esbuild setup that accepts the standard `Plugin` interface
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* // esbuild.plugins.ts (referenced from angular.json "plugins" option)
|
|
30
|
+
* import { intlayerEsbuildPlugin } from 'angular-intlayer/esbuild';
|
|
31
|
+
* export default [intlayerEsbuildPlugin()];
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
const intlayerEsbuildPlugin = (options) => {
|
|
35
|
+
let config = null;
|
|
36
|
+
let alias = null;
|
|
37
|
+
let preparePromise = null;
|
|
38
|
+
let watcherStarted = false;
|
|
39
|
+
let isBuildMode = false;
|
|
40
|
+
return {
|
|
41
|
+
name: "intlayer",
|
|
42
|
+
async setup(build) {
|
|
43
|
+
if (!config) {
|
|
44
|
+
const baseDir = build.initialOptions.absWorkingDir ?? options?.configOptions?.baseDir ?? process.cwd();
|
|
45
|
+
config = getConfiguration({
|
|
46
|
+
baseDir,
|
|
47
|
+
...options?.configOptions
|
|
48
|
+
});
|
|
49
|
+
logConfigDetails({
|
|
50
|
+
baseDir,
|
|
51
|
+
...options?.configOptions
|
|
52
|
+
});
|
|
53
|
+
alias = getAlias({
|
|
54
|
+
configuration: config,
|
|
55
|
+
formatter: (value) => join(config.system.baseDir, value)
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const appLogger = getAppLogger(config);
|
|
59
|
+
const nodeEnvDefine = build.initialOptions.define?.["process.env.NODE_ENV"];
|
|
60
|
+
const isProduction = nodeEnvDefine === "\"production\"" || nodeEnvDefine === "'production'" || build.initialOptions.minify === true || build.initialOptions.define?.["ngDevMode"] === "false";
|
|
61
|
+
if (isProduction) isBuildMode = true;
|
|
62
|
+
const envVars = {
|
|
63
|
+
INTLAYER: "true",
|
|
64
|
+
NODE_ENV: isProduction ? "production" : "development"
|
|
65
|
+
};
|
|
66
|
+
if (isProduction) {
|
|
67
|
+
const dictionaries = getDictionaries(config);
|
|
68
|
+
if (Object.keys(dictionaries).length === 0) appLogger("No dictionaries found. Please check your configuration.", { isVerbose: true });
|
|
69
|
+
const unusedNodeTypes = await getUnusedNodeTypesAsync(dictionaries);
|
|
70
|
+
Object.assign(envVars, formatNodeTypeToEnvVar(unusedNodeTypes), getConfigEnvVars(config));
|
|
71
|
+
}
|
|
72
|
+
build.initialOptions.alias = {
|
|
73
|
+
...alias,
|
|
74
|
+
...build.initialOptions.alias ?? {}
|
|
75
|
+
};
|
|
76
|
+
for (const [from, to] of Object.entries(alias)) {
|
|
77
|
+
const escapedFrom = from.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
78
|
+
build.onResolve({ filter: new RegExp(`^${escapedFrom}$`) }, () => ({ path: to }));
|
|
79
|
+
}
|
|
80
|
+
if (!preparePromise) preparePromise = prepareIntlayer(config, {
|
|
81
|
+
clean: isProduction,
|
|
82
|
+
cacheTimeoutMs: isProduction ? 1e3 * 30 : 1e3 * 60 * 60,
|
|
83
|
+
env: isProduction ? "prod" : "dev"
|
|
84
|
+
});
|
|
85
|
+
await preparePromise;
|
|
86
|
+
build.onStart(async () => {
|
|
87
|
+
if ((options?.watch ?? !isBuildMode) && !watcherStarted) {
|
|
88
|
+
watcherStarted = true;
|
|
89
|
+
await watch({ configuration: config });
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
export { intlayerEsbuildPlugin };
|
|
98
|
+
//# sourceMappingURL=plugin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.mjs","names":[],"sources":["../../../src/esbuild/plugin.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { logConfigDetails } from '@intlayer/chokidar/cli';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport {\n formatNodeTypeToEnvVar,\n getConfigEnvVars,\n} from '@intlayer/config/envVars';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getAlias, getUnusedNodeTypesAsync } from '@intlayer/config/utils';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\n\n// Minimal subset of the esbuild Plugin interface to avoid a hard dependency on\n// the `esbuild` package for type resolution. The shape is compatible with\n// esbuild >=0.17, `@angular-builders/custom-esbuild`, and NX esbuild builders.\nexport interface EsbuildPluginBuild {\n initialOptions: {\n alias?: Record<string, string>;\n define?: Record<string, string>;\n minify?: boolean;\n watch?: unknown;\n /** Absolute working directory of the esbuild context (set by Angular's builder). */\n absWorkingDir?: string;\n };\n onStart(callback: () => void | Promise<void>): void;\n /** Intercept module resolution — works even for imports inside node_modules. */\n onResolve(\n options: { filter: RegExp; namespace?: string },\n callback: (args: {\n path: string;\n importer: string;\n namespace: string;\n resolveDir: string;\n }) => { path: string; namespace?: string } | null | undefined\n ): void;\n}\n\nexport interface EsbuildPlugin {\n name: string;\n setup(build: EsbuildPluginBuild): void | Promise<void>;\n}\n\nexport type IntlayerEsbuildPluginOptions = {\n configOptions?: GetConfigurationOptions;\n /**\n * Whether to start the Intlayer file watcher for dictionary regeneration.\n * - `true`: always start the watcher (useful for `ng serve`)\n * - `false`: never start the watcher (useful for `ng build`)\n * - `undefined` (default): auto-detect based on the build context\n * (skips the watcher when a production build is detected)\n */\n watch?: boolean;\n};\n\n/**\n * esbuild plugin that integrates Intlayer into the Angular (or any esbuild-based) build process.\n *\n * Handles:\n * 1. Injecting `alias` entries so `@intlayer/dictionaries-entry` etc. resolve to\n * the generated files under `.intlayer/`.\n * 2. Defining `process.env.*` tree-shaking constants for production builds.\n * 3. Running `prepareIntlayer` (dictionary generation) before the first build.\n * 4. Starting the chokidar file-watcher in dev / serve mode.\n *\n * Compatible with:\n * - `@angular-builders/custom-esbuild` (`application` or `browser-esbuild` builder)\n * - NX `@nx/angular:browser-esbuild`\n * - Any raw esbuild setup that accepts the standard `Plugin` interface\n *\n * @example\n * ```ts\n * // esbuild.plugins.ts (referenced from angular.json \"plugins\" option)\n * import { intlayerEsbuildPlugin } from 'angular-intlayer/esbuild';\n * export default [intlayerEsbuildPlugin()];\n * ```\n */\nexport const intlayerEsbuildPlugin = (\n options?: IntlayerEsbuildPluginOptions\n): EsbuildPlugin => {\n // All Node.js-heavy initialization (getConfiguration, getAlias, …) is deferred\n // into setup() so it runs in esbuild's Node.js context, not at module-evaluation\n // time. @angular/build loads the plugin file through Vite's SSR module runner\n // (ESM) where CommonJS globals like __filename are undefined. Calling\n // getConfiguration() here would trigger: buildSync → worker threads →\n // __filename → ReferenceError, crashing the plugin before setup() ever runs.\n let config: ReturnType<typeof getConfiguration> | null = null;\n let alias: Record<string, string> | null = null;\n\n // Shared across parallel setup() calls (Angular spawns one per bundle context).\n let preparePromise: Promise<void> | null = null;\n let watcherStarted = false;\n // Once any esbuild context (browser or server) detects a production build,\n // suppress the watcher for all contexts so `ng build` can exit cleanly.\n let isBuildMode = false;\n\n return {\n name: 'intlayer',\n\n async setup(build) {\n if (!config) {\n const baseDir =\n build.initialOptions.absWorkingDir ??\n options?.configOptions?.baseDir ??\n process.cwd();\n\n config = getConfiguration({ baseDir, ...options?.configOptions });\n logConfigDetails({ baseDir, ...options?.configOptions });\n\n alias = getAlias({\n configuration: config,\n formatter: (value: string) => join(config!.system.baseDir, value),\n });\n }\n\n const appLogger = getAppLogger(config);\n const nodeEnvDefine =\n build.initialOptions.define?.['process.env.NODE_ENV'];\n\n // Angular's esbuild builder doesn't set `minify` or `process.env.NODE_ENV`\n // on initialOptions — it handles optimisation through its own pipeline.\n // Instead, Angular defines `ngDevMode` as `\"false\"` in production builds.\n const isProduction =\n nodeEnvDefine === '\"production\"' ||\n nodeEnvDefine === \"'production'\" ||\n build.initialOptions.minify === true ||\n build.initialOptions.define?.['ngDevMode'] === 'false';\n\n if (isProduction) {\n isBuildMode = true;\n }\n\n const envVars: Record<string, string> = {\n INTLAYER: 'true',\n NODE_ENV: isProduction ? 'production' : 'development',\n };\n\n if (isProduction) {\n const dictionaries = getDictionaries(config);\n if (Object.keys(dictionaries).length === 0) {\n appLogger('No dictionaries found. Please check your configuration.', {\n isVerbose: true,\n });\n }\n\n const unusedNodeTypes = await getUnusedNodeTypesAsync(dictionaries);\n Object.assign(\n envVars,\n formatNodeTypeToEnvVar(unusedNodeTypes),\n getConfigEnvVars(config)\n );\n }\n\n build.initialOptions.alias = {\n ...alias,\n ...(build.initialOptions.alias ?? {}),\n };\n\n for (const [from, to] of Object.entries(alias!)) {\n const escapedFrom = from.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n build.onResolve({ filter: new RegExp(`^${escapedFrom}$`) }, () => ({\n path: to,\n }));\n }\n\n if (!preparePromise) {\n preparePromise = prepareIntlayer(config, {\n clean: isProduction,\n cacheTimeoutMs: isProduction ? 1000 * 30 : 1000 * 60 * 60,\n env: isProduction ? 'prod' : 'dev',\n });\n }\n\n await preparePromise;\n\n build.onStart(async () => {\n // Determine whether the watcher should run:\n // 1. Explicit option from the caller takes precedence\n // 2. If any esbuild context detected a production build, skip\n // 3. esbuild's own watch mode is a positive signal\n const shouldWatch = options?.watch ?? !isBuildMode;\n\n if (shouldWatch && !watcherStarted) {\n watcherStarted = true;\n\n await watch({ configuration: config! });\n }\n });\n },\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFA,MAAa,yBACX,YACkB;CAOlB,IAAI,SAAqD;CACzD,IAAI,QAAuC;CAG3C,IAAI,iBAAuC;CAC3C,IAAI,iBAAiB;CAGrB,IAAI,cAAc;CAElB,OAAO;EACL,MAAM;EAEN,MAAM,MAAM,OAAO;GACjB,IAAI,CAAC,QAAQ;IACX,MAAM,UACJ,MAAM,eAAe,iBACrB,SAAS,eAAe,WACxB,QAAQ,IAAI;IAEd,SAAS,iBAAiB;KAAE;KAAS,GAAG,SAAS;IAAc,CAAC;IAChE,iBAAiB;KAAE;KAAS,GAAG,SAAS;IAAc,CAAC;IAEvD,QAAQ,SAAS;KACf,eAAe;KACf,YAAY,UAAkB,KAAK,OAAQ,OAAO,SAAS,KAAK;IAClE,CAAC;GACH;GAEA,MAAM,YAAY,aAAa,MAAM;GACrC,MAAM,gBACJ,MAAM,eAAe,SAAS;GAKhC,MAAM,eACJ,kBAAkB,oBAClB,kBAAkB,kBAClB,MAAM,eAAe,WAAW,QAChC,MAAM,eAAe,SAAS,iBAAiB;GAEjD,IAAI,cACF,cAAc;GAGhB,MAAM,UAAkC;IACtC,UAAU;IACV,UAAU,eAAe,eAAe;GAC1C;GAEA,IAAI,cAAc;IAChB,MAAM,eAAe,gBAAgB,MAAM;IAC3C,IAAI,OAAO,KAAK,YAAY,EAAE,WAAW,GACvC,UAAU,2DAA2D,EACnE,WAAW,KACb,CAAC;IAGH,MAAM,kBAAkB,MAAM,wBAAwB,YAAY;IAClE,OAAO,OACL,SACA,uBAAuB,eAAe,GACtC,iBAAiB,MAAM,CACzB;GACF;GAEA,MAAM,eAAe,QAAQ;IAC3B,GAAG;IACH,GAAI,MAAM,eAAe,SAAS,CAAC;GACrC;GAEA,KAAK,MAAM,CAAC,MAAM,OAAO,OAAO,QAAQ,KAAM,GAAG;IAC/C,MAAM,cAAc,KAAK,QAAQ,uBAAuB,MAAM;IAE9D,MAAM,UAAU,EAAE,QAAQ,IAAI,OAAO,IAAI,YAAY,EAAE,EAAE,UAAU,EACjE,MAAM,GACR,EAAE;GACJ;GAEA,IAAI,CAAC,gBACH,iBAAiB,gBAAgB,QAAQ;IACvC,OAAO;IACP,gBAAgB,eAAe,MAAO,KAAK,MAAO,KAAK;IACvD,KAAK,eAAe,SAAS;GAC/B,CAAC;GAGH,MAAM;GAEN,MAAM,QAAQ,YAAY;IAOxB,KAFoB,SAAS,SAAS,CAAC,gBAEpB,CAAC,gBAAgB;KAClC,iBAAiB;KAEjB,MAAM,MAAM,EAAE,eAAe,OAAQ,CAAC;IACxC;GACF,CAAC;EACH;CACF;AACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { IInterpreterPluginState } from "../plugins.js";
|
|
2
|
-
import { Locale } from "../intlayer/dist/types/index.js";
|
|
3
2
|
import { DictionaryKeys, LocalesValues, StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
|
|
4
3
|
import { Dictionary } from "@intlayer/types/dictionary";
|
|
5
4
|
|
|
@@ -9,7 +8,7 @@ import { Dictionary } from "@intlayer/types/dictionary";
|
|
|
9
8
|
*
|
|
10
9
|
* If the locale is not provided, it will use the locale from the client context
|
|
11
10
|
*/
|
|
12
|
-
declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, locale?: LocalesValues) => import("@angular/core").Signal<import("@intlayer/core/interpreter").DeepTransformContent<T["content"], IInterpreterPluginState, Locale>>;
|
|
11
|
+
declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, locale?: LocalesValues) => import("@angular/core").Signal<import("@intlayer/core/interpreter").DeepTransformContent<T["content"], IInterpreterPluginState, import("@intlayer/types").Locale>>;
|
|
13
12
|
//#endregion
|
|
14
13
|
export { useDictionaryDynamic };
|
|
15
14
|
//# sourceMappingURL=useDictionaryDynamic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;AAmBA;cAAa,oBAAA,aACD,UAAA,YACA,cAAA,EAEV,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,aAAA,6BAAa,MAAA,sCAAA,oBAAA,CAAA,CAAA,aAAA,uBAAA,4BAAA,MAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Locale } from "../intlayer/dist/types/index.js";
|
|
2
1
|
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
3
2
|
|
|
4
3
|
//#region src/client/useLocaleStorage.d.ts
|
|
@@ -8,13 +7,13 @@ import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
|
8
7
|
/**
|
|
9
8
|
* Get the locale cookie
|
|
10
9
|
*/
|
|
11
|
-
declare const localeInStorage: Locale;
|
|
10
|
+
declare const localeInStorage: import("@intlayer/types").Locale;
|
|
12
11
|
/**
|
|
13
12
|
* @deprecated Use localeInStorage instead
|
|
14
13
|
*
|
|
15
14
|
* Get the locale cookie
|
|
16
15
|
*/
|
|
17
|
-
declare const localeCookie: Locale;
|
|
16
|
+
declare const localeCookie: import("@intlayer/types").Locale;
|
|
18
17
|
/**
|
|
19
18
|
* Set the locale cookie
|
|
20
19
|
*/
|
|
@@ -29,7 +28,7 @@ declare const setLocaleCookie: (locale: LocalesValues, isCookieEnabled: boolean)
|
|
|
29
28
|
* Hook that provides the locale storage and a function to set it
|
|
30
29
|
*/
|
|
31
30
|
declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
32
|
-
getLocale: () => Locale;
|
|
31
|
+
getLocale: () => import("@intlayer/types").Locale;
|
|
33
32
|
setLocale: (locale: LocalesValues) => void;
|
|
34
33
|
};
|
|
35
34
|
/**
|
|
@@ -40,7 +39,7 @@ declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
|
40
39
|
* Hook that provides the locale cookie and a function to set it
|
|
41
40
|
*/
|
|
42
41
|
declare const useLocaleCookie: (isCookieEnabled?: boolean) => {
|
|
43
|
-
localeCookie: Locale;
|
|
42
|
+
localeCookie: import("@intlayer/types").Locale;
|
|
44
43
|
setLocaleCookie: (locale: LocalesValues) => void;
|
|
45
44
|
};
|
|
46
45
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;AAcA;;;;cAAa,eAAA,4BAAe,MAAmD;AAM/E;;;;AAA2C;AAA3C,cAAa,YAAA,4BAAY,MAAkB;;;;cAK9B,kBAAA,GACX,MAAA,EAAQ,aAAa,EACrB,eAAA;;;;AAAwB;AAY1B;cAAa,eAAA,GAAe,MAAA,EAblB,aAAa,EAAA,eAAA;;;;cAkBV,gBAAA,GAAoB,eAAA;;sBAI7B,aAAA;AAAA;AAJJ;;;;;;;AAAA,cAaa,eAAA,GAAmB,eAAA;;4BAO/B,aAAA;AAAA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { GetConfigurationOptions } from "@intlayer/config/node";
|
|
2
|
+
|
|
3
|
+
//#region src/esbuild/plugin.d.ts
|
|
4
|
+
interface EsbuildPluginBuild {
|
|
5
|
+
initialOptions: {
|
|
6
|
+
alias?: Record<string, string>;
|
|
7
|
+
define?: Record<string, string>;
|
|
8
|
+
minify?: boolean;
|
|
9
|
+
watch?: unknown; /** Absolute working directory of the esbuild context (set by Angular's builder). */
|
|
10
|
+
absWorkingDir?: string;
|
|
11
|
+
};
|
|
12
|
+
onStart(callback: () => void | Promise<void>): void;
|
|
13
|
+
/** Intercept module resolution — works even for imports inside node_modules. */
|
|
14
|
+
onResolve(options: {
|
|
15
|
+
filter: RegExp;
|
|
16
|
+
namespace?: string;
|
|
17
|
+
}, callback: (args: {
|
|
18
|
+
path: string;
|
|
19
|
+
importer: string;
|
|
20
|
+
namespace: string;
|
|
21
|
+
resolveDir: string;
|
|
22
|
+
}) => {
|
|
23
|
+
path: string;
|
|
24
|
+
namespace?: string;
|
|
25
|
+
} | null | undefined): void;
|
|
26
|
+
}
|
|
27
|
+
interface EsbuildPlugin {
|
|
28
|
+
name: string;
|
|
29
|
+
setup(build: EsbuildPluginBuild): void | Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
type IntlayerEsbuildPluginOptions = {
|
|
32
|
+
configOptions?: GetConfigurationOptions;
|
|
33
|
+
/**
|
|
34
|
+
* Whether to start the Intlayer file watcher for dictionary regeneration.
|
|
35
|
+
* - `true`: always start the watcher (useful for `ng serve`)
|
|
36
|
+
* - `false`: never start the watcher (useful for `ng build`)
|
|
37
|
+
* - `undefined` (default): auto-detect based on the build context
|
|
38
|
+
* (skips the watcher when a production build is detected)
|
|
39
|
+
*/
|
|
40
|
+
watch?: boolean;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* esbuild plugin that integrates Intlayer into the Angular (or any esbuild-based) build process.
|
|
44
|
+
*
|
|
45
|
+
* Handles:
|
|
46
|
+
* 1. Injecting `alias` entries so `@intlayer/dictionaries-entry` etc. resolve to
|
|
47
|
+
* the generated files under `.intlayer/`.
|
|
48
|
+
* 2. Defining `process.env.*` tree-shaking constants for production builds.
|
|
49
|
+
* 3. Running `prepareIntlayer` (dictionary generation) before the first build.
|
|
50
|
+
* 4. Starting the chokidar file-watcher in dev / serve mode.
|
|
51
|
+
*
|
|
52
|
+
* Compatible with:
|
|
53
|
+
* - `@angular-builders/custom-esbuild` (`application` or `browser-esbuild` builder)
|
|
54
|
+
* - NX `@nx/angular:browser-esbuild`
|
|
55
|
+
* - Any raw esbuild setup that accepts the standard `Plugin` interface
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* // esbuild.plugins.ts (referenced from angular.json "plugins" option)
|
|
60
|
+
* import { intlayerEsbuildPlugin } from 'angular-intlayer/esbuild';
|
|
61
|
+
* export default [intlayerEsbuildPlugin()];
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
declare const intlayerEsbuildPlugin: (options?: IntlayerEsbuildPluginOptions) => EsbuildPlugin;
|
|
65
|
+
//#endregion
|
|
66
|
+
export { EsbuildPlugin, EsbuildPluginBuild, IntlayerEsbuildPluginOptions, intlayerEsbuildPlugin };
|
|
67
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","names":[],"sources":["../../../src/esbuild/plugin.ts"],"mappings":";;;UAoBiB,kBAAA;EACf,cAAA;IACE,KAAA,GAAQ,MAAA;IACR,MAAA,GAAS,MAAA;IACT,MAAA;IACA,KAAA,YAFS;IAIT,aAAA;EAAA;EAEF,OAAA,CAAQ,QAAA,eAAuB,OAAA;EAGJ;EAD3B,SAAA,CACE,OAAA;IAAW,MAAA,EAAQ,MAAA;IAAQ,SAAA;EAAA,GAC3B,QAAA,GAAW,IAAA;IACT,IAAA;IACA,QAAA;IACA,SAAA;IACA,UAAA;EAAA;IACM,IAAA;IAAc,SAAA;EAAA;AAAA;AAAA,UAIT,aAAA;EACf,IAAA;EACA,KAAA,CAAM,KAAA,EAAO,kBAAA,UAA4B,OAAO;AAAA;AAAA,KAGtC,4BAAA;EACV,aAAA,GAAgB,uBAAuB;EAXnC;;;;;;AAC2D;EAkB/D,KAAA;AAAA;;;;;;;;;AAZgD;AAGlD;;;;;;;;AASO;AAyBP;;;;cAAa,qBAAA,GACX,OAAA,GAAU,4BAAA,KACT,aAgHF"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
|
-
|
|
3
1
|
//#region src/format/useCompact.d.ts
|
|
4
2
|
declare const useCompact: () => import("@angular/core").Signal<(value: string | number, options?: Intl.NumberFormatOptions & {
|
|
5
|
-
locale?: LocalesValues;
|
|
3
|
+
locale?: import("@intlayer/types").LocalesValues;
|
|
6
4
|
}) => string>;
|
|
7
5
|
//#endregion
|
|
8
6
|
export { useCompact };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCompact.d.ts","names":[],"sources":["../../../src/format/useCompact.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCompact.d.ts","names":[],"sources":["../../../src/format/useCompact.ts"],"mappings":";cAIa,UAAA,gCAAU,MAAA,EAAA,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
|
-
|
|
3
1
|
//#region src/format/useCurrency.d.ts
|
|
4
2
|
declare const useCurrency: () => import("@angular/core").Signal<(value: string | number, options?: Intl.NumberFormatOptions & {
|
|
5
|
-
locale?: LocalesValues;
|
|
3
|
+
locale?: import("@intlayer/types").LocalesValues;
|
|
6
4
|
}) => string>;
|
|
7
5
|
//#endregion
|
|
8
6
|
export { useCurrency };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrency.d.ts","names":[],"sources":["../../../src/format/useCurrency.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCurrency.d.ts","names":[],"sources":["../../../src/format/useCurrency.ts"],"mappings":";cAIa,WAAA,gCAAW,MAAA,EAAA,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
|
-
|
|
3
1
|
//#region src/format/useDate.d.ts
|
|
4
2
|
/**
|
|
5
3
|
* Angular client hook that provides a localized date/time formatter.
|
|
6
4
|
*/
|
|
7
5
|
declare const useDate: () => import("@angular/core").Signal<(date: string | number | Date, options?: (Intl.DateTimeFormatOptions & {
|
|
8
|
-
locale?: LocalesValues;
|
|
6
|
+
locale?: import("@intlayer/types").LocalesValues;
|
|
9
7
|
}) | import("@intlayer/core/formatters").DateTimePreset) => string>;
|
|
10
8
|
//#endregion
|
|
11
9
|
export { useDate };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDate.d.ts","names":[],"sources":["../../../src/format/useDate.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDate.d.ts","names":[],"sources":["../../../src/format/useDate.ts"],"mappings":";;AAOA;;cAAa,OAAA,gCAAO,MAAA,EAAA,IAAA,oBAAA,IAAA,EAAA,OAAA,IAAA,IAAA,CAAA,qBAAA"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
|
-
|
|
3
1
|
//#region src/format/useList.d.ts
|
|
4
2
|
declare const useList: () => import("@angular/core").Signal<(values: (string | number)[], options?: {
|
|
5
3
|
localeMatcher?: "lookup" | "best fit";
|
|
6
4
|
type?: "conjunction" | "disjunction" | "unit";
|
|
7
5
|
style?: "long" | "short" | "narrow";
|
|
8
6
|
} & {
|
|
9
|
-
locale?: LocalesValues;
|
|
7
|
+
locale?: import("@intlayer/types").LocalesValues;
|
|
10
8
|
}) => string>;
|
|
11
9
|
//#endregion
|
|
12
10
|
export { useList };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useList.d.ts","names":[],"sources":["../../../src/format/useList.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useList.d.ts","names":[],"sources":["../../../src/format/useList.ts"],"mappings":";cAIa,OAAA,gCAAO,MAAA,EAAA,MAAA,uBAAA,OAAA"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
|
-
|
|
3
1
|
//#region src/format/useNumber.d.ts
|
|
4
2
|
/**
|
|
5
3
|
* Angular client hook that provides a localized number formatter.
|
|
6
4
|
*/
|
|
7
5
|
declare const useNumber: () => import("@angular/core").Signal<(value: string | number, args_1?: Intl.NumberFormatOptions & {
|
|
8
|
-
locale?: LocalesValues;
|
|
6
|
+
locale?: import("@intlayer/types").LocalesValues;
|
|
9
7
|
}) => string>;
|
|
10
8
|
//#endregion
|
|
11
9
|
export { useNumber };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../src/format/useNumber.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../src/format/useNumber.ts"],"mappings":";;AAOA;;cAAa,SAAA,gCAAS,MAAA,EAAA,KAAA,mBAAA,MAAA,GAAA,IAAA,CAAA,mBAAA"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
|
-
|
|
3
1
|
//#region src/format/usePercentage.d.ts
|
|
4
2
|
declare const usePercentage: () => import("@angular/core").Signal<(value: string | number, args_1?: Intl.NumberFormatOptions & {
|
|
5
|
-
locale?: LocalesValues;
|
|
3
|
+
locale?: import("@intlayer/types").LocalesValues;
|
|
6
4
|
}) => string>;
|
|
7
5
|
//#endregion
|
|
8
6
|
export { usePercentage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../src/format/usePercentage.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../src/format/usePercentage.ts"],"mappings":";cAIa,aAAA,gCAAa,MAAA,EAAA,KAAA,mBAAA,MAAA,GAAA,IAAA,CAAA,mBAAA"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
|
-
|
|
3
1
|
//#region src/format/useRelativeTime.d.ts
|
|
4
2
|
declare const useRelativeTime: () => import("@angular/core").Signal<(from: string | number | Date, to?: string | number | Date, options?: Intl.RelativeTimeFormatOptions & {
|
|
5
|
-
locale?: LocalesValues;
|
|
3
|
+
locale?: import("@intlayer/types").LocalesValues;
|
|
6
4
|
unit?: Intl.RelativeTimeFormatUnit;
|
|
7
5
|
}) => string>;
|
|
8
6
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../src/format/useRelativeTime.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../src/format/useRelativeTime.ts"],"mappings":";cAIa,eAAA,gCAAe,MAAA,EAAA,IAAA,oBAAA,IAAA,EAAA,EAAA,qBAAA,IAAA,EAAA,OAAA,GAAA,IAAA,CAAA,yBAAA"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
|
-
|
|
3
1
|
//#region src/format/useUnit.d.ts
|
|
4
2
|
declare const useUnit: () => import("@angular/core").Signal<(value: string | number, options?: Intl.NumberFormatOptions & {
|
|
5
|
-
locale?: LocalesValues;
|
|
3
|
+
locale?: import("@intlayer/types").LocalesValues;
|
|
6
4
|
}) => string>;
|
|
7
5
|
//#endregion
|
|
8
6
|
export { useUnit };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../src/format/useUnit.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../src/format/useUnit.ts"],"mappings":";cAIa,OAAA,gCAAO,MAAA,EAAA,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "angular-intlayer",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.11.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Angular applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -59,6 +59,11 @@
|
|
|
59
59
|
"require": "./dist/cjs/webpack/index.cjs",
|
|
60
60
|
"import": "./dist/esm/webpack/index.mjs"
|
|
61
61
|
},
|
|
62
|
+
"./esbuild": {
|
|
63
|
+
"types": "./dist/types/esbuild/index.d.ts",
|
|
64
|
+
"require": "./dist/cjs/esbuild/index.cjs",
|
|
65
|
+
"import": "./dist/esm/esbuild/index.mjs"
|
|
66
|
+
},
|
|
62
67
|
"./package.json": "./package.json"
|
|
63
68
|
},
|
|
64
69
|
"main": "dist/cjs/index.cjs",
|
|
@@ -81,6 +86,9 @@
|
|
|
81
86
|
"webpack": [
|
|
82
87
|
"./dist/types/webpack/index.d.ts"
|
|
83
88
|
],
|
|
89
|
+
"esbuild": [
|
|
90
|
+
"./dist/types/esbuild/index.d.ts"
|
|
91
|
+
],
|
|
84
92
|
"package.json": [
|
|
85
93
|
"./package.json"
|
|
86
94
|
]
|
|
@@ -110,13 +118,13 @@
|
|
|
110
118
|
"dependencies": {
|
|
111
119
|
"@babel/plugin-syntax-import-attributes": "^7.28.6",
|
|
112
120
|
"@babel/preset-env": "^7.29.2",
|
|
113
|
-
"@intlayer/chokidar": "8.
|
|
114
|
-
"@intlayer/config": "8.
|
|
115
|
-
"@intlayer/core": "8.
|
|
116
|
-
"@intlayer/dictionaries-entry": "8.
|
|
117
|
-
"@intlayer/editor": "8.
|
|
118
|
-
"@intlayer/types": "8.
|
|
119
|
-
"@intlayer/webpack": "8.
|
|
121
|
+
"@intlayer/chokidar": "8.11.0",
|
|
122
|
+
"@intlayer/config": "8.11.0",
|
|
123
|
+
"@intlayer/core": "8.11.0",
|
|
124
|
+
"@intlayer/dictionaries-entry": "8.11.0",
|
|
125
|
+
"@intlayer/editor": "8.11.0",
|
|
126
|
+
"@intlayer/types": "8.11.0",
|
|
127
|
+
"@intlayer/webpack": "8.11.0",
|
|
120
128
|
"babel-loader": "^10.1.1",
|
|
121
129
|
"defu": "6.1.7"
|
|
122
130
|
},
|
|
@@ -126,6 +134,7 @@
|
|
|
126
134
|
"@utils/ts-config": "1.0.4",
|
|
127
135
|
"@utils/ts-config-types": "1.0.4",
|
|
128
136
|
"@utils/tsdown-config": "1.0.4",
|
|
137
|
+
"esbuild": "0.28.0",
|
|
129
138
|
"rimraf": "6.1.3",
|
|
130
139
|
"tsdown": "0.22.00",
|
|
131
140
|
"typescript": "6.0.3",
|
|
@@ -134,8 +143,14 @@
|
|
|
134
143
|
"peerDependencies": {
|
|
135
144
|
"@angular/common": ">=15",
|
|
136
145
|
"@angular/core": ">=15",
|
|
146
|
+
"esbuild": ">=0.17",
|
|
137
147
|
"rxjs": "6.0.0 || ^7.0.0"
|
|
138
148
|
},
|
|
149
|
+
"peerDependenciesMeta": {
|
|
150
|
+
"esbuild": {
|
|
151
|
+
"optional": true
|
|
152
|
+
}
|
|
153
|
+
},
|
|
139
154
|
"engines": {
|
|
140
155
|
"node": ">=14.18"
|
|
141
156
|
},
|