@gtkx/config 2.0.0-beta.11 → 2.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/builtin-elements.d.ts +23 -0
- package/dist/builtin-elements.d.ts.map +1 -0
- package/dist/builtin-elements.js +366 -0
- package/dist/builtin-elements.js.map +1 -0
- package/dist/config-dependencies.d.ts +5 -3
- package/dist/config-dependencies.d.ts.map +1 -1
- package/dist/config-dependencies.js +54 -22
- package/dist/config-dependencies.js.map +1 -1
- package/dist/config-error.d.ts.map +1 -1
- package/dist/config-error.js.map +1 -1
- package/dist/config-reloader.d.ts.map +1 -1
- package/dist/config-reloader.js +2 -8
- package/dist/config-reloader.js.map +1 -1
- package/dist/config-source.d.ts +4 -2
- package/dist/config-source.d.ts.map +1 -1
- package/dist/config-source.js +26 -8
- package/dist/config-source.js.map +1 -1
- package/dist/config.d.ts +159 -45
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +28 -19
- package/dist/config.js.map +1 -1
- package/dist/deploy.d.ts +391 -13
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +16 -13
- package/dist/deploy.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +3 -3
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +3 -3
- package/dist/internal.js.map +1 -1
- package/dist/loader.d.ts +22 -4
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +59 -31
- package/dist/loader.js.map +1 -1
- package/dist/resource-base-path.d.ts.map +1 -1
- package/dist/schema-text.d.ts.map +1 -1
- package/dist/user-event-signals.d.ts.map +1 -1
- package/dist/virtual.d.ts +1 -1
- package/dist/virtual.d.ts.map +1 -1
- package/dist/virtual.js +4 -2
- package/dist/virtual.js.map +1 -1
- package/dist/vite-plugin.d.ts +2 -0
- package/dist/vite-plugin.d.ts.map +1 -1
- package/dist/vite-plugin.js +4 -3
- package/dist/vite-plugin.js.map +1 -1
- package/dist/vite-root.d.ts.map +1 -1
- package/package.json +14 -29
- package/src/builtin-elements.ts +377 -0
- package/src/config-dependencies.ts +61 -27
- package/src/config-error.ts +5 -3
- package/src/config-reloader.ts +2 -11
- package/src/config-source.ts +35 -8
- package/src/config.ts +189 -39
- package/src/deploy.ts +471 -55
- package/src/index.ts +42 -3
- package/src/internal.ts +3 -2
- package/src/loader.ts +106 -37
- package/src/virtual.ts +6 -4
- package/src/vite-plugin.ts +9 -2
- package/dist/static-dependencies.d.ts +0 -3
- package/dist/static-dependencies.d.ts.map +0 -1
- package/dist/static-dependencies.js +0 -350
- package/dist/static-dependencies.js.map +0 -1
- package/src/static-dependencies.ts +0 -464
package/src/index.ts
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export {
|
|
2
|
+
type AgentsOptions,
|
|
3
|
+
type ApplicationConfig,
|
|
4
|
+
type Config,
|
|
5
|
+
defineConfig,
|
|
6
|
+
type DeprecationsOptions,
|
|
7
|
+
type ElementConfigOptions,
|
|
8
|
+
type ElementPropsExport,
|
|
9
|
+
type ElementsOptions,
|
|
10
|
+
type McpOptions,
|
|
11
|
+
mergeConfig,
|
|
12
|
+
type ModuleExport,
|
|
13
|
+
type ReactCompilerOptions,
|
|
14
|
+
type ResolvedConfig,
|
|
15
|
+
} from "./config.ts";
|
|
16
|
+
export {
|
|
17
|
+
type DeployAppImageOptions,
|
|
18
|
+
type DeployAppImageSigningOptions,
|
|
19
|
+
type DeployBrandingOptions,
|
|
20
|
+
type DeployDebOptions,
|
|
21
|
+
type DeployDebPackageRelationOptions,
|
|
22
|
+
type DeployDebSigningOptions,
|
|
23
|
+
type DeployDesktopActionOptions,
|
|
24
|
+
type DeployDeveloperOptions,
|
|
25
|
+
type DeployExtraFileOptions,
|
|
26
|
+
type DeployFileAssociationOptions,
|
|
27
|
+
type DeployFlatpakOptions,
|
|
28
|
+
type DeployFlatpakSigningOptions,
|
|
29
|
+
type DeployFlatpakSourceOptions,
|
|
30
|
+
type DeployNodeOptions,
|
|
31
|
+
type DeployOptions,
|
|
32
|
+
type DeployPackageRelationOptions,
|
|
33
|
+
type DeployRelationsOptions,
|
|
34
|
+
type DeployReleaseOptions,
|
|
35
|
+
type DeployRpmOptions,
|
|
36
|
+
type DeployRpmSigningOptions,
|
|
37
|
+
type DeployScreenshotOptions,
|
|
38
|
+
type DeployScriptsOptions,
|
|
39
|
+
type DeploySigningOptions,
|
|
40
|
+
type DeployToolsOptions,
|
|
41
|
+
} from "./deploy.ts";
|
|
42
|
+
export { type ConfigLoader, type LoadConfigOptions, type LoadedConfig, loadConfig } from "./loader.ts";
|
package/src/internal.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
export { configDependenciesFor } from "./config-dependencies.ts";
|
|
1
|
+
export { configDependenciesFor, loadConfigModule } from "./config-dependencies.ts";
|
|
2
2
|
export { createConfigReloader } from "./config-reloader.ts";
|
|
3
|
+
export { configCandidatePaths } from "./config-source.ts";
|
|
3
4
|
export type { McpSettings, ResolvedReactCompilerOptions } from "./config.ts";
|
|
4
5
|
export {
|
|
5
6
|
APPLICATION_ID_MAX_LENGTH,
|
|
6
7
|
isAgentReferenceEnabled,
|
|
7
8
|
isAgentRulesEnabled,
|
|
8
9
|
isValidApplicationId,
|
|
10
|
+
LIBRARY_APPLICATION_ID,
|
|
9
11
|
resolveAcceptedChildTypes,
|
|
10
12
|
resolveElementComponents,
|
|
11
13
|
resolveElementProps,
|
|
@@ -17,4 +19,3 @@ export { createConfigLoader } from "./loader.ts";
|
|
|
17
19
|
export { assertSupportedNodeVersion, DEFAULT_NODE_VERSION, MINIMUM_NODE_VERSION } from "./node-version.ts";
|
|
18
20
|
export { resourceBasePath } from "./resource-base-path.ts";
|
|
19
21
|
export { viteProjectRoot } from "./vite-root.ts";
|
|
20
|
-
export { SUPPORTED_EXTENSIONS as CONFIG_EXTENSIONS } from "c12";
|
package/src/loader.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { isPathInside, warn } from "@gtkx/utils";
|
|
2
2
|
import { loadConfig as loadConfigFile } from "c12";
|
|
3
|
+
import { defu } from "defu";
|
|
3
4
|
import { existsSync } from "node:fs";
|
|
4
5
|
import { relative, resolve } from "node:path";
|
|
5
6
|
import {
|
|
7
|
+
addConfigSource,
|
|
6
8
|
captureConfigDependencies,
|
|
9
|
+
createConfigImporter,
|
|
7
10
|
setConfigDependencies,
|
|
8
|
-
transformConfigModule,
|
|
9
11
|
} from "./config-dependencies.ts";
|
|
10
|
-
import { missingConfigFileError } from "./config-error.ts";
|
|
11
|
-
import { type ConfigResolutionOptions,
|
|
12
|
+
import { isRecord, missingConfigFileError } from "./config-error.ts";
|
|
13
|
+
import { configCandidatePaths, type ConfigResolutionOptions, localConfigSourcePaths } from "./config-source.ts";
|
|
12
14
|
import {
|
|
15
|
+
type ApplicationConfig,
|
|
13
16
|
type Config,
|
|
14
17
|
graduatedFutureKeys,
|
|
15
18
|
resolveConfig,
|
|
@@ -20,12 +23,22 @@ import { assertSupportedNodeVersion } from "./node-version.ts";
|
|
|
20
23
|
|
|
21
24
|
/** Result of loading a project's `gtkx.config.ts` file. */
|
|
22
25
|
type LoadedConfig = {
|
|
23
|
-
/** The parsed and validated configuration. */
|
|
24
|
-
config:
|
|
25
|
-
/**
|
|
26
|
+
/** The parsed and validated configuration, with the default application ID filled in when one stood in. */
|
|
27
|
+
config: ApplicationConfig;
|
|
28
|
+
/** Whether the configuration names its own `applicationId`, rather than a default standing in for it. */
|
|
29
|
+
isApplication: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Absolute path of the configuration file that was loaded, or of `gtkx.config.ts` in the project root
|
|
32
|
+
* when a default application ID stood in for a missing file.
|
|
33
|
+
*/
|
|
26
34
|
configFile: string;
|
|
27
35
|
/** Absolute path of the project root the configuration was resolved against. */
|
|
28
36
|
root: string;
|
|
37
|
+
/**
|
|
38
|
+
* The gettext domain: the `applicationId` production builds use, so a `$development` application ID
|
|
39
|
+
* shares the production catalogs.
|
|
40
|
+
*/
|
|
41
|
+
translationDomain: string;
|
|
29
42
|
};
|
|
30
43
|
|
|
31
44
|
/** How a configuration file is read, shared by {@link loadConfig} and `createConfigLoader`. */
|
|
@@ -35,6 +48,14 @@ type LoadConfigOptions = {
|
|
|
35
48
|
* top-level values, and the name is passed to a config authored as a function.
|
|
36
49
|
*/
|
|
37
50
|
mode?: string | undefined;
|
|
51
|
+
/** Whether to report graduated future flags; supervising processes can own these warnings. Defaults to true. */
|
|
52
|
+
shouldWarnGraduatedFuture?: boolean | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Application ID for a project that is not an application, such as a component library running its
|
|
55
|
+
* tests: it stands in for a missing `applicationId`, and for a missing configuration file unless
|
|
56
|
+
* `configFile` names a file other than `gtkx.config.ts` in the project root.
|
|
57
|
+
*/
|
|
58
|
+
defaultApplicationId?: string | undefined;
|
|
38
59
|
} & Partial<Record<"configFile", string | undefined>>;
|
|
39
60
|
|
|
40
61
|
/** Reads a project's configuration once per directory, caching what it loads and what it resolves. */
|
|
@@ -45,14 +66,54 @@ type ConfigLoader = {
|
|
|
45
66
|
resolve: (cwd: string) => Promise<ResolvedConfig>;
|
|
46
67
|
};
|
|
47
68
|
|
|
48
|
-
const GRADUATED_FUTURE_ENV = "GTKX_GRADUATED_FUTURE_SHOWN";
|
|
49
69
|
const graduatedFutureWarnings: Map<string, string> = new Map();
|
|
70
|
+
const PRODUCTION_MODE = "production";
|
|
71
|
+
const EXTEND_KEY = "extends";
|
|
72
|
+
const DEFAULT_CONFIG_FILE_NAME = "gtkx.config.ts";
|
|
73
|
+
|
|
74
|
+
const recordOrEmpty = (value: unknown): Record<string, unknown> => (isRecord(value) ? value : {});
|
|
75
|
+
|
|
76
|
+
const modeOverrides = (layer: Record<string, unknown>, mode: string): Record<string, unknown> => ({
|
|
77
|
+
...recordOrEmpty(layer[`$${mode}`]),
|
|
78
|
+
...recordOrEmpty(recordOrEmpty(layer.$env)[mode]),
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const configForMode = (layers: Record<string, unknown>[], mode: string | undefined): Record<string, unknown> => {
|
|
82
|
+
const merged: Record<string, unknown> = defu(
|
|
83
|
+
{},
|
|
84
|
+
...layers.map((layer) => (mode ? defu(modeOverrides(layer, mode), layer) : layer)),
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
for (const key of Object.keys(merged)) {
|
|
88
|
+
if (key === EXTEND_KEY || key.startsWith("$")) {
|
|
89
|
+
Reflect.deleteProperty(merged, key);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return merged;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const productionApplicationId = (layers: Record<string, unknown>[], config: ApplicationConfig): string => {
|
|
97
|
+
const { applicationId } = configForMode(layers, PRODUCTION_MODE);
|
|
98
|
+
|
|
99
|
+
return typeof applicationId === "string" ? applicationId : config.applicationId;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const withDefaultApplicationId = (
|
|
103
|
+
config: Record<string, unknown>,
|
|
104
|
+
applicationId: string | undefined,
|
|
105
|
+
): Record<string, unknown> =>
|
|
106
|
+
applicationId === undefined || config.applicationId !== undefined ? config : { ...config, applicationId };
|
|
50
107
|
|
|
51
108
|
const rejectMissingLocalConfig = (source: string, options: ConfigResolutionOptions): undefined => {
|
|
52
|
-
const
|
|
109
|
+
const paths = localConfigSourcePaths(source, options);
|
|
53
110
|
|
|
54
|
-
|
|
55
|
-
|
|
111
|
+
for (const path of paths) {
|
|
112
|
+
addConfigSource(path);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (paths.length > 0 && !paths.some((path) => existsSync(path))) {
|
|
116
|
+
throw new Error(`Extended configuration ${source} does not exist in ${options.cwd ?? process.cwd()}`);
|
|
56
117
|
}
|
|
57
118
|
};
|
|
58
119
|
|
|
@@ -82,20 +143,20 @@ const selectedConfigFile = (root: string, configured: string | undefined): strin
|
|
|
82
143
|
return relative(root, path);
|
|
83
144
|
};
|
|
84
145
|
|
|
146
|
+
const explicitConfigFile = (root: string, selected: string | undefined): string | undefined =>
|
|
147
|
+
selected !== undefined && configCandidatePaths(root).find((path) => existsSync(path)) === resolve(root, selected)
|
|
148
|
+
? undefined
|
|
149
|
+
: selected;
|
|
150
|
+
|
|
85
151
|
const warnGraduatedFuture = (config: unknown, root: string): void => {
|
|
86
152
|
const keys = graduatedFutureKeys(config);
|
|
87
153
|
const signature = keys.join(",");
|
|
88
154
|
|
|
89
|
-
if (
|
|
90
|
-
keys.length === 0 ||
|
|
91
|
-
graduatedFutureWarnings.get(root) === signature ||
|
|
92
|
-
process.env[GRADUATED_FUTURE_ENV] === signature
|
|
93
|
-
) {
|
|
155
|
+
if (keys.length === 0 || graduatedFutureWarnings.get(root) === signature) {
|
|
94
156
|
return;
|
|
95
157
|
}
|
|
96
158
|
|
|
97
159
|
graduatedFutureWarnings.set(root, signature);
|
|
98
|
-
process.env[GRADUATED_FUTURE_ENV] = signature;
|
|
99
160
|
warn(`GTKX 2 ignores graduated future flags: ${keys.join(", ")}. Remove them from gtkx.config.ts.`);
|
|
100
161
|
};
|
|
101
162
|
|
|
@@ -109,6 +170,7 @@ const loadConfig = async (cwd: string, options: LoadConfigOptions = {}): Promise
|
|
|
109
170
|
assertSupportedNodeVersion();
|
|
110
171
|
const searched = resolve(cwd);
|
|
111
172
|
const requestedConfigFile = selectedConfigFile(searched, options.configFile);
|
|
173
|
+
const c12ConfigFile = explicitConfigFile(searched, requestedConfigFile);
|
|
112
174
|
|
|
113
175
|
const captured = await captureConfigDependencies(() =>
|
|
114
176
|
loadConfigFile<Config>({
|
|
@@ -117,40 +179,47 @@ const loadConfig = async (cwd: string, options: LoadConfigOptions = {}): Promise
|
|
|
117
179
|
rcFile: false,
|
|
118
180
|
globalRc: false,
|
|
119
181
|
packageJson: false,
|
|
120
|
-
|
|
182
|
+
envName: false,
|
|
121
183
|
context: { mode: options.mode },
|
|
122
|
-
|
|
184
|
+
jiti: createConfigImporter(),
|
|
123
185
|
resolve: rejectMissingLocalConfig,
|
|
124
|
-
...(
|
|
125
|
-
|
|
126
|
-
|
|
186
|
+
...(c12ConfigFile !== undefined && { configFile: c12ConfigFile }),
|
|
187
|
+
}),
|
|
188
|
+
);
|
|
127
189
|
const result = captured.value;
|
|
128
190
|
|
|
129
191
|
const configFile = result.configFile;
|
|
130
192
|
const root = result.cwd ?? searched;
|
|
131
|
-
const layerFiles = (result.layers ?? [])
|
|
132
|
-
.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
193
|
+
const layerFiles = (result.layers ?? []).flatMap((layer) =>
|
|
194
|
+
layer.configFile === undefined ? [] : [resolve(layer.cwd ?? root, layer.configFile)],
|
|
195
|
+
);
|
|
196
|
+
const dependencies = [...(configFile === undefined ? [] : [configFile]), ...layerFiles, ...captured.dependencies];
|
|
197
|
+
const foundConfigFile =
|
|
198
|
+
configFile !== undefined && existsSync(resolve(searched, configFile)) ? configFile : undefined;
|
|
199
|
+
const isConfigFileOptional =
|
|
200
|
+
options.defaultApplicationId !== undefined &&
|
|
201
|
+
(requestedConfigFile === undefined || requestedConfigFile === DEFAULT_CONFIG_FILE_NAME);
|
|
140
202
|
|
|
141
203
|
return withConfigDependencies(dependencies, () => {
|
|
142
|
-
if (
|
|
204
|
+
if (foundConfigFile === undefined && !isConfigFileOptional) {
|
|
143
205
|
throw missingConfigFileError(searched, requestedConfigFile);
|
|
144
206
|
}
|
|
145
207
|
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
208
|
+
const layers = (result.layers ?? []).flatMap((layer) => (isRecord(layer.config) ? [layer.config] : []));
|
|
209
|
+
const authored = configForMode(layers, options.mode ?? process.env.NODE_ENV);
|
|
210
|
+
const config = withDefaultApplicationId(authored, options.defaultApplicationId);
|
|
211
|
+
const loadedConfigFile = foundConfigFile ?? resolve(searched, DEFAULT_CONFIG_FILE_NAME);
|
|
212
|
+
validateConfig(config, loadedConfigFile);
|
|
213
|
+
if (options.shouldWarnGraduatedFuture !== false) {
|
|
214
|
+
warnGraduatedFuture(config, root);
|
|
215
|
+
}
|
|
149
216
|
|
|
150
217
|
const loaded = {
|
|
151
218
|
config,
|
|
152
|
-
|
|
219
|
+
isApplication: authored.applicationId !== undefined,
|
|
220
|
+
configFile: loadedConfigFile,
|
|
153
221
|
root,
|
|
222
|
+
translationDomain: productionApplicationId(layers, config),
|
|
154
223
|
};
|
|
155
224
|
setConfigDependencies(loaded, dependencies);
|
|
156
225
|
|
|
@@ -167,9 +236,9 @@ const createConfigLoader = (options: LoadConfigOptions = {}): ConfigLoader => {
|
|
|
167
236
|
loaded.getOrInsertComputed(resolve(cwd), (root) => loadConfig(root, options));
|
|
168
237
|
|
|
169
238
|
const resolveAt = async (root: string): Promise<ResolvedConfig> => {
|
|
170
|
-
const { config, root: configRoot } = await load(root);
|
|
239
|
+
const { config, root: configRoot, translationDomain } = await load(root);
|
|
171
240
|
|
|
172
|
-
return resolveConfig(config, configRoot);
|
|
241
|
+
return resolveConfig(config, translationDomain, configRoot);
|
|
173
242
|
};
|
|
174
243
|
|
|
175
244
|
return {
|
package/src/virtual.ts
CHANGED
|
@@ -4,20 +4,22 @@ import { resourceBasePath } from "./resource-base-path.ts";
|
|
|
4
4
|
const GTKX_CONFIG_VIRTUAL_ID = "virtual:gtkx-config";
|
|
5
5
|
const RESOLVED_GTKX_CONFIG_VIRTUAL_ID = `\0${GTKX_CONFIG_VIRTUAL_ID}`;
|
|
6
6
|
|
|
7
|
-
const renderConfigModule = (config: ResolvedConfig): string => {
|
|
7
|
+
const renderConfigModule = (config: ResolvedConfig, localeDir: string | null = null): string => {
|
|
8
8
|
const lazyJson = JSON.stringify(Object.fromEntries(config.lazyElements.map((type) => [type, { isLazy: true }])));
|
|
9
9
|
|
|
10
10
|
const behaviorImports =
|
|
11
11
|
config.elements === null
|
|
12
12
|
? []
|
|
13
13
|
: [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
'import { mergeElementConfigs } from "@gtkx/react/config";',
|
|
15
|
+
`import __elementBehaviors from ${JSON.stringify(config.elements)};`,
|
|
16
|
+
];
|
|
17
17
|
|
|
18
18
|
return [
|
|
19
19
|
...behaviorImports,
|
|
20
20
|
`export const applicationId = ${JSON.stringify(config.applicationId)};`,
|
|
21
|
+
`export const translationDomain = ${JSON.stringify(config.translationDomain)};`,
|
|
22
|
+
`export const localeDir = ${JSON.stringify(localeDir)};`,
|
|
21
23
|
`export const resourceBasePath = ${JSON.stringify(resourceBasePath(config.applicationId))};`,
|
|
22
24
|
`export const userEventSignals = ${JSON.stringify(config.userEventSignals)};`,
|
|
23
25
|
config.elements === null
|
package/src/vite-plugin.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Plugin, UserConfig } from "vite";
|
|
2
|
+
import { resolve } from "node:path";
|
|
2
3
|
import { type ConfigLoader, createConfigLoader } from "./loader.ts";
|
|
3
4
|
import { GTKX_CONFIG_VIRTUAL_ID, renderConfigModule, RESOLVED_GTKX_CONFIG_VIRTUAL_ID } from "./virtual.ts";
|
|
4
5
|
import { viteProjectRoot } from "./vite-root.ts";
|
|
@@ -17,12 +18,16 @@ const loadVirtualModule = async (
|
|
|
17
18
|
id: string,
|
|
18
19
|
loadConfig: ConfigLoader,
|
|
19
20
|
state: PluginState,
|
|
21
|
+
localeDir: string | null | undefined,
|
|
20
22
|
): Promise<string | undefined> => {
|
|
21
23
|
if (id !== RESOLVED_GTKX_CONFIG_VIRTUAL_ID) {
|
|
22
24
|
return undefined;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
return renderConfigModule(
|
|
27
|
+
return renderConfigModule(
|
|
28
|
+
await loadConfig.resolve(state.root),
|
|
29
|
+
localeDir == null ? null : resolve(state.root, localeDir),
|
|
30
|
+
);
|
|
26
31
|
};
|
|
27
32
|
|
|
28
33
|
/**
|
|
@@ -34,6 +39,8 @@ const createConfigPlugin = (options: {
|
|
|
34
39
|
name: string;
|
|
35
40
|
/** Loader the configuration is resolved through, defaulting to a fresh caching loader. */
|
|
36
41
|
loadConfig?: ConfigLoader;
|
|
42
|
+
/** Catalog directory for development or tests, resolved relative to the project root. */
|
|
43
|
+
localeDir?: string | null | undefined;
|
|
37
44
|
/** Extra Vite configuration contributed from the plugin's `config` hook, given the user's own configuration. */
|
|
38
45
|
config?: (config: UserConfig) => Omit<UserConfig, "plugins">;
|
|
39
46
|
}): Plugin => {
|
|
@@ -53,7 +60,7 @@ const createConfigPlugin = (options: {
|
|
|
53
60
|
},
|
|
54
61
|
load: {
|
|
55
62
|
filter: { id: RESOLVED_VIRTUAL_ID_RE },
|
|
56
|
-
handler: (id: string) => loadVirtualModule(id, loadConfig, state),
|
|
63
|
+
handler: (id: string) => loadVirtualModule(id, loadConfig, state, options.localeDir),
|
|
57
64
|
},
|
|
58
65
|
};
|
|
59
66
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static-dependencies.d.ts","sourceRoot":"","sources":["../src/static-dependencies.ts"],"names":[],"mappings":"AAqbA,QAAA,MAAM,yBAAyB,GAC3B,YAAY,MAAM,EAClB,mBAAiC,EACjC,mBAAgC,KACjC,MAAM,EAoBR,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|