@caryhu/codemine-forge 0.0.1-alpha.2 → 0.0.1-alpha.4

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.
@@ -24,8 +24,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.createBrowserBundle = void 0;
27
+ const compiler_sfc_1 = require("@vue/compiler-sfc");
27
28
  const ts = __importStar(require("typescript"));
28
29
  const virtual_file_system_1 = require("../virtual-file-system");
30
+ const angular_resources_1 = require("./angular-resources");
29
31
  const diagnostics_1 = require("./diagnostics");
30
32
  const BROWSER_IMPORT_MAP_PATH = "/.forge/build/browser-import-map.json";
31
33
  const DEFAULT_RESOLVE_EXTENSIONS = [
@@ -76,7 +78,7 @@ async function createBrowserBundle(options) {
76
78
  visiting.delete(sourcePath);
77
79
  return;
78
80
  }
79
- const source = await options.fileSystem.readText(sourcePath);
81
+ const source = maybeInjectAngularZoneJsImport(sourcePath, options.entry, await options.fileSystem.readText(sourcePath), options.angularCompatibility);
80
82
  const importSource = extension === ".vue" ? createVueSfcModule(sourcePath, source) : source;
81
83
  const imports = extractImportReferences(importSource).map((reference) => reference.specifier);
82
84
  const rewrites = new Map();
@@ -113,11 +115,18 @@ async function createBrowserBundle(options) {
113
115
  packageImports.set(specifier, packageImport.kind === "external"
114
116
  ? packageImport.url
115
117
  : packageImport.outputPath);
118
+ const linkerDiagnostic = packageImport.kind === "external"
119
+ ? createExternalAngularPartialLinkerDiagnostic(packageImport.packageRecord, options.angularCompatibility)
120
+ : undefined;
121
+ if (linkerDiagnostic !== undefined) {
122
+ diagnostics.push(linkerDiagnostic);
123
+ continue;
124
+ }
116
125
  if (packageImport.kind === "package-file") {
117
126
  await visitPackageModule(packageImport.packageRecord, packageImport.filePath);
118
127
  }
119
128
  }
120
- const transformResult = await transformWorkspaceModule(sourcePath, source, options.scriptTransformer, options.viteConfig?.define ?? {});
129
+ const transformResult = await transformWorkspaceModule(sourcePath, source, options.fileSystem, options.angularCompatibility, options.scriptTransformer, options.viteConfig?.define ?? {});
121
130
  if (!transformResult.success) {
122
131
  diagnostics.push(...transformResult.diagnostics);
123
132
  visiting.delete(sourcePath);
@@ -176,11 +185,18 @@ async function createBrowserBundle(options) {
176
185
  packageImports.set(specifier, packageImport.kind === "external"
177
186
  ? packageImport.url
178
187
  : packageImport.outputPath);
188
+ const linkerDiagnostic = packageImport.kind === "external"
189
+ ? createExternalAngularPartialLinkerDiagnostic(packageImport.packageRecord, options.angularCompatibility)
190
+ : undefined;
191
+ if (linkerDiagnostic !== undefined) {
192
+ diagnostics.push(linkerDiagnostic);
193
+ continue;
194
+ }
179
195
  if (packageImport.kind === "package-file") {
180
196
  await visitPackageModule(packageImport.packageRecord, packageImport.filePath);
181
197
  }
182
198
  }
183
- const transformResult = transformPackageModule(importer, normalizedFilePath, content);
199
+ const transformResult = transformPackageModule(importer, normalizedFilePath, content, packageRecord, options.angularCompatibility);
184
200
  if (!transformResult.success) {
185
201
  diagnostics.push(...transformResult.diagnostics);
186
202
  visitingPackageModules.delete(key);
@@ -253,7 +269,7 @@ function createBrowserBundleModules(workspaceModules, packageModules) {
253
269
  })),
254
270
  ].sort((left, right) => left.outputPath.localeCompare(right.outputPath));
255
271
  }
