@absolutejs/absolute 0.19.0-beta.939 → 0.19.0-beta.940

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -10226,7 +10226,7 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
10226
10226
  }, createAngularHmrInjectionPlugin = (params) => ({
10227
10227
  name: "absolute-angular-hmr-injection",
10228
10228
  setup(build2) {
10229
- build2.onLoad({ filter: /\.component\.js$/ }, async (args) => {
10229
+ build2.onLoad({ filter: /\.js$/ }, async (args) => {
10230
10230
  const text = await readFile5(args.path, "utf8");
10231
10231
  const transformed = applyAngularHmrInjection(text, args.path, params);
10232
10232
  if (transformed === undefined)
@@ -17806,8 +17806,8 @@ export default {};
17806
17806
  const stat3 = statSync2(filePath);
17807
17807
  const resolvedVueDir = vueDir ? resolve33(vueDir) : undefined;
17808
17808
  let content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
17809
- const isComponentJs = ext === ".js" && filePath.endsWith(".component.js") && filePath.replace(/\\/g, "/").includes("/.absolutejs/generated/angular/");
17810
- if (isComponentJs) {
17809
+ const isAngularGeneratedJs = ext === ".js" && filePath.replace(/\\/g, "/").includes("/.absolutejs/generated/angular/");
17810
+ if (isAngularGeneratedJs) {
17811
17811
  const userAngularRoot = await getAngularUserRoot(projectRoot);
17812
17812
  if (userAngularRoot) {
17813
17813
  const { applyAngularHmrInjection: applyAngularHmrInjection2 } = await Promise.resolve().then(() => (init_hmrInjectionPlugin(), exports_hmrInjectionPlugin));
@@ -19055,6 +19055,12 @@ var fail = (reason, detail, location) => ({
19055
19055
  return false;
19056
19056
  if (a.changeDetection !== b2.changeDetection)
19057
19057
  return false;
19058
+ if (a.importsArraySig !== b2.importsArraySig)
19059
+ return false;
19060
+ if (a.hostDirectivesSig !== b2.hostDirectivesSig)
19061
+ return false;
19062
+ if (a.animationsArraySig !== b2.animationsArraySig)
19063
+ return false;
19058
19064
  return true;
19059
19065
  }, recordFingerprint = (id, fp) => {
19060
19066
  fingerprintCache.set(id, fp);
@@ -19305,6 +19311,8 @@ var fail = (reason, detail, location) => ({
19305
19311
  const styleUrlsExpr = getProperty(args, "styleUrls");
19306
19312
  const stylesExpr = getProperty(args, "styles");
19307
19313
  const importsExpr = getProperty(args, "imports");
19314
+ const hostDirectivesExpr = getProperty(args, "hostDirectives");
19315
+ const animationsExpr = getProperty(args, "animations");
19308
19316
  const styleUrls = [];
19309
19317
  if (styleUrlsExpr && ts7.isArrayLiteralExpression(styleUrlsExpr)) {
19310
19318
  for (const el of styleUrlsExpr.elements) {
@@ -19334,6 +19342,8 @@ var fail = (reason, detail, location) => ({
19334
19342
  hasProviders: getProperty(args, "providers") !== null,
19335
19343
  hasViewProviders: getProperty(args, "viewProviders") !== null,
19336
19344
  importsExpr: importsExpr && ts7.isArrayLiteralExpression(importsExpr) ? importsExpr : null,
19345
+ hostDirectivesExpr: hostDirectivesExpr && ts7.isArrayLiteralExpression(hostDirectivesExpr) ? hostDirectivesExpr : null,
19346
+ animationsExpr: animationsExpr && ts7.isArrayLiteralExpression(animationsExpr) ? animationsExpr : null,
19337
19347
  preserveWhitespaces: getBooleanProperty(args, "preserveWhitespaces") ?? projectDefaults.preserveWhitespaces ?? false,
19338
19348
  selector: getStringProperty(args, "selector"),
19339
19349
  standalone: getBooleanProperty(args, "standalone") ?? true,
@@ -20085,6 +20095,43 @@ var fail = (reason, detail, location) => ({
20085
20095
  h2 = h2 * 33 ^ s2.charCodeAt(i);
20086
20096
  }
20087
20097
  return (h2 >>> 0).toString(36);
20098
+ }, initializerShapeIsStructural = (node) => {
20099
+ if (ts7.isArrowFunction(node) || ts7.isFunctionExpression(node) || ts7.isCallExpression(node) || ts7.isNewExpression(node)) {
20100
+ return true;
20101
+ }
20102
+ if (ts7.isConditionalExpression(node)) {
20103
+ return initializerShapeIsStructural(node.whenTrue) || initializerShapeIsStructural(node.whenFalse);
20104
+ }
20105
+ if (ts7.isParenthesizedExpression(node)) {
20106
+ return initializerShapeIsStructural(node.expression);
20107
+ }
20108
+ if (ts7.isAsExpression(node) || ts7.isTypeAssertionExpression(node)) {
20109
+ return initializerShapeIsStructural(node.expression);
20110
+ }
20111
+ if (ts7.isNonNullExpression(node)) {
20112
+ return initializerShapeIsStructural(node.expression);
20113
+ }
20114
+ if (ts7.isObjectLiteralExpression(node)) {
20115
+ for (const prop of node.properties) {
20116
+ if (ts7.isPropertyAssignment(prop) && initializerShapeIsStructural(prop.initializer)) {
20117
+ return true;
20118
+ }
20119
+ if (ts7.isShorthandPropertyAssignment(prop))
20120
+ continue;
20121
+ if (ts7.isSpreadAssignment(prop) && initializerShapeIsStructural(prop.expression)) {
20122
+ return true;
20123
+ }
20124
+ }
20125
+ return false;
20126
+ }
20127
+ if (ts7.isArrayLiteralExpression(node)) {
20128
+ for (const el of node.elements) {
20129
+ if (initializerShapeIsStructural(el))
20130
+ return true;
20131
+ }
20132
+ return false;
20133
+ }
20134
+ return false;
20088
20135
  }, extractArrowFieldSig = (cls) => {
20089
20136
  const entries = [];
20090
20137
  for (const member of cls.members) {
@@ -20093,9 +20140,8 @@ var fail = (reason, detail, location) => ({
20093
20140
  const init = member.initializer;
20094
20141
  if (!init)
20095
20142
  continue;
20096
- if (!ts7.isArrowFunction(init) && !ts7.isFunctionExpression(init) && !ts7.isCallExpression(init) && !ts7.isNewExpression(init)) {
20143
+ if (!initializerShapeIsStructural(init))
20097
20144
  continue;
20098
- }
20099
20145
  const name = member.name.getText();
20100
20146
  const bodyHash = djb2Hash(init.getText());
20101
20147
  entries.push(`${name}:${bodyHash}`);
@@ -20239,8 +20285,9 @@ var fail = (reason, detail, location) => ({
20239
20285
  }, extractPropertyFieldNames = (cls) => {
20240
20286
  const names = [];
20241
20287
  for (const member of cls.members) {
20242
- if (!ts7.isPropertyDeclaration(member))
20288
+ if (!ts7.isPropertyDeclaration(member) && !ts7.isMethodDeclaration(member) && !ts7.isGetAccessorDeclaration(member) && !ts7.isSetAccessorDeclaration(member)) {
20243
20289
  continue;
20290
+ }
20244
20291
  const name = member.name;
20245
20292
  if (name === undefined)
20246
20293
  continue;
@@ -20305,7 +20352,11 @@ var fail = (reason, detail, location) => ({
20305
20352
  const providerImportSig = extractProviderImportSig(decoratorMeta.importsExpr, sourceFile, componentDir);
20306
20353
  const topLevelImports = extractTopLevelImports(sourceFile);
20307
20354
  const propertyFieldNames = extractPropertyFieldNames(cls);
20355
+ const importsArraySig = decoratorMeta.importsExpr ? djb2Hash(decoratorMeta.importsExpr.getText()) : "";
20356
+ const hostDirectivesSig = decoratorMeta.hostDirectivesExpr ? djb2Hash(decoratorMeta.hostDirectivesExpr.getText()) : "";
20357
+ const animationsArraySig = decoratorMeta.animationsExpr ? djb2Hash(decoratorMeta.animationsExpr.getText()) : "";
20308
20358
  return {
20359
+ animationsArraySig,
20309
20360
  arrowFieldSig,
20310
20361
  changeDetection: decoratorMeta.changeDetection,
20311
20362
  className,
@@ -20313,6 +20364,8 @@ var fail = (reason, detail, location) => ({
20313
20364
  encapsulation: decoratorMeta.encapsulation,
20314
20365
  hasProviders: decoratorMeta.hasProviders,
20315
20366
  hasViewProviders: decoratorMeta.hasViewProviders,
20367
+ hostDirectivesSig,
20368
+ importsArraySig,
20316
20369
  inputs: inputNames,
20317
20370
  memberDecoratorSig,
20318
20371
  outputs: outputNames,
@@ -20498,7 +20551,8 @@ ${block}
20498
20551
  componentSource: sourceFile,
20499
20552
  fingerprintChanged: false,
20500
20553
  moduleText,
20501
- ok: true
20554
+ ok: true,
20555
+ rebootstrapRequired: false
20502
20556
  };
20503
20557
  }
20504
20558
  if (inheritsDecoratedClass(classNode, sourceFile, dirname20(componentFilePath), projectRoot)) {
@@ -20571,6 +20625,7 @@ ${block}
20571
20625
  const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
20572
20626
  const cachedFingerprint = fingerprintCache.get(fingerprintId);
20573
20627
  const fingerprintChanged = cachedFingerprint !== undefined && !fingerprintsEqual(cachedFingerprint, currentFingerprint);
20628
+ const rebootstrapRequired = cachedFingerprint !== undefined && (cachedFingerprint.importsArraySig !== currentFingerprint.importsArraySig || cachedFingerprint.hostDirectivesSig !== currentFingerprint.hostDirectivesSig);
20574
20629
  const sourceFileObj = new compiler.ParseSourceFile(tsSource, componentFilePath);
20575
20630
  const zeroLoc = new compiler.ParseLocation(sourceFileObj, 0, 0, 0);
20576
20631
  const typeSourceSpan = new compiler.ParseSourceSpan(zeroLoc, zeroLoc);
@@ -20757,7 +20812,8 @@ ${block}
20757
20812
  componentSource: sourceFile,
20758
20813
  fingerprintChanged,
20759
20814
  moduleText,
20760
- ok: true
20815
+ ok: true,
20816
+ rebootstrapRequired
20761
20817
  };
20762
20818
  } catch (err) {
20763
20819
  return fail("unexpected-error", String(err));
@@ -21474,6 +21530,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21474
21530
  const queue = [];
21475
21531
  const queueIds = new Set;
21476
21532
  let anyFingerprintChanged = false;
21533
+ let rebootstrapClassName = null;
21477
21534
  let totalResolveMs = 0;
21478
21535
  let totalCompileMs = 0;
21479
21536
  const { resolveDescendantsOfParent: resolveDescendantsOfParent2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
@@ -21542,6 +21599,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21542
21599
  if (result.fingerprintChanged) {
21543
21600
  anyFingerprintChanged = true;
21544
21601
  }
21602
+ if (result.rebootstrapRequired && rebootstrapClassName === null) {
21603
+ rebootstrapClassName = className;
21604
+ }
21545
21605
  queueIds.add(id);
21546
21606
  queue.push({ className, id });
21547
21607
  }
@@ -21551,6 +21611,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21551
21611
  resolveMs: Math.round(totalResolveMs),
21552
21612
  compileMs: Math.round(totalCompileMs)
21553
21613
  };
21614
+ if (rebootstrapClassName !== null) {
21615
+ return {
21616
+ kind: "rebootstrap",
21617
+ reason: `${rebootstrapClassName}: imports/hostDirectives array changed \u2014 directive matching can't be re-run on existing host elements`,
21618
+ tier: 1
21619
+ };
21620
+ }
21554
21621
  if (anyFingerprintChanged) {
21555
21622
  return { breakdown, kind: "remount", queue, tier: 1 };
21556
21623
  }
@@ -32137,5 +32204,5 @@ export {
32137
32204
  ANGULAR_INIT_TIMEOUT_MS
32138
32205
  };
32139
32206
 
32140
- //# debugId=8C6259234C5851DB64756E2164756E21
32207
+ //# debugId=1183B697C8DC280664756E2164756E21
32141
32208
  //# sourceMappingURL=index.js.map