@tamagui/static 3.0.0-beta.765.1 → 3.0.0-beta.804.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.
@@ -41,7 +41,8 @@ var import_detectModuleFormat = require("./detectModuleFormat.cjs");
41
41
  var import_esbuildAliasPlugin = require("./esbuildAliasPlugin.cjs");
42
42
  var import_loadTamagui = require("./loadTamagui.cjs");
43
43
  var import_esbuildTsconfigPaths = require("./esbuildTsconfigPaths.cjs");
44
- const nodeRequire = (0, import_node_module.createRequire)(typeof __filename === "string" ? __filename : {}.url);
44
+ const import_meta = {};
45
+ const nodeRequire = (0, import_node_module.createRequire)(typeof __filename === "string" ? __filename : import_meta.url);
45
46
  const esbuildLoaderConfig = {
46
47
  ".js": "jsx",
47
48
  ".png": "dataurl",
@@ -70,22 +71,33 @@ const esbuildLoaderConfig = {
70
71
  const dataExtensions = Object.keys(esbuildLoaderConfig).filter((k) => esbuildLoaderConfig[k] === "file" || esbuildLoaderConfig[k] === "dataurl").map((k) => k.slice(1));
71
72
  const esbuildIgnoreFilesRegex = new RegExp(`.(${dataExtensions.join("|")})$`, "i");
72
73
  function getESBuildConfig({ entryPoints, resolvePlatformSpecificEntries, dangerouslyIgnoreStaticEvaluationModules = [], define: callerDefine, ...options }, platform, aliases) {
73
- if (process.env.DEBUG?.startsWith("tamagui")) console.info(`Building`, entryPoints);
74
+ if (process.env.DEBUG?.startsWith("tamagui")) {
75
+ console.info(`Building`, entryPoints);
76
+ }
74
77
  const resolvedEntryPoints = !resolvePlatformSpecificEntries ? entryPoints : entryPoints.map((entry) => (0, import_loadTamagui.resolveWebOrNativeSpecificEntry)(entry, platform));
75
78
  const detectedFormat = options.format || detectEntryFormat(resolvedEntryPoints[0]);
76
- return {
79
+ const platformDefines = platform === "web" ? {
80
+ "process.env.TAMAGUI_TARGET": "\"web\"",
81
+ "process.env.EXPO_OS": "\"web\""
82
+ } : { "process.env.TAMAGUI_TARGET": "\"native\"" };
83
+ const res = {
77
84
  bundle: true,
78
85
  entryPoints: resolvedEntryPoints,
79
86
  format: detectedFormat,
80
87
  define: {
81
- ...platform === "web" ? {
82
- "process.env.TAMAGUI_TARGET": "\"web\"",
83
- "process.env.EXPO_OS": "\"web\""
84
- } : { "process.env.TAMAGUI_TARGET": "\"native\"" },
88
+ ...platformDefines,
85
89
  ...callerDefine
86
90
  },
91
+ ...platform === "native" ? {
92
+ conditions: ["react-native"],
93
+ mainFields: [
94
+ "react-native",
95
+ "module",
96
+ "main"
97
+ ]
98
+ } : {},
87
99
  ...detectedFormat === "esm" ? {
88
- mainFields: ["module", "main"],
100
+ ...platform === "web" ? { mainFields: ["module", "main"] } : {},
89
101
  banner: { js: "import { createRequire as __cr } from \"module\"; const require = __cr(import.meta.url);" }
90
102
  } : {},
91
103
  target: "node24",
@@ -122,8 +134,12 @@ function getESBuildConfig({ entryPoints, resolvePlatformSpecificEntries, dangero
122
134
  setup(build) {
123
135
  const isCjs = build.initialOptions.format === "cjs" || !build.initialOptions.format;
124
136
  build.onLoad({ filter: /\.(ts|tsx|js|jsx|mjs)$/ }, (args) => {
125
- if (!isCjs) return null;
126
- if (args.path.includes("node_modules") && !args.path.includes("@tamagui")) return null;
137
+ if (!isCjs) {
138
+ return null;
139
+ }
140
+ if (args.path.includes("node_modules") && !args.path.includes("@tamagui")) {
141
+ return null;
142
+ }
127
143
  let contents = (0, import_node_fs.readFileSync)(args.path, "utf8");
128
144
  let modified = false;
129
145
  if (contents.includes("import.meta.env")) {
@@ -138,10 +154,12 @@ function getESBuildConfig({ entryPoints, resolvePlatformSpecificEntries, dangero
138
154
  contents = contents.replace(/import\.meta\.main/g, "false");
139
155
  modified = true;
140
156
  }
141
- if (modified) return {
142
- contents,
143
- loader: args.path.endsWith(".tsx") ? "tsx" : args.path.endsWith(".ts") ? "ts" : args.path.endsWith(".jsx") ? "jsx" : "js"
144
- };
157
+ if (modified) {
158
+ return {
159
+ contents,
160
+ loader: args.path.endsWith(".tsx") ? "tsx" : args.path.endsWith(".ts") ? "ts" : args.path.endsWith(".jsx") ? "jsx" : "js"
161
+ };
162
+ }
145
163
  return null;
146
164
  });
147
165
  }
@@ -150,7 +168,9 @@ function getESBuildConfig({ entryPoints, resolvePlatformSpecificEntries, dangero
150
168
  name: "external",
151
169
  setup(build) {
152
170
  build.onResolve({ filter: /^@tamagui\/(core|web)$/ }, (args) => {
153
- if (args.kind === "entry-point") return null;
171
+ if (args.kind === "entry-point") {
172
+ return null;
173
+ }
154
174
  return {
155
175
  path: platform === "native" ? "@tamagui/core/native" : args.path,
156
176
  external: true
@@ -180,12 +200,16 @@ function getESBuildConfig({ entryPoints, resolvePlatformSpecificEntries, dangero
180
200
  ],
181
201
  ...options
182
202
  };
203
+ return res;
183
204
  }
184
205
  function detectEntryFormat(entryPoint) {
185
- if (entryPoint.startsWith("/") || entryPoint.startsWith(".")) return (0, import_detectModuleFormat.detectModuleFormat)(entryPoint);
206
+ if (entryPoint.startsWith("/") || entryPoint.startsWith(".")) {
207
+ return (0, import_detectModuleFormat.detectModuleFormat)(entryPoint);
208
+ }
186
209
  try {
187
210
  const pkgJsonPath = nodeRequire.resolve(entryPoint + "/package.json");
188
- return JSON.parse((0, import_node_fs.readFileSync)(pkgJsonPath, "utf-8")).type === "module" ? "esm" : "cjs";
211
+ const pkg = JSON.parse((0, import_node_fs.readFileSync)(pkgJsonPath, "utf-8"));
212
+ return pkg.type === "module" ? "esm" : "cjs";
189
213
  } catch {
190
214
  return "cjs";
191
215
  }
@@ -21,8 +21,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var getTamaguiConfigPathFromOptionsConfig_exports = {};
22
22
  __export(getTamaguiConfigPathFromOptionsConfig_exports, { getTamaguiConfigPathFromOptionsConfig: () => getTamaguiConfigPathFromOptionsConfig });
23
23
  module.exports = __toCommonJS(getTamaguiConfigPathFromOptionsConfig_exports);
24
- var import_node_path = require("node:path");
24
+ var import_node_module = require("node:module");
25
25
  var import_node_fs = require("node:fs");
26
+ var import_node_path = require("node:path");
26
27
  function getTamaguiConfigPathFromOptionsConfig(config, root = process.cwd()) {
27
28
  if ((0, import_node_path.isAbsolute)(config)) {
28
29
  return config;
@@ -33,5 +34,9 @@ function getTamaguiConfigPathFromOptionsConfig(config, root = process.cwd()) {
33
34
  return fullPath;
34
35
  }
35
36
  } catch {}
37
+ try {
38
+ const customRequire = (0, import_node_module.createRequire)((0, import_node_path.join)(root, "package.json"));
39
+ return customRequire.resolve(config);
40
+ } catch {}
36
41
  return (0, import_node_path.resolve)(config);
37
42
  }
@@ -48,9 +48,10 @@ var import_registerRequire = require("../registerRequire.cjs");
48
48
  var import_bundleConfig = require("./bundleConfig.cjs");
49
49
  var import_getTamaguiConfigPathFromOptionsConfig = require("./getTamaguiConfigPathFromOptionsConfig.cjs");
50
50
  var import_regenerateConfig = require("./regenerateConfig.cjs");
51
- const nodeRequire = (0, import_node_module.createRequire)(typeof __filename === "string" ? __filename : {}.url);
51
+ const import_meta = {};
52
+ const nodeRequire = (0, import_node_module.createRequire)(typeof __filename === "string" ? __filename : import_meta.url);
52
53
  const getFilledOptions = (propsIn) => ({
53
- platform: "web",
54
+ platform: process.env.TAMAGUI_TARGET || "web",
54
55
  config: "tamagui.config.ts",
55
56
  components: ["tamagui"],
56
57
  ...propsIn
@@ -61,14 +62,18 @@ async function loadTamagui(propsIn, rebuild = false) {
61
62
  isLoadingPromise = (async () => {
62
63
  const props = getFilledOptions(propsIn);
63
64
  const bundleInfo = await (0, import_bundleConfig.getBundledConfig)(props, rebuild);
64
- if (!bundleInfo) throw new Error(`[tamagui] The config and component bundle completed without a project result`);
65
+ if (!bundleInfo) {
66
+ throw new Error(`[tamagui] The config and component bundle completed without a project result`);
67
+ }
65
68
  await generateThemesAndLog(props, rebuild);
66
69
  const maybeTamaguiConfig = bundleInfo.tamaguiConfig;
67
70
  if (maybeTamaguiConfig && !maybeTamaguiConfig.parsed) {
68
71
  const { createTamagui } = (0, import_requireTamaguiCore.requireTamaguiCore)(props.platform || "web");
69
72
  bundleInfo.tamaguiConfig = createTamagui(bundleInfo.tamaguiConfig);
70
73
  }
71
- if (!(0, import_bundleConfig.hasBundledConfigChanged)()) return bundleInfo;
74
+ if (!(0, import_bundleConfig.hasBundledConfigChanged)()) {
75
+ return bundleInfo;
76
+ }
72
77
  await (0, import_regenerateConfig.regenerateConfig)(props, bundleInfo);
73
78
  return bundleInfo;
74
79
  })();
@@ -83,25 +88,35 @@ async function loadTamaguiFromModules(propsIn, evaluated) {
83
88
  await generateThemesAndLog(props);
84
89
  const configModule = evaluated.config;
85
90
  let tamaguiConfig = configModule.default || configModule.config || configModule;
86
- if ("config" in tamaguiConfig && tamaguiConfig.config && !("tokens" in tamaguiConfig)) tamaguiConfig = tamaguiConfig.config;
87
- if (!tamaguiConfig) throw new Error(`The Vite module runner did not return a valid Tamagui config`);
91
+ if ("config" in tamaguiConfig && tamaguiConfig.config && !("tokens" in tamaguiConfig)) {
92
+ tamaguiConfig = tamaguiConfig.config;
93
+ }
94
+ if (!tamaguiConfig) {
95
+ throw new Error(`The Vite module runner did not return a valid Tamagui config`);
96
+ }
88
97
  const hostCore = (0, import_requireTamaguiCore.requireTamaguiCore)(props.platform || "web");
89
- if (!tamaguiConfig.parsed) tamaguiConfig = hostCore.createTamagui(tamaguiConfig);
90
- else hostCore.installTamaguiConfig(tamaguiConfig);
98
+ if (!tamaguiConfig.parsed) {
99
+ tamaguiConfig = hostCore.createTamagui(tamaguiConfig);
100
+ } else {
101
+ hostCore.installTamaguiConfig(tamaguiConfig);
102
+ }
91
103
  (0, import_bundleConfig.setLoadedConfig)(tamaguiConfig);
104
+ const components = evaluated.components.map(({ moduleName, module: module2 }) => {
105
+ (0, import_registerRequire.setRequireResult)(moduleName, module2);
106
+ return {
107
+ moduleName,
108
+ nameToInfo: (0, import_bundleConfig.getComponentStaticConfigByName)(moduleName, module2.default ?? module2)
109
+ };
110
+ });
92
111
  const projectInfo = {
93
- components: evaluated.components.map(({ moduleName, module: module2 }) => {
94
- (0, import_registerRequire.setRequireResult)(moduleName, module2);
95
- return {
96
- moduleName,
97
- nameToInfo: (0, import_bundleConfig.getComponentStaticConfigByName)(moduleName, module2.default ?? module2)
98
- };
99
- }),
112
+ components,
100
113
  nameToPaths: {},
101
114
  tamaguiConfig,
102
115
  stampSources: evaluated.stampSources
103
116
  };
104
- if (props.outputCSS) await (0, import_bundleConfig.writeTamaguiCSS)(props.outputCSS, projectInfo.tamaguiConfig);
117
+ if (props.outputCSS) {
118
+ await (0, import_bundleConfig.writeTamaguiCSS)(props.outputCSS, projectInfo.tamaguiConfig);
119
+ }
105
120
  return projectInfo;
106
121
  }
107
122
  let waiting = false;
@@ -111,11 +126,15 @@ const generateThemesAndLog = async (options, force = false) => {
111
126
  try {
112
127
  waiting = true;
113
128
  await new Promise((res) => setTimeout(res, 30));
114
- if (await (0, import_regenerateConfig.generateTamaguiThemes)(options, force)) {
115
- (0, import_cli_color.colorLog)(import_cli_color.Color.FgYellow, ` \u27A1 [tamagui] generated themes: ${(0, import_node_path.relative)(options.root || process.cwd(), options.themeBuilder.output)}`);
129
+ const didGenerate = await (0, import_regenerateConfig.generateTamaguiThemes)(options, force);
130
+ if (didGenerate) {
131
+ const whitespaceBefore = ` `;
132
+ (0, import_cli_color.colorLog)(import_cli_color.Color.FgYellow, `${whitespaceBefore}\u27A1 [tamagui] generated themes: ${(0, import_node_path.relative)(options.root || process.cwd(), options.themeBuilder.output)}`);
116
133
  if (options.outputCSS) {
117
134
  const loadedConfig = (0, import_bundleConfig.getLoadedConfig)();
118
- if (loadedConfig) await (0, import_bundleConfig.writeTamaguiCSS)(options.outputCSS, loadedConfig);
135
+ if (loadedConfig) {
136
+ await (0, import_bundleConfig.writeTamaguiCSS)(options.outputCSS, loadedConfig);
137
+ }
119
138
  }
120
139
  }
121
140
  } finally {
@@ -132,37 +151,44 @@ async function loadTamaguiBuildConfigAsync(tamaguiOptions) {
132
151
  const buildFilePath = tamaguiOptions?.buildFile ?? "./tamagui.build.ts";
133
152
  const root = tamaguiOptions?.root || process.cwd();
134
153
  const absolutePath = (0, import_node_path.resolve)(root, buildFilePath);
135
- if (import_fs_extra.default.existsSync(absolutePath)) try {
136
- const result = await import_esbuild.default.build({
137
- entryPoints: [absolutePath],
138
- absWorkingDir: root,
139
- bundle: true,
140
- packages: "external",
141
- platform: "node",
142
- format: "cjs",
143
- target: "node18",
144
- write: false,
145
- metafile: true
146
- });
147
- const module2 = { exports: {} };
148
- const projectRequire = (0, import_node_module.createRequire)(absolutePath);
149
- const code = result.outputFiles[0]?.text;
150
- if (!code) throw new Error(`No output generated for ${buildFilePath}`);
151
- new Function("module", "exports", "require", "process", code)(module2, module2.exports, projectRequire, process);
152
- const out = module2.exports.default || module2.exports;
153
- if (!out || typeof out !== "object") throw new Error(`No default export found in ${buildFilePath}: ${out}`);
154
- const loadedOptions = {
155
- ...tamaguiOptions,
156
- ...out
157
- };
158
- const dependencies2 = Object.keys(result.metafile.inputs).map((input) => (0, import_node_path.resolve)(root, input));
159
- buildConfigDependencies.set(loadedOptions, dependencies2);
160
- tamaguiOptions = loadedOptions;
161
- } catch (err) {
162
- console.error(`[tamagui] Error loading ${buildFilePath}:`, err);
163
- throw err;
154
+ if (import_fs_extra.default.existsSync(absolutePath)) {
155
+ try {
156
+ const result = await import_esbuild.default.build({
157
+ entryPoints: [absolutePath],
158
+ absWorkingDir: root,
159
+ bundle: true,
160
+ packages: "external",
161
+ platform: "node",
162
+ format: "cjs",
163
+ target: "node18",
164
+ write: false,
165
+ metafile: true
166
+ });
167
+ const module2 = { exports: {} };
168
+ const projectRequire = (0, import_node_module.createRequire)(absolutePath);
169
+ const code = result.outputFiles[0]?.text;
170
+ if (!code) throw new Error(`No output generated for ${buildFilePath}`);
171
+ const fn = new Function("module", "exports", "require", "process", code);
172
+ fn(module2, module2.exports, projectRequire, process);
173
+ const out = module2.exports.default || module2.exports;
174
+ if (!out || typeof out !== "object") {
175
+ throw new Error(`No default export found in ${buildFilePath}: ${out}`);
176
+ }
177
+ const loadedOptions = {
178
+ ...tamaguiOptions,
179
+ ...out
180
+ };
181
+ const dependencies2 = Object.keys(result.metafile.inputs).map((input) => (0, import_node_path.resolve)(root, input));
182
+ buildConfigDependencies.set(loadedOptions, dependencies2);
183
+ tamaguiOptions = loadedOptions;
184
+ } catch (err) {
185
+ console.error(`[tamagui] Error loading ${buildFilePath}:`, err);
186
+ throw err;
187
+ }
188
+ }
189
+ if (!tamaguiOptions) {
190
+ throw new Error(`No tamagui build options found either via input props or at tamagui.build.ts`);
164
191
  }
165
- if (!tamaguiOptions) throw new Error(`No tamagui build options found either via input props or at tamagui.build.ts`);
166
192
  const options = {
167
193
  config: "tamagui.config.ts",
168
194
  components: ["tamagui", "@tamagui/core"],
@@ -180,7 +206,9 @@ function loadTamaguiBuildConfigSync(tamaguiOptions) {
180
206
  const registered = (0, import_registerRequire.registerRequire)("web", { ignoredModules: tamaguiOptions?.dangerouslyIgnoreStaticEvaluationModules });
181
207
  try {
182
208
  const out = nodeRequire(absolutePath).default;
183
- if (!out) throw new Error(`No default export found in ${buildFilePath}: ${out}`);
209
+ if (!out) {
210
+ throw new Error(`No default export found in ${buildFilePath}: ${out}`);
211
+ }
184
212
  tamaguiOptions = {
185
213
  ...tamaguiOptions,
186
214
  ...out
@@ -189,7 +217,9 @@ function loadTamaguiBuildConfigSync(tamaguiOptions) {
189
217
  registered.unregister();
190
218
  }
191
219
  }
192
- if (!tamaguiOptions) throw new Error(`No tamagui build options found either via input props or at tamagui.build.ts`);
220
+ if (!tamaguiOptions) {
221
+ throw new Error(`No tamagui build options found either via input props or at tamagui.build.ts`);
222
+ }
193
223
  return {
194
224
  config: "tamagui.config.ts",
195
225
  components: ["tamagui", "@tamagui/core"],
@@ -199,7 +229,9 @@ function loadTamaguiBuildConfigSync(tamaguiOptions) {
199
229
  function loadTamaguiSync({ forceExports, cacheKey, ...propsIn }) {
200
230
  const key = JSON.stringify(propsIn);
201
231
  if (last[key] && !(0, import_bundleConfig.hasBundledConfigChanged)()) {
202
- if (!lastVersion[key] || lastVersion[key] === cacheKey) return last[key];
232
+ if (!lastVersion[key] || lastVersion[key] === cacheKey) {
233
+ return last[key];
234
+ }
203
235
  }
204
236
  lastVersion[key] = cacheKey || "";
205
237
  const props = getFilledOptions(propsIn);
@@ -215,7 +247,9 @@ function loadTamaguiSync({ forceExports, cacheKey, ...propsIn }) {
215
247
  if (propsIn.config) {
216
248
  const configPath = (0, import_getTamaguiConfigPathFromOptionsConfig.getTamaguiConfigPathFromOptionsConfig)(propsIn.config, propsIn.root);
217
249
  const exp = nodeRequire(configPath);
218
- if (!exp) throw new Error(`The Tamagui config module did not export a value`);
250
+ if (!exp) {
251
+ throw new Error(`The Tamagui config module did not export a value`);
252
+ }
219
253
  tamaguiConfig = exp["default"] || exp["config"] || exp;
220
254
  if (!tamaguiConfig || !tamaguiConfig.parsed) {
221
255
  const confPath = nodeRequire.resolve(configPath);
@@ -229,8 +263,12 @@ function loadTamaguiSync({ forceExports, cacheKey, ...propsIn }) {
229
263
  }
230
264
  }
231
265
  const components = (0, import_bundleConfig.loadComponentsSync)(props, forceExports);
232
- if (!components) throw new Error(`No components loaded`);
233
- if (process.env.DEBUG === "tamagui") console.info(`components`, components);
266
+ if (!components) {
267
+ throw new Error(`No components loaded`);
268
+ }
269
+ if (process.env.DEBUG === "tamagui") {
270
+ console.info(`components`, components);
271
+ }
234
272
  const info = {
235
273
  components,
236
274
  tamaguiConfig,
@@ -238,7 +276,9 @@ function loadTamaguiSync({ forceExports, cacheKey, ...propsIn }) {
238
276
  };
239
277
  if (tamaguiConfig) {
240
278
  const { outputCSS } = props;
241
- if (outputCSS) (0, import_bundleConfig.writeTamaguiCSS)(outputCSS, tamaguiConfig);
279
+ if (outputCSS) {
280
+ (0, import_bundleConfig.writeTamaguiCSS)(outputCSS, tamaguiConfig);
281
+ }
242
282
  (0, import_regenerateConfig.regenerateConfigSync)(props, info);
243
283
  }
244
284
  last[key] = {
@@ -269,7 +309,7 @@ async function getOptions({ root = process.cwd(), tsconfigPath = "tsconfig.json"
269
309
  debug,
270
310
  tsconfigPath,
271
311
  tamaguiOptions: {
272
- platform: "web",
312
+ platform: process.env.TAMAGUI_TARGET || "web",
273
313
  components: ["tamagui"],
274
314
  ...tamaguiOptions,
275
315
  config: tamaguiOptions?.config ?? await getDefaultTamaguiConfigPath(root, tamaguiOptions?.config)
@@ -287,16 +327,23 @@ function resolveWebOrNativeSpecificEntry(entry, platform) {
287
327
  const resolved = nodeRequire.resolve(entry, { paths: [workspaceRoot] });
288
328
  const ext = (0, import_node_path.extname)(resolved);
289
329
  const fileName = (0, import_node_path.basename)(resolved).replace(ext, "");
290
- const specificExt = (platform || "web") === "web" ? "web" : "native";
330
+ const target = platform || process.env.TAMAGUI_TARGET || "web";
331
+ const specificExt = target === "web" ? "web" : "native";
291
332
  const specificFile = (0, import_node_path.join)((0, import_node_path.dirname)(resolved), fileName + "." + specificExt + ext);
292
- if (import_fs_extra.default.existsSync(specificFile)) return specificFile;
333
+ if (import_fs_extra.default.existsSync(specificFile)) {
334
+ return specificFile;
335
+ }
293
336
  return entry;
294
337
  }
295
338
  const defaultPaths = ["tamagui.config.ts", (0, import_node_path.join)("src", "tamagui.config.ts")];
296
339
  let hasWarnedOnce = false;
297
340
  async function getDefaultTamaguiConfigPath(root, configPath) {
298
341
  const searchPaths = [...new Set([configPath, ...defaultPaths].filter(Boolean).map((p) => (0, import_node_path.join)(root, p)))];
299
- for (const path of searchPaths) if (await import_fs_extra.default.pathExists(path)) return path;
342
+ for (const path of searchPaths) {
343
+ if (await import_fs_extra.default.pathExists(path)) {
344
+ return path;
345
+ }
346
+ }
300
347
  if (!hasWarnedOnce) {
301
348
  hasWarnedOnce = true;
302
349
  console.warn(`Warning: couldn't find tamagui.config.ts in the following paths given configuration "${configPath}":
@@ -325,18 +372,22 @@ async function esbuildWatchFiles(entry, onChanged) {
325
372
  plugins: [{
326
373
  name: `on-rebuild`,
327
374
  setup({ onEnd, onResolve }) {
328
- onResolve({ filter: /^[^./]|^\.[^./]|^\.\.[^/]/ }, (args) => ({
375
+ let filter = /^[^./]|^\.[^./]|^\.\.[^/]/;
376
+ onResolve({ filter }, (args) => ({
329
377
  path: args.path,
330
378
  external: true
331
379
  }));
332
380
  onEnd(() => {
333
- if (!hasRunOnce) hasRunOnce = true;
334
- else onChanged();
381
+ if (!hasRunOnce) {
382
+ hasRunOnce = true;
383
+ } else {
384
+ onChanged();
385
+ }
335
386
  });
336
387
  }
337
388
  }]
338
389
  });
339
- context.watch();
390
+ void context.watch();
340
391
  return () => {
341
392
  context.dispose();
342
393
  };
@@ -124,7 +124,18 @@ var CompilerFrontend = class {
124
124
  return total;
125
125
  }
126
126
  compile(input) {
127
- const operation = this.queue.then(() => this.compileNow(input));
127
+ const operation = this.queue.then(async () => {
128
+ const previousTarget = process.env.TAMAGUI_TARGET;
129
+ const previousStatic = process.env.IS_STATIC;
130
+ try {
131
+ return await this.compileNow(input);
132
+ } finally {
133
+ if (previousTarget === void 0) delete process.env.TAMAGUI_TARGET;
134
+ else process.env.TAMAGUI_TARGET = previousTarget;
135
+ if (previousStatic === void 0) delete process.env.IS_STATIC;
136
+ else process.env.IS_STATIC = previousStatic;
137
+ }
138
+ });
128
139
  this.queue = operation.catch(() => void 0);
129
140
  return operation;
130
141
  }
@@ -1 +1 @@
1
- {"version":3,"file":"compiler.js","names":[],"sources":["esm/compiler.js"],"sourcesContent":["import {\n CompilerSession,\n LOWERED_MODULE_PLAN_VERSION,\n ModulePlanCache,\n PLAN_CACHE_SCHEMA_VERSION,\n contentHash,\n defaultPlanCacheRoot,\n resolvedModuleId,\n stableStringify,\n yukuFactory\n} from \"@tamagui/compiler-core\";\nimport { readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { createTamaguiCompilerHost } from \"./compilerHost\";\nimport { domStructuralPass } from \"./domStructuralPass\";\nimport { loadTamagui } from \"./extractor/loadTamagui\";\nimport { resolveZeroRuntimeSync } from \"./zero/options\";\nasync function loadCompilerProject({\n root,\n target,\n options: optionsIn,\n generation,\n rebuild = false,\n hostVersions = [],\n missingProjectMessage = \"Unable to load the Tamagui compiler project\",\n load = loadTamagui,\n resolveComponents\n}) {\n const components = [\n .../* @__PURE__ */ new Set([\"@tamagui/core\", ...optionsIn.components || [\"tamagui\"]])\n ];\n const options = {\n ...optionsIn,\n root,\n platform: target,\n components\n };\n const zeroRuntime = resolveZeroRuntimeSync(options, root).mode;\n if (zeroRuntime === \"enforce\") options.outputCSS = void 0;\n const projectInfo = await load(options, rebuild);\n if (!projectInfo?.tamaguiConfig || !projectInfo.components) {\n throw new Error(missingProjectMessage);\n }\n const componentModules = resolveComponents ? await resolveComponents(components, projectInfo, options) : [];\n const disablePartialExtraction = !!options.disablePartialExtraction;\n const experimentalNativeFastPath = target === \"native\" && options.experimental?.nativeFastPath === true;\n return {\n projectInfo,\n componentModules,\n generation: typeof generation === \"function\" ? generation(projectInfo, componentModules, options) : generation,\n disablePartialExtraction,\n experimentalNativeFastPath,\n zeroRuntime: zeroRuntime !== \"off\",\n cacheStamp: compilerProjectStamp({\n stampSources: projectInfo.stampSources ?? [],\n hostVersions,\n target,\n componentModules,\n disablePartialExtraction,\n experimentalNativeFastPath,\n zeroRuntime: zeroRuntime !== \"off\",\n development: process.env.NODE_ENV === \"development\"\n })\n };\n}\nconst requireFromCompiler = createRequire(\n typeof __filename === \"string\" ? __filename : import.meta.url\n);\nconst compilerPackageVersions = [\"@tamagui/compiler-core\", \"@tamagui/static\"].map(\n (name) => `${name}@${requireFromCompiler(`${name}/package.json`).version}`\n);\nfunction compilerProjectStamp(input) {\n if (!input.stampSources.length) return null;\n const sources = [];\n for (const file of [...new Set(input.stampSources)].sort()) {\n try {\n sources.push([file, contentHash(readFileSync(file))]);\n } catch {\n return null;\n }\n }\n return contentHash(\n stableStringify({\n schema: PLAN_CACHE_SCHEMA_VERSION,\n plan: LOWERED_MODULE_PLAN_VERSION,\n packages: [...compilerPackageVersions, ...input.hostVersions].sort(),\n target: input.target,\n development: input.development,\n componentModules: input.componentModules.map(({ moduleName, id }) => [\n moduleName,\n cleanId(id)\n ]),\n disablePartialExtraction: input.disablePartialExtraction,\n experimentalNativeFastPath: input.experimentalNativeFastPath,\n zeroRuntime: input.zeroRuntime,\n sources\n })\n );\n}\nfunction cleanId(id) {\n return id.split(/[?#]/, 1)[0];\n}\nfunction externalId(specifier) {\n return resolvedModuleId(`external://${encodeURIComponent(specifier)}`);\n}\nfunction compilerContext(input) {\n return `${input.root}\\0${input.target}\\0${input.environment ?? \"\"}\\0${input.project.generation}`;\n}\nfunction sourceCanBeLinked(root, id) {\n const clean = cleanId(id);\n const normalized = clean.replace(/\\\\/g, \"/\");\n if (!path.isAbsolute(clean) || normalized.includes(\"/node_modules/\")) return false;\n const relative = path.relative(root, clean);\n return relative === \"\" || relative !== \"..\" && !relative.startsWith(`..${path.sep}`);\n}\nclass CompilerFrontend {\n session = new CompilerSession();\n queue = Promise.resolve();\n planCaches = /* @__PURE__ */ new Map();\n moduleRecords = /* @__PURE__ */ new Map();\n moduleContext = null;\n /**\n * One cache per project root and platform. Absent when the project produced\n * no content stamp, in which case plans are never persisted rather than\n * persisted under an identity that cannot see a config change.\n */\n planCacheFor(input) {\n const stamp = input.project.cacheStamp;\n if (!stamp) return void 0;\n const root = defaultPlanCacheRoot(input.root, input.target);\n let store = this.planCaches.get(root);\n if (!store) {\n store = new ModulePlanCache(root);\n this.planCaches.set(root, store);\n }\n return { store, stamp };\n }\n /** Hits, misses and writes across every plan cache this frontend has used. */\n get planCacheStats() {\n const total = { hits: 0, misses: 0, writes: 0 };\n for (const store of this.planCaches.values()) {\n total.hits += store.stats.hits;\n total.misses += store.stats.misses;\n total.writes += store.stats.writes;\n }\n return total;\n }\n compile(input) {\n const operation = this.queue.then(() => this.compileNow(input));\n this.queue = operation.catch(() => void 0);\n return operation;\n }\n update(input) {\n const operation = this.queue.then(async () => {\n const { modules } = await this.buildTree(input);\n const invalidated = /* @__PURE__ */ new Set();\n for (const module of modules.values()) {\n for (const id of await this.session.update(module)) invalidated.add(id);\n this.moduleRecords.set(module.id, module);\n }\n return [...invalidated].sort();\n });\n this.queue = operation.catch(() => void 0);\n return operation;\n }\n has(id) {\n return this.session.has(resolvedModuleId(cleanId(id)));\n }\n dependentsOf(id) {\n return this.session.dependentsOf(resolvedModuleId(cleanId(id)));\n }\n remove(id) {\n const operation = this.queue.then(async () => {\n const result = await this.session.remove(resolvedModuleId(cleanId(id)));\n for (const invalidatedId of result.invalidatedIds) {\n this.moduleRecords.delete(invalidatedId);\n }\n return result;\n });\n this.queue = operation.catch(() => void 0);\n return operation;\n }\n parseCount(id) {\n return this.session.parseCount(resolvedModuleId(cleanId(id)));\n }\n async compileNow(input) {\n const { rootModule, modules } = await this.buildTree(input);\n const invalidated = /* @__PURE__ */ new Set();\n for (const module of modules.values()) {\n for (const id of await this.session.update(module)) invalidated.add(id);\n this.moduleRecords.set(module.id, module);\n }\n const projectInfo = input.project.projectInfo;\n if (!projectInfo.tamaguiConfig || !projectInfo.components) {\n throw new Error(\"The compiler requires evaluated Tamagui config and components\");\n }\n const host = createTamaguiCompilerHost({\n target: input.target,\n tamaguiConfig: projectInfo.tamaguiConfig,\n components: projectInfo.components,\n componentModules: input.project.componentModules.map((component) => ({\n moduleName: component.moduleName,\n resolvedId: cleanId(component.id)\n })),\n disablePartialExtraction: input.project.disablePartialExtraction,\n experimentalNativeFastPath: input.project.experimentalNativeFastPath,\n zeroRuntime: input.project.zeroRuntime\n });\n const result = await this.session.compile({\n module: rootModule,\n adapter: {\n target: input.target,\n projectGeneration: input.project.generation,\n host,\n planCache: this.planCacheFor(input),\n async load(id) {\n return modules.get(id) ?? null;\n }\n },\n structuralPass: domStructuralPass\n });\n for (const id of result.invalidatedIds) invalidated.add(id);\n return {\n plan: result.plan,\n output: result.output,\n invalidatedIds: [...invalidated].sort()\n };\n }\n async buildTree(input) {\n const moduleContext = compilerContext(input);\n if (this.moduleContext !== moduleContext) {\n this.moduleRecords.clear();\n this.moduleContext = moduleContext;\n }\n const componentBySpecifier = new Map(\n input.project.componentModules.map((component) => [\n component.moduleName,\n resolvedModuleId(cleanId(component.id))\n ])\n );\n const modules = /* @__PURE__ */ new Map();\n const loading = /* @__PURE__ */ new Set();\n const addInstalledClosure = (module) => {\n if (modules.has(module.id) || loading.has(module.id)) return;\n loading.add(module.id);\n for (const dependency of module.imports) {\n if (dependency.external) continue;\n const installedDependency = this.moduleRecords.get(dependency.resolvedId);\n if (installedDependency && this.session.has(dependency.resolvedId)) {\n addInstalledClosure(installedDependency);\n }\n }\n modules.set(module.id, module);\n loading.delete(module.id);\n };\n const loadModule = async (rawId, source) => {\n const id = resolvedModuleId(cleanId(rawId));\n const existing = modules.get(id);\n if (existing) return existing;\n const installed = this.moduleRecords.get(id);\n if (installed?.source === source && this.session.has(id)) {\n addInstalledClosure(installed);\n return installed;\n }\n if (loading.has(id)) {\n return { id, source, imports: [] };\n }\n loading.add(id);\n const imports = [];\n for (const specifier of yukuFactory.scanImports(id, source)) {\n const configuredComponent = componentBySpecifier.get(specifier);\n if (configuredComponent) {\n imports.push({ specifier, resolvedId: configuredComponent, external: true });\n continue;\n }\n const resolution = await input.resolve(specifier, id);\n if (!resolution) continue;\n const canLink = !resolution.external && sourceCanBeLinked(input.root, resolution.id);\n const resolvedId = canLink ? resolvedModuleId(cleanId(resolution.id)) : path.isAbsolute(cleanId(resolution.id)) ? resolvedModuleId(cleanId(resolution.id)) : externalId(specifier);\n imports.push({ specifier, resolvedId, external: !canLink });\n if (canLink && !modules.has(resolvedId) && !loading.has(resolvedId)) {\n const installedDependency = this.moduleRecords.get(resolvedId);\n if (installedDependency && this.session.has(resolvedId)) {\n addInstalledClosure(installedDependency);\n } else {\n const dependencySource = await input.load(resolution.id);\n if (dependencySource !== null) {\n await loadModule(resolution.id, dependencySource);\n }\n }\n }\n }\n const module = { id, source, imports };\n modules.set(id, module);\n loading.delete(id);\n return module;\n };\n const rootModule = await loadModule(input.id, input.source);\n return { rootModule, modules };\n }\n}\nexport {\n CompilerFrontend,\n compilerProjectStamp,\n loadCompilerProject\n};\n//# sourceMappingURL=compiler.js.map\n"],"mappings":";;;;;;;;;;AAkBA,eAAe,oBAAoB,EACjC,MACA,QACA,SAAS,WACT,YACA,UAAU,OACV,eAAe,CAAC,GAChB,wBAAwB,+CACxB,OAAO,aACP,qBACC;CACD,MAAM,aAAa,CACjB,mBAAmB,IAAI,IAAI,CAAC,iBAAiB,GAAG,UAAU,cAAc,CAAC,SAAS,CAAC,CAAC,CACtF;CACA,MAAM,UAAU;EACd,GAAG;EACH;EACA,UAAU;EACV;CACF;CACA,MAAM,cAAc,uBAAuB,SAAS,IAAI,CAAC,CAAC;CAC1D,IAAI,gBAAgB,WAAW,QAAQ,YAAY,KAAK;CACxD,MAAM,cAAc,MAAM,KAAK,SAAS,OAAO;CAC/C,IAAI,CAAC,aAAa,iBAAiB,CAAC,YAAY,YAAY;EAC1D,MAAM,IAAI,MAAM,qBAAqB;CACvC;CACA,MAAM,mBAAmB,oBAAoB,MAAM,kBAAkB,YAAY,aAAa,OAAO,IAAI,CAAC;CAC1G,MAAM,2BAA2B,CAAC,CAAC,QAAQ;CAC3C,MAAM,6BAA6B,WAAW,YAAY,QAAQ,cAAc,mBAAmB;CACnG,OAAO;EACL;EACA;EACA,YAAY,OAAO,eAAe,aAAa,WAAW,aAAa,kBAAkB,OAAO,IAAI;EACpG;EACA;EACA,aAAa,gBAAgB;EAC7B,YAAY,qBAAqB;GAC/B,cAAc,YAAY,gBAAgB,CAAC;GAC3C;GACA;GACA;GACA;GACA;GACA,aAAa,gBAAgB;GAC7B,aAAa,QAAQ,IAAI,aAAa;EACxC,CAAC;CACH;AACF;AACA,MAAM,sBAAsB,cAC1B,OAAO,eAAe,WAAW,aAAa,YAAY,GAC5D;AACA,MAAM,0BAA0B,CAAC,0BAA0B,iBAAiB,CAAC,CAAC,KAC3E,SAAS,GAAG,KAAK,GAAG,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AmB,MAAM,MAAM,KAAK,WAAW,EAAE;MACvD,IAAI,qBAAqB,MAAM;OAC7B,MAAM,WAAW,WAAW,IAAI,gBAAgB;MAClD;KACF;IACF;GACF;GACA,MAAM,SAAS;IAAE;IAAI;IAAQ;GAAQ;GACrC,QAAQ,IAAI,IAAI,MAAM;GACtB,QAAQ,OAAO,EAAE;GACjB,OAAO;EACT;EACA,MAAM,aAAa,MAAM,WAAW,MAAM,IAAI,MAAM,MAAM;EAC1D,OAAO;GAAE;GAAY;EAAQ;CAC/B;AACF"}
1
+ {"version":3,"file":"compiler.js","names":[],"sources":["esm/compiler.js"],"sourcesContent":["import {\n CompilerSession,\n LOWERED_MODULE_PLAN_VERSION,\n ModulePlanCache,\n PLAN_CACHE_SCHEMA_VERSION,\n contentHash,\n defaultPlanCacheRoot,\n resolvedModuleId,\n stableStringify,\n yukuFactory\n} from \"@tamagui/compiler-core\";\nimport { readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { createTamaguiCompilerHost } from \"./compilerHost\";\nimport { domStructuralPass } from \"./domStructuralPass\";\nimport { loadTamagui } from \"./extractor/loadTamagui\";\nimport { resolveZeroRuntimeSync } from \"./zero/options\";\nasync function loadCompilerProject({\n root,\n target,\n options: optionsIn,\n generation,\n rebuild = false,\n hostVersions = [],\n missingProjectMessage = \"Unable to load the Tamagui compiler project\",\n load = loadTamagui,\n resolveComponents\n}) {\n const components = [\n .../* @__PURE__ */ new Set([\"@tamagui/core\", ...optionsIn.components || [\"tamagui\"]])\n ];\n const options = {\n ...optionsIn,\n root,\n platform: target,\n components\n };\n const zeroRuntime = resolveZeroRuntimeSync(options, root).mode;\n if (zeroRuntime === \"enforce\") options.outputCSS = void 0;\n const projectInfo = await load(options, rebuild);\n if (!projectInfo?.tamaguiConfig || !projectInfo.components) {\n throw new Error(missingProjectMessage);\n }\n const componentModules = resolveComponents ? await resolveComponents(components, projectInfo, options) : [];\n const disablePartialExtraction = !!options.disablePartialExtraction;\n const experimentalNativeFastPath = target === \"native\" && options.experimental?.nativeFastPath === true;\n return {\n projectInfo,\n componentModules,\n generation: typeof generation === \"function\" ? generation(projectInfo, componentModules, options) : generation,\n disablePartialExtraction,\n experimentalNativeFastPath,\n zeroRuntime: zeroRuntime !== \"off\",\n cacheStamp: compilerProjectStamp({\n stampSources: projectInfo.stampSources ?? [],\n hostVersions,\n target,\n componentModules,\n disablePartialExtraction,\n experimentalNativeFastPath,\n zeroRuntime: zeroRuntime !== \"off\",\n development: process.env.NODE_ENV === \"development\"\n })\n };\n}\nconst requireFromCompiler = createRequire(\n typeof __filename === \"string\" ? __filename : import.meta.url\n);\nconst compilerPackageVersions = [\"@tamagui/compiler-core\", \"@tamagui/static\"].map(\n (name) => `${name}@${requireFromCompiler(`${name}/package.json`).version}`\n);\nfunction compilerProjectStamp(input) {\n if (!input.stampSources.length) return null;\n const sources = [];\n for (const file of [...new Set(input.stampSources)].sort()) {\n try {\n sources.push([file, contentHash(readFileSync(file))]);\n } catch {\n return null;\n }\n }\n return contentHash(\n stableStringify({\n schema: PLAN_CACHE_SCHEMA_VERSION,\n plan: LOWERED_MODULE_PLAN_VERSION,\n packages: [...compilerPackageVersions, ...input.hostVersions].sort(),\n target: input.target,\n development: input.development,\n componentModules: input.componentModules.map(({ moduleName, id }) => [\n moduleName,\n cleanId(id)\n ]),\n disablePartialExtraction: input.disablePartialExtraction,\n experimentalNativeFastPath: input.experimentalNativeFastPath,\n zeroRuntime: input.zeroRuntime,\n sources\n })\n );\n}\nfunction cleanId(id) {\n return id.split(/[?#]/, 1)[0];\n}\nfunction externalId(specifier) {\n return resolvedModuleId(`external://${encodeURIComponent(specifier)}`);\n}\nfunction compilerContext(input) {\n return `${input.root}\\0${input.target}\\0${input.environment ?? \"\"}\\0${input.project.generation}`;\n}\nfunction sourceCanBeLinked(root, id) {\n const clean = cleanId(id);\n const normalized = clean.replace(/\\\\/g, \"/\");\n if (!path.isAbsolute(clean) || normalized.includes(\"/node_modules/\")) return false;\n const relative = path.relative(root, clean);\n return relative === \"\" || relative !== \"..\" && !relative.startsWith(`..${path.sep}`);\n}\nclass CompilerFrontend {\n session = new CompilerSession();\n queue = Promise.resolve();\n planCaches = /* @__PURE__ */ new Map();\n moduleRecords = /* @__PURE__ */ new Map();\n moduleContext = null;\n /**\n * One cache per project root and platform. Absent when the project produced\n * no content stamp, in which case plans are never persisted rather than\n * persisted under an identity that cannot see a config change.\n */\n planCacheFor(input) {\n const stamp = input.project.cacheStamp;\n if (!stamp) return void 0;\n const root = defaultPlanCacheRoot(input.root, input.target);\n let store = this.planCaches.get(root);\n if (!store) {\n store = new ModulePlanCache(root);\n this.planCaches.set(root, store);\n }\n return { store, stamp };\n }\n /** Hits, misses and writes across every plan cache this frontend has used. */\n get planCacheStats() {\n const total = { hits: 0, misses: 0, writes: 0 };\n for (const store of this.planCaches.values()) {\n total.hits += store.stats.hits;\n total.misses += store.stats.misses;\n total.writes += store.stats.writes;\n }\n return total;\n }\n compile(input) {\n const operation = this.queue.then(async () => {\n const previousTarget = process.env.TAMAGUI_TARGET;\n const previousStatic = process.env.IS_STATIC;\n try {\n return await this.compileNow(input);\n } finally {\n if (previousTarget === void 0) delete process.env.TAMAGUI_TARGET;\n else process.env.TAMAGUI_TARGET = previousTarget;\n if (previousStatic === void 0) delete process.env.IS_STATIC;\n else process.env.IS_STATIC = previousStatic;\n }\n });\n this.queue = operation.catch(() => void 0);\n return operation;\n }\n update(input) {\n const operation = this.queue.then(async () => {\n const { modules } = await this.buildTree(input);\n const invalidated = /* @__PURE__ */ new Set();\n for (const module of modules.values()) {\n for (const id of await this.session.update(module)) invalidated.add(id);\n this.moduleRecords.set(module.id, module);\n }\n return [...invalidated].sort();\n });\n this.queue = operation.catch(() => void 0);\n return operation;\n }\n has(id) {\n return this.session.has(resolvedModuleId(cleanId(id)));\n }\n dependentsOf(id) {\n return this.session.dependentsOf(resolvedModuleId(cleanId(id)));\n }\n remove(id) {\n const operation = this.queue.then(async () => {\n const result = await this.session.remove(resolvedModuleId(cleanId(id)));\n for (const invalidatedId of result.invalidatedIds) {\n this.moduleRecords.delete(invalidatedId);\n }\n return result;\n });\n this.queue = operation.catch(() => void 0);\n return operation;\n }\n parseCount(id) {\n return this.session.parseCount(resolvedModuleId(cleanId(id)));\n }\n async compileNow(input) {\n const { rootModule, modules } = await this.buildTree(input);\n const invalidated = /* @__PURE__ */ new Set();\n for (const module of modules.values()) {\n for (const id of await this.session.update(module)) invalidated.add(id);\n this.moduleRecords.set(module.id, module);\n }\n const projectInfo = input.project.projectInfo;\n if (!projectInfo.tamaguiConfig || !projectInfo.components) {\n throw new Error(\"The compiler requires evaluated Tamagui config and components\");\n }\n const host = createTamaguiCompilerHost({\n target: input.target,\n tamaguiConfig: projectInfo.tamaguiConfig,\n components: projectInfo.components,\n componentModules: input.project.componentModules.map((component) => ({\n moduleName: component.moduleName,\n resolvedId: cleanId(component.id)\n })),\n disablePartialExtraction: input.project.disablePartialExtraction,\n experimentalNativeFastPath: input.project.experimentalNativeFastPath,\n zeroRuntime: input.project.zeroRuntime\n });\n const result = await this.session.compile({\n module: rootModule,\n adapter: {\n target: input.target,\n projectGeneration: input.project.generation,\n host,\n planCache: this.planCacheFor(input),\n async load(id) {\n return modules.get(id) ?? null;\n }\n },\n structuralPass: domStructuralPass\n });\n for (const id of result.invalidatedIds) invalidated.add(id);\n return {\n plan: result.plan,\n output: result.output,\n invalidatedIds: [...invalidated].sort()\n };\n }\n async buildTree(input) {\n const moduleContext = compilerContext(input);\n if (this.moduleContext !== moduleContext) {\n this.moduleRecords.clear();\n this.moduleContext = moduleContext;\n }\n const componentBySpecifier = new Map(\n input.project.componentModules.map((component) => [\n component.moduleName,\n resolvedModuleId(cleanId(component.id))\n ])\n );\n const modules = /* @__PURE__ */ new Map();\n const loading = /* @__PURE__ */ new Set();\n const addInstalledClosure = (module) => {\n if (modules.has(module.id) || loading.has(module.id)) return;\n loading.add(module.id);\n for (const dependency of module.imports) {\n if (dependency.external) continue;\n const installedDependency = this.moduleRecords.get(dependency.resolvedId);\n if (installedDependency && this.session.has(dependency.resolvedId)) {\n addInstalledClosure(installedDependency);\n }\n }\n modules.set(module.id, module);\n loading.delete(module.id);\n };\n const loadModule = async (rawId, source) => {\n const id = resolvedModuleId(cleanId(rawId));\n const existing = modules.get(id);\n if (existing) return existing;\n const installed = this.moduleRecords.get(id);\n if (installed?.source === source && this.session.has(id)) {\n addInstalledClosure(installed);\n return installed;\n }\n if (loading.has(id)) {\n return { id, source, imports: [] };\n }\n loading.add(id);\n const imports = [];\n for (const specifier of yukuFactory.scanImports(id, source)) {\n const configuredComponent = componentBySpecifier.get(specifier);\n if (configuredComponent) {\n imports.push({ specifier, resolvedId: configuredComponent, external: true });\n continue;\n }\n const resolution = await input.resolve(specifier, id);\n if (!resolution) continue;\n const canLink = !resolution.external && sourceCanBeLinked(input.root, resolution.id);\n const resolvedId = canLink ? resolvedModuleId(cleanId(resolution.id)) : path.isAbsolute(cleanId(resolution.id)) ? resolvedModuleId(cleanId(resolution.id)) : externalId(specifier);\n imports.push({ specifier, resolvedId, external: !canLink });\n if (canLink && !modules.has(resolvedId) && !loading.has(resolvedId)) {\n const installedDependency = this.moduleRecords.get(resolvedId);\n if (installedDependency && this.session.has(resolvedId)) {\n addInstalledClosure(installedDependency);\n } else {\n const dependencySource = await input.load(resolution.id);\n if (dependencySource !== null) {\n await loadModule(resolution.id, dependencySource);\n }\n }\n }\n }\n const module = { id, source, imports };\n modules.set(id, module);\n loading.delete(id);\n return module;\n };\n const rootModule = await loadModule(input.id, input.source);\n return { rootModule, modules };\n }\n}\nexport {\n CompilerFrontend,\n compilerProjectStamp,\n loadCompilerProject\n};\n//# sourceMappingURL=compiler.js.map\n"],"mappings":";;;;;;;;;;AAkBA,eAAe,oBAAoB,EACjC,MACA,QACA,SAAS,WACT,YACA,UAAU,OACV,eAAe,CAAC,GAChB,wBAAwB,+CACxB,OAAO,aACP,qBACC;CACD,MAAM,aAAa,CACjB,mBAAmB,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