256
- async function transformWorkspaceModule(sourcePath, source, scriptTransformer, defineReplacements) {
272
+ async function transformWorkspaceModule(sourcePath, source, fileSystem, angularCompatibility, scriptTransformer, defineReplacements) {
257
273
  const extension = getExtension(sourcePath);
258
274
  if (extension === ".css") {
259
275
  return transformSuccess(createWorkspaceCssModule(sourcePath, source));
@@ -268,18 +284,35 @@ async function transformWorkspaceModule(sourcePath, source, scriptTransformer, d
268
284
  if (!SCRIPT_EXTENSIONS.has(extension)) {
269
285
  return transformSuccess(source);
270
286
  }
287
+ const angularResourceResult = angularCompatibility?.inlineComponentResources === true
288
+ ? await (0, angular_resources_1.inlineAngularComponentResources)({
289
+ fileSystem,
290
+ sourcePath,
291
+ sourceText: source,
292
+ })
293
+ : {
294
+ outputText: source,
295
+ diagnostics: [],
296
+ };
297
+ if (angularResourceResult.diagnostics.length > 0) {
298
+ return {
299
+ success: false,
300
+ diagnostics: angularResourceResult.diagnostics,
301
+ };
302
+ }
303
+ const sourceText = angularResourceResult.outputText;
271
304
  const loader = scriptLoaderForExtension(extension);
272
305
  if (loader !== undefined && scriptTransformer !== undefined) {
273
306
  const transformResult = await scriptTransformer({
274
307
  loader,
275
308
  sourcePath,
276
- sourceText: source,
309
+ sourceText,
277
310
  });
278
311
  return transformResult.success
279
312
  ? transformSuccess(applyDefines(transformResult.outputText))
280
313
  : transformResult;
281
314
  }
282
- return transformSuccess(applyDefines(transpileScript(sourcePath, source)));
315
+ return transformSuccess(applyDefines(transpileScript(sourcePath, sourceText)));
283
316
  }
284
317
  function transpileScript(sourcePath, source) {
285
318
  return ts.transpileModule(source, {
@@ -303,7 +336,7 @@ function transformSuccess(outputText) {
303
336
  diagnostics: [],
304
337
  };
305
338
  }
306
- function transformPackageModule(importer, filePath, content) {
339
+ function transformPackageModule(importer, filePath, content, packageRecord, angularCompatibility) {
307
340
  const extension = getExtension(filePath);
308
341
  if (typeof content !== "string" &&
309
342
  !SCRIPT_EXTENSIONS.has(extension) &&
@@ -321,237 +354,100 @@ function transformPackageModule(importer, filePath, content) {
321
354
  if (!SCRIPT_EXTENSIONS.has(extension)) {
322
355
  return transformSuccess(source);
323
356
  }
357
+ if (shouldDiagnoseAngularPartialDeclarations(angularCompatibility) &&
358
+ hasAngularPartialDeclaration(source)) {
359
+ return {
360
+ success: false,
361
+ diagnostics: [
362
+ (0, diagnostics_1.createAngularPartialLinkerRequiredDiagnostic)(packageRecord.name, packageRecord.version, importer),
363
+ ],
364
+ };
365
+ }
324
366
  return transformSuccess(transpileScript(importer, source));
325
367
  }
368
+ function maybeInjectAngularZoneJsImport(sourcePath, entry, source, angularCompatibility) {
369
+ if (angularCompatibility?.injectZoneJs !== true ||
370
+ sourcePath !== entry ||
371
+ hasBareImport(source, "zone.js")) {
372
+ return source;
373
+ }
374
+ return `import "zone.js";\n${source}`;
375
+ }
376
+ function createExternalAngularPartialLinkerDiagnostic(packageRecord, angularCompatibility) {
377
+ if (!shouldDiagnoseAngularPartialDeclarations(angularCompatibility) ||
378
+ !packageRecordHasAngularPartialDeclaration(packageRecord)) {
379
+ return undefined;
380
+ }
381
+ return (0, diagnostics_1.createAngularPartialLinkerRequiredDiagnostic)(packageRecord.name, packageRecord.version, packageRecord.entryUrl ?? createPackageImporterPath(packageRecord, packageRecord.entry));
382
+ }
383
+ function shouldDiagnoseAngularPartialDeclarations(angularCompatibility) {
384
+ return angularCompatibility?.linker === "auto" ||
385
+ angularCompatibility?.linker === "diagnostic";
386
+ }
387
+ function packageRecordHasAngularPartialDeclaration(packageRecord) {
388
+ return Object.values(packageRecord.files).some((file) => typeof file.content === "string" &&
389
+ hasAngularPartialDeclaration(file.content));
390
+ }
391
+ function hasAngularPartialDeclaration(source) {
392
+ return ANGULAR_PARTIAL_DECLARATION_MARKERS.some((marker) => source.includes(marker));
393
+ }
394
+ const ANGULAR_PARTIAL_DECLARATION_MARKERS = [
395
+ "\u0275\u0275ngDeclareComponent",
396
+ "\u0275\u0275ngDeclareDirective",
397
+ "\u0275\u0275ngDeclareFactory",
398
+ "\u0275\u0275ngDeclareInjectable",
399
+ "\u0275\u0275ngDeclareInjector",
400
+ "\u0275\u0275ngDeclareNgModule",
401
+ "\u0275\u0275ngDeclarePipe",
402
+ ];
326
403
  function createVueSfcModule(sourcePath, source) {
327
- const scriptSetup = extractVueSfcBlock(source, "script", "setup") ?? "";
328
- const template = extractVueSfcBlock(source, "template") ?? "";
329
- const bindings = collectVueSetupBindings(scriptSetup);
330
- const renderExpression = createVueRenderExpression(template);
331
- const setupReturn = bindings.length === 0
332
- ? "{}"
333
- : `{ ${bindings.map((binding) => `${binding}: ${binding}`).join(", ")} }`;
404
+ const filename = sourcePath;
405
+ const id = `forge-vue-${hashText(sourcePath)}`;
406
+ const parseResult = (0, compiler_sfc_1.parse)(source, { filename });
407
+ if (parseResult.errors.length > 0) {
408
+ throw new Error(formatVueCompilerErrors(parseResult.errors));
409
+ }
410
+ const { descriptor } = parseResult;
411
+ const script = descriptor.script === null && descriptor.scriptSetup === null
412
+ ? undefined
413
+ : (0, compiler_sfc_1.compileScript)(descriptor, {
414
+ genDefaultAs: "__forgeVueDefault",
415
+ id,
416
+ });
417
+ const scriptContent = script?.content ?? "const __forgeVueDefault = {};";
418
+ const template = descriptor.template === null
419
+ ? undefined
420
+ : (0, compiler_sfc_1.compileTemplate)({
421
+ compilerOptions: {
422
+ bindingMetadata: script?.bindings ?? {},
423
+ },
424
+ filename,
425
+ id,
426
+ scoped: descriptor.styles.some((style) => style.scoped),
427
+ source: descriptor.template.content,
428
+ });
429
+ if (template?.errors !== undefined && template.errors.length > 0) {
430
+ throw new Error(formatVueCompilerErrors(template.errors));
431
+ }
432
+ const templateContent = template?.code ?? "function render() { return null; }";
334
433
  return [
335
- 'import { h as __forgeVueH } from "vue";',
336
- scriptSetup,
434
+ scriptContent,
337
435
  "",
338
- "const __forgeVueComponent = {",
436
+ templateContent,
437
+ "",
438
+ "const __forgeVueComponent = Object.assign(__forgeVueDefault, {",
339
439
  ` __file: ${JSON.stringify(sourcePath)},`,
340
- " setup() {",
341
- ` return ${setupReturn};`,
342
- " },",
343
- " render(__forgeVueCtx) {",
344
- ` return ${renderExpression};`,
345
- " },",
346
- "};",
440
+ " render,",
441
+ "});",
347
442
  "",
348
443
  "export default __forgeVueComponent;",
349
444
  "",
350
445
  ].join("\n");
351
446
  }
352
- function extractVueSfcBlock(source, blockName, requiredAttribute) {
353
- const pattern = new RegExp(`<${blockName}\\b([^>]*)>([\\s\\S]*?)<\\/${blockName}>`, "gi");
354
- for (const match of source.matchAll(pattern)) {
355
- const attributes = match[1] ?? "";
356
- if (requiredAttribute !== undefined &&
357
- !new RegExp(`\\b${requiredAttribute}\\b`, "i").test(attributes)) {
358
- continue;
359
- }
360
- return match[2].trim();
361
- }
362
- return undefined;
363
- }
364
- function collectVueSetupBindings(scriptSetup) {
365
- const bindings = new Set();
366
- for (const match of scriptSetup.matchAll(/\bimport\s+(type\s+)?([\s\S]*?)\s+from\s*["'][^"']+["']/g)) {
367
- if (match[1] !== undefined) {
368
- continue;
369
- }
370
- for (const binding of parseImportBindingNames(match[2])) {
371
- bindings.add(binding);
372
- }
373
- }
374
- const declarationPatterns = [
375
- /\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)/g,
376
- /\bfunction\s+([A-Za-z_$][\w$]*)/g,
377
- /\bclass\s+([A-Za-z_$][\w$]*)/g,
378
- ];
379
- for (const pattern of declarationPatterns) {
380
- for (const match of scriptSetup.matchAll(pattern)) {
381
- bindings.add(match[1]);
382
- }
383
- }
384
- return Array.from(bindings).sort((left, right) => left.localeCompare(right));
385
- }
386
- function parseImportBindingNames(importClause) {
387
- const bindings = [];
388
- const trimmed = importClause.trim();
389
- if (trimmed.length === 0 || trimmed.startsWith("{")) {
390
- bindings.push(...parseNamedImportBindings(trimmed));
391
- return bindings;
392
- }
393
- const [defaultOrNamespace = "", ...rest] = trimmed.split(",");
394
- const defaultBinding = defaultOrNamespace.trim();
395
- if (defaultBinding.startsWith("* as ")) {
396
- bindings.push(defaultBinding.slice(5).trim());
397
- }
398
- else if (/^[A-Za-z_$][\w$]*$/.test(defaultBinding)) {
399
- bindings.push(defaultBinding);
400
- }
401
- bindings.push(...parseNamedImportBindings(rest.join(",").trim()));
402
- return bindings.filter((binding) => /^[A-Za-z_$][\w$]*$/.test(binding));
403
- }
404
- function parseNamedImportBindings(importClause) {
405
- const namedMatch = importClause.match(/\{([\s\S]*?)\}/);
406
- if (namedMatch === null) {
407
- return [];
408
- }
409
- return namedMatch[1]
410
- .split(",")
411
- .map((part) => part.trim())
412
- .filter((part) => part.length > 0 && !part.startsWith("type "))
413
- .map((part) => {
414
- const aliasMatch = part.match(/\bas\s+([A-Za-z_$][\w$]*)$/);
415
- return aliasMatch?.[1] ?? part;
416
- })
417
- .filter((binding) => /^[A-Za-z_$][\w$]*$/.test(binding));
418
- }
419
- function createVueRenderExpression(template) {
420
- const nodes = parseVueTemplate(template);
421
- const renderedChildren = nodes.map(createVueTemplateNodeExpression);
422
- if (renderedChildren.length === 0) {
423
- return "null";
424
- }
425
- return renderedChildren.length === 1
426
- ? renderedChildren[0]
427
- : `__forgeVueH("div", null, [${renderedChildren.join(", ")}])`;
428
- }
429
- function parseVueTemplate(template) {
430
- const root = {
431
- attributes: [],
432
- children: [],
433
- tagName: "__root__",
434
- };
435
- const stack = [root];
436
- const tokenPattern = /<!--[\s\S]*?-->|<\/?[^>]+>|{{[\s\S]*?}}|[^<{]+|[<{]/g;
437
- for (const match of template.matchAll(tokenPattern)) {
438
- const token = match[0];
439
- const current = stack[stack.length - 1];
440
- if (token.startsWith("<!--")) {
441
- continue;
442
- }
443
- if (token.startsWith("</")) {
444
- if (stack.length > 1) {
445
- stack.pop();
446
- }
447
- continue;
448
- }
449
- if (token.startsWith("<")) {
450
- const element = parseVueTemplateElementToken(token);
451
- if (element === undefined) {
452
- continue;
453
- }
454
- current.children.push({
455
- attributes: element.attributes,
456
- children: element.children,
457
- kind: "element",
458
- tagName: element.tagName,
459
- });
460
- if (!isSelfClosingVueTemplateToken(token)) {
461
- stack.push(element);
462
- }
463
- continue;
464
- }
465
- if (token.startsWith("{{")) {
466
- current.children.push({
467
- expression: token.slice(2, -2).trim(),
468
- kind: "interpolation",
469
- });
470
- continue;
471
- }
472
- if (token.trim().length > 0) {
473
- current.children.push({
474
- kind: "text",
475
- value: token.replace(/\s+/g, " "),
476
- });
477
- }
478
- }
479
- return root.children;
480
- }
481
- function parseVueTemplateElementToken(token) {
482
- const content = token
483
- .slice(1, isSelfClosingVueTemplateToken(token) ? -2 : -1)
484
- .trim();
485
- const tagMatch = content.match(/^([A-Za-z][\w.-]*)/);
486
- if (tagMatch === null) {
487
- return undefined;
488
- }
489
- return {
490
- attributes: parseVueTemplateAttributes(content.slice(tagMatch[0].length)),
491
- children: [],
492
- tagName: tagMatch[1],
493
- };
494
- }
495
- function parseVueTemplateAttributes(source) {
496
- const attributes = [];
497
- const pattern = /([:@A-Za-z_][\w:.-]*)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s"'>/]+))?/g;
498
- for (const match of source.matchAll(pattern)) {
499
- const name = match[1];
500
- if (name.startsWith(":") ||
501
- name.startsWith("@") ||
502
- name.startsWith("v-")) {
503
- continue;
504
- }
505
- const rawValue = match[2];
506
- const value = rawValue === undefined
507
- ? true
508
- : rawValue.replace(/^["']|["']$/g, "");
509
- attributes.push({ name, value });
510
- }
511
- return attributes;
512
- }
513
- function createVueTemplateNodeExpression(node) {
514
- switch (node.kind) {
515
- case "element":
516
- return createVueElementExpression(node);
517
- case "interpolation":
518
- return createVueInterpolationExpression(node.expression);
519
- case "text":
520
- return JSON.stringify(node.value);
521
- }
522
- }
523
- function createVueElementExpression(node) {
524
- const tagExpression = /^[A-Z]/.test(node.tagName)
525
- ? `(__forgeVueCtx[${JSON.stringify(node.tagName)}] ?? ${JSON.stringify(node.tagName)})`
526
- : JSON.stringify(node.tagName);
527
- const propsExpression = createVuePropsExpression(node.attributes);
528
- const children = node.children.map(createVueTemplateNodeExpression);
529
- const childrenExpression = children.length === 0
530
- ? "null"
531
- : children.length === 1
532
- ? children[0]
533
- : `[${children.join(", ")}]`;
534
- return `__forgeVueH(${tagExpression}, ${propsExpression}, ${childrenExpression})`;
535
- }
536
- function createVuePropsExpression(attributes) {
537
- if (attributes.length === 0) {
538
- return "null";
539
- }
540
- return `{ ${attributes
541
- .map((attribute) => {
542
- const value = attribute.value === true ? "true" : JSON.stringify(attribute.value);
543
- return `${JSON.stringify(attribute.name)}: ${value}`;
544
- })
545
- .join(", ")} }`;
546
- }
547
- function createVueInterpolationExpression(expression) {
548
- if (/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(expression)) {
549
- return `String(__forgeVueCtx.${expression} ?? "")`;
550
- }
551
- return "String(\"\")";
552
- }
553
- function isSelfClosingVueTemplateToken(token) {
554
- return /\/\s*>$/.test(token);
447
+ function formatVueCompilerErrors(errors) {
448
+ return errors
449
+ .map((error) => (error instanceof Error ? error.message : String(error)))
450
+ .join("\n");
555
451
  }
556
452
  function createWorkspaceCssModule(sourcePath, css) {
557
453
  return isCssModulePath(sourcePath)
@@ -675,6 +571,9 @@ function extractImportReferences(source) {
675
571
  }
676
572
  return references;
677
573
  }
574
+ function hasBareImport(source, specifier) {
575
+ return extractImportReferences(source).some((reference) => reference.specifier === specifier);
576
+ }
678
577
  function resolveAliasSpecifier(specifier, aliases) {
679
578
  for (const [find, replacement] of Object.entries(aliases).sort(([left], [right]) => right.length - left.length || left.localeCompare(right))) {
680
579
  if (specifier === find) {
@@ -734,6 +633,7 @@ function resolvePackageImport(packages, specifier) {
734
633
  if (packageRecord.entryUrl !== undefined && parsed.subpath === "") {
735
634
  return {
736
635
  kind: "external",
636
+ packageRecord,
737
637
  url: packageRecord.entryUrl,
738
638
  };
739
639
  }
@@ -745,6 +645,7 @@ function resolvePackageImport(packages, specifier) {
745
645
  (parsed.subpath === normalizedEntry || parsed.subpath === entryWithoutExtension)) {
746
646
  return {
747
647
  kind: "external",
648
+ packageRecord,
748
649
  url: packageRecord.entryUrl,
749
650
  };
750
651
  }
@@ -5,4 +5,9 @@ export declare function createMissingBuildScriptDiagnostic(): ForgeBuildPipeline
5
5
  export declare function createUnsupportedBuildScriptDiagnostic(script: string): ForgeBuildPipelineDiagnostic;
6
6
  export declare function createMissingEntryDiagnostic(): ForgeBuildPipelineDiagnostic;
7
7
  export declare function createUnresolvedImportDiagnostic(importSpecifier: string, importer: string): ForgeBuildPipelineDiagnostic;
8
+ export declare function createAngularResourceNotFoundDiagnostic(path: string, resourcePath: string): ForgeBuildPipelineDiagnostic;
9
+ export declare function createAngularExternalResourceUnsupportedDiagnostic(path: string, resourcePath: string): ForgeBuildPipelineDiagnostic;
10
+ export declare function createAngularResourceTransformFailedDiagnostic(path: string, cause: unknown): ForgeBuildPipelineDiagnostic;
11
+ export declare function createAngularZoneJsRequiredDiagnostic(path: string): ForgeBuildPipelineDiagnostic;
12
+ export declare function createAngularPartialLinkerRequiredDiagnostic(packageName: string, packageVersion: string, path: string): ForgeBuildPipelineDiagnostic;
8
13
  export declare function createViteConfigNotExecutedDiagnostic(path: string): ForgeBuildPipelineDiagnostic;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createViteConfigNotExecutedDiagnostic = exports.createUnresolvedImportDiagnostic = exports.createMissingEntryDiagnostic = exports.createUnsupportedBuildScriptDiagnostic = exports.createMissingBuildScriptDiagnostic = exports.createBuildCancelledDiagnostic = exports.createEsbuildWorkerTransformDiagnostic = void 0;
3
+ exports.createViteConfigNotExecutedDiagnostic = exports.createAngularPartialLinkerRequiredDiagnostic = exports.createAngularZoneJsRequiredDiagnostic = exports.createAngularResourceTransformFailedDiagnostic = exports.createAngularExternalResourceUnsupportedDiagnostic = exports.createAngularResourceNotFoundDiagnostic = exports.createUnresolvedImportDiagnostic = exports.createMissingEntryDiagnostic = exports.createUnsupportedBuildScriptDiagnostic = exports.createMissingBuildScriptDiagnostic = exports.createBuildCancelledDiagnostic = exports.createEsbuildWorkerTransformDiagnostic = void 0;
4
4
  function createEsbuildWorkerTransformDiagnostic(path, cause) {
5
5
  return {
6
6
  code: "esbuild_worker_transform_failed",
@@ -59,6 +59,57 @@ function createUnresolvedImportDiagnostic(importSpecifier, importer) {
59
59
  };
60
60
  }
61
61
  exports.createUnresolvedImportDiagnostic = createUnresolvedImportDiagnostic;
62
+ function createAngularResourceNotFoundDiagnostic(path, resourcePath) {
63
+ return {
64
+ code: "angular_resource_not_found",
65
+ severity: "error",
66
+ message: `Angular component resource '${resourcePath}' could not be resolved from ${path}.`,
67
+ path,
68
+ resourcePath,
69
+ };
70
+ }
71
+ exports.createAngularResourceNotFoundDiagnostic = createAngularResourceNotFoundDiagnostic;
72
+ function createAngularExternalResourceUnsupportedDiagnostic(path, resourcePath) {
73
+ return {
74
+ code: "angular_external_resource_unsupported",
75
+ severity: "error",
76
+ message: `Angular component resource '${resourcePath}' is external and cannot be inlined by Forge.`,
77
+ path,
78
+ resourcePath,
79
+ };
80
+ }
81
+ exports.createAngularExternalResourceUnsupportedDiagnostic = createAngularExternalResourceUnsupportedDiagnostic;
82
+ function createAngularResourceTransformFailedDiagnostic(path, cause) {
83
+ return {
84
+ code: "angular_resource_transform_failed",
85
+ severity: "error",
86
+ message: "Forge failed to transform Angular component resources.",
87
+ path,
88
+ cause,
89
+ };
90
+ }
91
+ exports.createAngularResourceTransformFailedDiagnostic = createAngularResourceTransformFailedDiagnostic;
92
+ function createAngularZoneJsRequiredDiagnostic(path) {
93
+ return {
94
+ code: "angular_zonejs_required",
95
+ severity: "error",
96
+ message: "Angular NgModule bootstrap requires zone.js, but Forge could not resolve a compatible package.",
97
+ path,
98
+ dependencyName: "zone.js",
99
+ };
100
+ }
101
+ exports.createAngularZoneJsRequiredDiagnostic = createAngularZoneJsRequiredDiagnostic;
102
+ function createAngularPartialLinkerRequiredDiagnostic(packageName, packageVersion, path) {
103
+ return {
104
+ code: "angular_partial_linker_required",
105
+ severity: "error",
106
+ message: `Angular package ${packageName}@${packageVersion} contains partial Ivy declarations and needs linked browser ESM or Forge Angular linker support.`,
107
+ packageName,
108
+ packageVersion,
109
+ path,
110
+ };
111
+ }
112
+ exports.createAngularPartialLinkerRequiredDiagnostic = createAngularPartialLinkerRequiredDiagnostic;
62
113
  function createViteConfigNotExecutedDiagnostic(path) {
63
114
  return {
64
115
  code: "vite_config_not_executed",
@@ -1,3 +1,3 @@
1
- export { createBuildCancelledDiagnostic, createEsbuildWorkerTransformDiagnostic, createMissingBuildScriptDiagnostic, createMissingEntryDiagnostic, createUnresolvedImportDiagnostic, createUnsupportedBuildScriptDiagnostic, createViteConfigNotExecutedDiagnostic, } from "./diagnostics";
2
- export { createBuildPipeline, DefaultBuildPipeline, isSupportedViteBuildScript, } from "./pipeline";
1
+ export { createAngularExternalResourceUnsupportedDiagnostic, createAngularPartialLinkerRequiredDiagnostic, createAngularResourceNotFoundDiagnostic, createAngularResourceTransformFailedDiagnostic, createAngularZoneJsRequiredDiagnostic, createBuildCancelledDiagnostic, createEsbuildWorkerTransformDiagnostic, createMissingEntryDiagnostic, createUnresolvedImportDiagnostic, createViteConfigNotExecutedDiagnostic, } from "./diagnostics";
2
+ export { createBuildPipeline, DefaultBuildPipeline, } from "./pipeline";
3
3
  export { BUILD_PIPELINE_CAPABILITY, type ForgeBrowserBundle, type ForgeBrowserBundleManifest, type ForgeBrowserBundleModule, type ForgeBrowserBundleModuleOrigin, type ForgeBuildDiagnostic, type ForgeBuildManifest, type ForgeBuildMode, type ForgeBuildOutputFile, type ForgeBuildPipeline, type ForgeBuildPipelineDiagnostic, type ForgeBuildPipelineDiagnosticCode, type ForgeBuildPipelineOptions, type ForgeBuildRequest, type ForgeBuildResult, type ForgeBuildTiming, type ForgeViteConfigMetadata, } from "./types";
@@ -1,17 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BUILD_PIPELINE_CAPABILITY = exports.isSupportedViteBuildScript = exports.DefaultBuildPipeline = exports.createBuildPipeline = exports.createViteConfigNotExecutedDiagnostic = exports.createUnsupportedBuildScriptDiagnostic = exports.createUnresolvedImportDiagnostic = exports.createMissingEntryDiagnostic = exports.createMissingBuildScriptDiagnostic = exports.createEsbuildWorkerTransformDiagnostic = exports.createBuildCancelledDiagnostic = void 0;
3
+ exports.BUILD_PIPELINE_CAPABILITY = exports.DefaultBuildPipeline = exports.createBuildPipeline = exports.createViteConfigNotExecutedDiagnostic = exports.createUnresolvedImportDiagnostic = exports.createMissingEntryDiagnostic = exports.createEsbuildWorkerTransformDiagnostic = exports.createBuildCancelledDiagnostic = exports.createAngularZoneJsRequiredDiagnostic = exports.createAngularResourceTransformFailedDiagnostic = exports.createAngularResourceNotFoundDiagnostic = exports.createAngularPartialLinkerRequiredDiagnostic = exports.createAngularExternalResourceUnsupportedDiagnostic = void 0;
4
4
  var diagnostics_1 = require("./diagnostics");
5
+ Object.defineProperty(exports, "createAngularExternalResourceUnsupportedDiagnostic", { enumerable: true, get: function () { return diagnostics_1.createAngularExternalResourceUnsupportedDiagnostic; } });
6
+ Object.defineProperty(exports, "createAngularPartialLinkerRequiredDiagnostic", { enumerable: true, get: function () { return diagnostics_1.createAngularPartialLinkerRequiredDiagnostic; } });
7
+ Object.defineProperty(exports, "createAngularResourceNotFoundDiagnostic", { enumerable: true, get: function () { return diagnostics_1.createAngularResourceNotFoundDiagnostic; } });
8
+ Object.defineProperty(exports, "createAngularResourceTransformFailedDiagnostic", { enumerable: true, get: function () { return diagnostics_1.createAngularResourceTransformFailedDiagnostic; } });
9
+ Object.defineProperty(exports, "createAngularZoneJsRequiredDiagnostic", { enumerable: true, get: function () { return diagnostics_1.createAngularZoneJsRequiredDiagnostic; } });
5
10
  Object.defineProperty(exports, "createBuildCancelledDiagnostic", { enumerable: true, get: function () { return diagnostics_1.createBuildCancelledDiagnostic; } });
6
11
  Object.defineProperty(exports, "createEsbuildWorkerTransformDiagnostic", { enumerable: true, get: function () { return diagnostics_1.createEsbuildWorkerTransformDiagnostic; } });
7
- Object.defineProperty(exports, "createMissingBuildScriptDiagnostic", { enumerable: true, get: function () { return diagnostics_1.createMissingBuildScriptDiagnostic; } });
8
12
  Object.defineProperty(exports, "createMissingEntryDiagnostic", { enumerable: true, get: function () { return diagnostics_1.createMissingEntryDiagnostic; } });
9
13
  Object.defineProperty(exports, "createUnresolvedImportDiagnostic", { enumerable: true, get: function () { return diagnostics_1.createUnresolvedImportDiagnostic; } });
10
- Object.defineProperty(exports, "createUnsupportedBuildScriptDiagnostic", { enumerable: true, get: function () { return diagnostics_1.createUnsupportedBuildScriptDiagnostic; } });
11
14
  Object.defineProperty(exports, "createViteConfigNotExecutedDiagnostic", { enumerable: true, get: function () { return diagnostics_1.createViteConfigNotExecutedDiagnostic; } });
12
15
  var pipeline_1 = require("./pipeline");
13
16
  Object.defineProperty(exports, "createBuildPipeline", { enumerable: true, get: function () { return pipeline_1.createBuildPipeline; } });
14
17
  Object.defineProperty(exports, "DefaultBuildPipeline", { enumerable: true, get: function () { return pipeline_1.DefaultBuildPipeline; } });
15
- Object.defineProperty(exports, "isSupportedViteBuildScript", { enumerable: true, get: function () { return pipeline_1.isSupportedViteBuildScript; } });
16
18
  var types_1 = require("./types");
17
19
  Object.defineProperty(exports, "BUILD_PIPELINE_CAPABILITY", { enumerable: true, get: function () { return types_1.BUILD_PIPELINE_CAPABILITY; } });