@absolutejs/absolute 0.19.0-beta.925 → 0.19.0-beta.927

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.
Files changed (52) hide show
  1. package/dist/angular/browser.js +19 -1
  2. package/dist/angular/browser.js.map +2 -2
  3. package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
  4. package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
  5. package/dist/angular/index.js +19 -1
  6. package/dist/angular/index.js.map +2 -2
  7. package/dist/angular/server.js +19 -1
  8. package/dist/angular/server.js.map +2 -2
  9. package/dist/build.js +250 -25
  10. package/dist/build.js.map +5 -5
  11. package/dist/client/index.js +19 -1
  12. package/dist/client/index.js.map +2 -2
  13. package/dist/core/streamingSlotRegistrar.js +19 -1
  14. package/dist/core/streamingSlotRegistrar.js.map +2 -2
  15. package/dist/core/streamingSlotRegistry.js +19 -1
  16. package/dist/core/streamingSlotRegistry.js.map +2 -2
  17. package/dist/index.js +250 -25
  18. package/dist/index.js.map +5 -5
  19. package/dist/islands/browser.js +19 -1
  20. package/dist/islands/browser.js.map +2 -2
  21. package/dist/islands/index.js +19 -1
  22. package/dist/islands/index.js.map +2 -2
  23. package/dist/react/browser.js +19 -1
  24. package/dist/react/browser.js.map +2 -2
  25. package/dist/react/components/index.js +19 -1
  26. package/dist/react/components/index.js.map +2 -2
  27. package/dist/react/hooks/index.js +19 -1
  28. package/dist/react/hooks/index.js.map +2 -2
  29. package/dist/react/index.js +19 -1
  30. package/dist/react/index.js.map +2 -2
  31. package/dist/react/jsxDevRuntimeCompat.js +19 -1
  32. package/dist/react/jsxDevRuntimeCompat.js.map +2 -2
  33. package/dist/react/server.js +19 -1
  34. package/dist/react/server.js.map +2 -2
  35. package/dist/src/dev/angular/resolveOwningComponents.d.ts +4 -0
  36. package/dist/svelte/browser.js +19 -1
  37. package/dist/svelte/browser.js.map +2 -2
  38. package/dist/svelte/index.js +19 -1
  39. package/dist/svelte/index.js.map +2 -2
  40. package/dist/svelte/server.js +19 -1
  41. package/dist/svelte/server.js.map +2 -2
  42. package/dist/vue/browser.js +19 -1
  43. package/dist/vue/browser.js.map +2 -2
  44. package/dist/vue/components/Image.js +19 -1
  45. package/dist/vue/components/Image.js.map +2 -2
  46. package/dist/vue/components/index.js +19 -1
  47. package/dist/vue/components/index.js.map +2 -2
  48. package/dist/vue/index.js +19 -1
  49. package/dist/vue/index.js.map +2 -2
  50. package/dist/vue/server.js +19 -1
  51. package/dist/vue/server.js.map +2 -2
  52. package/package.json +1 -1
package/dist/build.js CHANGED
@@ -3,6 +3,7 @@ var __create = Object.create;
3
3
  var __getProtoOf = Object.getPrototypeOf;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  function __accessProp(key) {
8
9
  return this[key];
@@ -29,6 +30,23 @@ var __toESM = (mod, isNodeMode, target) => {
29
30
  cache.set(mod, to);
30
31
  return to;
31
32
  };
33
+ var __toCommonJS = (from) => {
34
+ var entry = (__moduleCache ??= new WeakMap).get(from), desc;
35
+ if (entry)
36
+ return entry;
37
+ entry = __defProp({}, "__esModule", { value: true });
38
+ if (from && typeof from === "object" || typeof from === "function") {
39
+ for (var key of __getOwnPropNames(from))
40
+ if (!__hasOwnProp.call(entry, key))
41
+ __defProp(entry, key, {
42
+ get: __accessProp.bind(from, key),
43
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
44
+ });
45
+ }
46
+ __moduleCache.set(from, entry);
47
+ return entry;
48
+ };
49
+ var __moduleCache;
32
50
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
51
  var __returnValue = (v) => v;
34
52
  function __exportSetter(name, newValue) {
@@ -17692,6 +17710,7 @@ var init_rewriteImports = __esm(() => {
17692
17710
  var exports_resolveOwningComponents = {};
17693
17711
  __export(exports_resolveOwningComponents, {
17694
17712
  resolveOwningComponents: () => resolveOwningComponents,
17713
+ resolveDescendantsOfParent: () => resolveDescendantsOfParent,
17695
17714
  invalidateResourceIndex: () => invalidateResourceIndex
17696
17715
  });
17697
17716
  import { readdirSync as readdirSync2, readFileSync as readFileSync18, statSync as statSync3 } from "fs";
@@ -17772,11 +17791,23 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
17772
17791
  const kind = ENTITY_DECORATORS[fn2.text];
17773
17792
  if (!kind)
17774
17793
  continue;
17794
+ let extendsName = null;
17795
+ for (const heritage of node.heritageClauses ?? []) {
17796
+ if (heritage.token !== ts3.SyntaxKind.ExtendsKeyword) {
17797
+ continue;
17798
+ }
17799
+ const first = heritage.types[0];
17800
+ if (first && ts3.isIdentifier(first.expression)) {
17801
+ extendsName = first.expression.text;
17802
+ }
17803
+ break;
17804
+ }
17775
17805
  const entry = {
17776
17806
  className: node.name.text,
17777
17807
  kind,
17778
17808
  styleUrls: [],
17779
- templateUrls: []
17809
+ templateUrls: [],
17810
+ extendsName
17780
17811
  };
17781
17812
  const arg = expr.arguments[0];
17782
17813
  if (arg && ts3.isObjectLiteralExpression(arg) && kind === "component") {
@@ -17829,36 +17860,117 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
17829
17860
  out.push(...owners);
17830
17861
  }
17831
17862
  return out;
17832
- }, resourceIndexByRoot, getOrBuildResourceIndex = (userAngularRoot) => {
17833
- const cached = resourceIndexByRoot.get(userAngularRoot);
17863
+ }, indexByRoot, resolveParentClassFile = (parentName, childFilePath, angularRoot) => {
17864
+ let source;
17865
+ try {
17866
+ source = readFileSync18(childFilePath, "utf8");
17867
+ } catch {
17868
+ return null;
17869
+ }
17870
+ const sf = ts3.createSourceFile(childFilePath, source, ts3.ScriptTarget.ES2022, true, ts3.ScriptKind.TS);
17871
+ const childDir = dirname17(childFilePath);
17872
+ for (const stmt of sf.statements) {
17873
+ if (!ts3.isImportDeclaration(stmt))
17874
+ continue;
17875
+ if (!ts3.isStringLiteral(stmt.moduleSpecifier))
17876
+ continue;
17877
+ const clause = stmt.importClause;
17878
+ if (!clause || clause.isTypeOnly)
17879
+ continue;
17880
+ let matchesName = false;
17881
+ if (clause.name && clause.name.text === parentName)
17882
+ matchesName = true;
17883
+ if (!matchesName && clause.namedBindings && ts3.isNamedImports(clause.namedBindings)) {
17884
+ for (const el of clause.namedBindings.elements) {
17885
+ if (el.isTypeOnly)
17886
+ continue;
17887
+ if (el.name.text === parentName) {
17888
+ matchesName = true;
17889
+ break;
17890
+ }
17891
+ }
17892
+ }
17893
+ if (!matchesName)
17894
+ continue;
17895
+ const spec = stmt.moduleSpecifier.text;
17896
+ if (!spec.startsWith(".") && !spec.startsWith("/")) {
17897
+ return null;
17898
+ }
17899
+ const base = resolve31(childDir, spec);
17900
+ const candidates = [
17901
+ `${base}.ts`,
17902
+ `${base}.tsx`,
17903
+ `${base}/index.ts`,
17904
+ `${base}/index.tsx`
17905
+ ];
17906
+ const angularRootNorm = safeNormalize(angularRoot);
17907
+ for (const candidate of candidates) {
17908
+ try {
17909
+ if (statSync3(candidate).isFile()) {
17910
+ const norm = safeNormalize(candidate);
17911
+ if (!norm.startsWith(angularRootNorm))
17912
+ return null;
17913
+ return norm;
17914
+ }
17915
+ } catch {}
17916
+ }
17917
+ return null;
17918
+ }
17919
+ return null;
17920
+ }, getOrBuildIndexes = (userAngularRoot) => {
17921
+ const cached = indexByRoot.get(userAngularRoot);
17834
17922
  if (cached)
17835
17923
  return cached;
17836
- const index = new Map;
17924
+ const resource = new Map;
17925
+ const parentFile = new Map;
17837
17926
  for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
17838
17927
  const classes = parseDecoratedClasses(tsPath);
17839
17928
  const componentDir = dirname17(tsPath);
17840
17929
  for (const cls of classes) {
17841
- if (cls.kind !== "component")
17842
- continue;
17843
- const owner = {
17930
+ const entity = {
17844
17931
  className: cls.className,
17845
17932
  componentFilePath: tsPath,
17846
- kind: "component"
17933
+ kind: cls.kind
17847
17934
  };
17848
- for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
17849
- const abs = safeNormalize(resolve31(componentDir, url));
17850
- const existing = index.get(abs);
17851
- if (existing)
17852
- existing.push(owner);
17853
- else
17854
- index.set(abs, [owner]);
17935
+ if (cls.kind === "component") {
17936
+ for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
17937
+ const abs = safeNormalize(resolve31(componentDir, url));
17938
+ const existing = resource.get(abs);
17939
+ if (existing)
17940
+ existing.push(entity);
17941
+ else
17942
+ resource.set(abs, [entity]);
17943
+ }
17944
+ }
17945
+ if (cls.extendsName !== null) {
17946
+ const parentPath = resolveParentClassFile(cls.extendsName, tsPath, userAngularRoot);
17947
+ if (parentPath !== null && parentPath !== safeNormalize(tsPath)) {
17948
+ const existing = parentFile.get(parentPath);
17949
+ if (existing)
17950
+ existing.push(entity);
17951
+ else
17952
+ parentFile.set(parentPath, [entity]);
17953
+ }
17855
17954
  }
17856
17955
  }
17857
17956
  }
17858
- resourceIndexByRoot.set(userAngularRoot, index);
17859
- return index;
17957
+ const bundle = { parentFile, resource };
17958
+ indexByRoot.set(userAngularRoot, bundle);
17959
+ return bundle;
17960
+ }, getOrBuildResourceIndex = (userAngularRoot) => getOrBuildIndexes(userAngularRoot).resource, resolveDescendantsOfParent = (params) => {
17961
+ const norm = safeNormalize(params.changedFilePath);
17962
+ let rootStat;
17963
+ try {
17964
+ rootStat = statSync3(params.userAngularRoot);
17965
+ } catch {
17966
+ return [];
17967
+ }
17968
+ if (!rootStat.isDirectory())
17969
+ return [];
17970
+ const bundle = getOrBuildIndexes(params.userAngularRoot);
17971
+ return bundle.parentFile.get(norm) ?? [];
17860
17972
  }, invalidateResourceIndex = () => {
17861
- resourceIndexByRoot.clear();
17973
+ indexByRoot.clear();
17862
17974
  };
17863
17975
  var init_resolveOwningComponents = __esm(() => {
17864
17976
  ENTITY_DECORATORS = {
@@ -17867,7 +17979,7 @@ var init_resolveOwningComponents = __esm(() => {
17867
17979
  Pipe: "pipe",
17868
17980
  Injectable: "service"
17869
17981
  };
17870
- resourceIndexByRoot = new Map;
17982
+ indexByRoot = new Map;
17871
17983
  });
17872
17984
 
17873
17985
  // src/dev/angular/hmrImportGenerator.ts
@@ -18547,7 +18659,7 @@ __export(exports_fastHmrCompiler, {
18547
18659
  invalidateFingerprintCache: () => invalidateFingerprintCache
18548
18660
  });
18549
18661
  import { existsSync as existsSync25, readFileSync as readFileSync19, statSync as statSync4 } from "fs";
18550
- import { dirname as dirname18, relative as relative13, resolve as resolve32 } from "path";
18662
+ import { dirname as dirname18, extname as extname10, relative as relative13, resolve as resolve32 } from "path";
18551
18663
  import ts7 from "typescript";
18552
18664
  var fail = (reason, detail, location) => ({
18553
18665
  ok: false,
@@ -18605,6 +18717,74 @@ var fail = (reason, detail, location) => ({
18605
18717
  fingerprintCache.set(id, fp);
18606
18718
  }, invalidateFingerprintCache = () => {
18607
18719
  fingerprintCache.clear();
18720
+ entityFingerprintCache.clear();
18721
+ }, entityFingerprintCache, entityFingerprintsEqual = (a, b2) => {
18722
+ if (a.className !== b2.className)
18723
+ return false;
18724
+ if (a.decoratorArgsText !== b2.decoratorArgsText)
18725
+ return false;
18726
+ if (!arraysEqual(a.ctorParamTypes, b2.ctorParamTypes))
18727
+ return false;
18728
+ if (!arraysEqual(a.topLevelImports, b2.topLevelImports))
18729
+ return false;
18730
+ if (!arraysEqual(a.memberDecoratorSig, b2.memberDecoratorSig))
18731
+ return false;
18732
+ if (!arraysEqual(a.arrowFieldSig, b2.arrowFieldSig))
18733
+ return false;
18734
+ if (!arraysEqual(a.propertyFieldNames, b2.propertyFieldNames))
18735
+ return false;
18736
+ return true;
18737
+ }, ENTITY_DECORATOR_NAMES, findEntityDecorator = (cls) => {
18738
+ for (const dec of ts7.getDecorators(cls) ?? []) {
18739
+ const expr = dec.expression;
18740
+ if (!ts7.isCallExpression(expr))
18741
+ continue;
18742
+ if (!ts7.isIdentifier(expr.expression))
18743
+ continue;
18744
+ if (ENTITY_DECORATOR_NAMES.has(expr.expression.text))
18745
+ return dec;
18746
+ }
18747
+ return null;
18748
+ }, extractEntityFingerprint = (cls, className, sourceFile) => {
18749
+ const decorator = findEntityDecorator(cls);
18750
+ let decoratorArgsText = "";
18751
+ if (decorator !== null) {
18752
+ const expr = decorator.expression;
18753
+ const arg = expr.arguments[0];
18754
+ if (arg !== undefined) {
18755
+ decoratorArgsText = arg.getText().replace(/\s+/g, " ").trim();
18756
+ }
18757
+ }
18758
+ const ctorParamTypes = [];
18759
+ for (const member of cls.members) {
18760
+ if (!ts7.isConstructorDeclaration(member))
18761
+ continue;
18762
+ for (const param of member.parameters) {
18763
+ const typeText = param.type ? param.type.getText() : "";
18764
+ const decorators = ts7.getDecorators(param) ?? [];
18765
+ const decoratorSig = decorators.length === 0 ? "" : decorators.map((d2) => {
18766
+ const e = d2.expression;
18767
+ if (ts7.isCallExpression(e) && ts7.isIdentifier(e.expression)) {
18768
+ const args = e.arguments.map((a) => a.getText()).join(",");
18769
+ return `@${e.expression.text}(${args})`;
18770
+ }
18771
+ if (ts7.isIdentifier(e))
18772
+ return `@${e.text}`;
18773
+ return "@<unknown>";
18774
+ }).join("");
18775
+ ctorParamTypes.push(`${typeText}${decoratorSig}`);
18776
+ }
18777
+ break;
18778
+ }
18779
+ return {
18780
+ className,
18781
+ decoratorArgsText,
18782
+ ctorParamTypes,
18783
+ topLevelImports: extractTopLevelImports(sourceFile),
18784
+ memberDecoratorSig: extractMemberDecoratorSig(cls),
18785
+ arrowFieldSig: extractArrowFieldSig(cls),
18786
+ propertyFieldNames: extractPropertyFieldNames(cls)
18787
+ };
18608
18788
  }, findClassDeclaration = (sourceFile, className) => {
18609
18789
  let found = null;
18610
18790
  const walk = (node) => {
@@ -19567,7 +19747,7 @@ var fail = (reason, detail, location) => ({
19567
19747
  const init = member.initializer;
19568
19748
  if (!init)
19569
19749
  continue;
19570
- if (!ts7.isArrowFunction(init) && !ts7.isFunctionExpression(init)) {
19750
+ if (!ts7.isArrowFunction(init) && !ts7.isFunctionExpression(init) && !ts7.isCallExpression(init) && !ts7.isNewExpression(init)) {
19571
19751
  continue;
19572
19752
  }
19573
19753
  const name = member.name.getText();
@@ -19870,11 +20050,20 @@ ${transpiled}
19870
20050
  if (__desc) Object.defineProperty(${className}.prototype, __name, __desc);
19871
20051
  }
19872
20052
  }${staticPatch}`;
19873
- }, resolveAndReadResource = (componentDir, url) => {
20053
+ }, STYLE_PREPROCESSED_EXT, resolveAndReadStyleResource = (componentDir, url) => {
19874
20054
  const abs = resolve32(componentDir, url);
19875
20055
  if (!existsSync25(abs))
19876
20056
  return null;
19877
- return readFileSync19(abs, "utf8");
20057
+ const ext = extname10(abs).toLowerCase();
20058
+ if (!STYLE_PREPROCESSED_EXT.has(ext) || ext === ".css") {
20059
+ return readFileSync19(abs, "utf8");
20060
+ }
20061
+ try {
20062
+ const { compileStyleFileIfNeededSync: compileStyleFileIfNeededSync2 } = (init_stylePreprocessor(), __toCommonJS(exports_stylePreprocessor));
20063
+ return compileStyleFileIfNeededSync2(abs);
20064
+ } catch {
20065
+ return null;
20066
+ }
19878
20067
  }, collectStyles = (decoratorMeta, componentDir) => {
19879
20068
  const styles = [...decoratorMeta.styles];
19880
20069
  const urls = [];
@@ -19882,7 +20071,7 @@ ${transpiled}
19882
20071
  urls.push(decoratorMeta.styleUrl);
19883
20072
  urls.push(...decoratorMeta.styleUrls);
19884
20073
  for (const url of urls) {
19885
- const css = resolveAndReadResource(componentDir, url);
20074
+ const css = resolveAndReadStyleResource(componentDir, url);
19886
20075
  if (css === null)
19887
20076
  return { styles, missing: url };
19888
20077
  styles.push(css);
@@ -19948,10 +20137,17 @@ ${block}
19948
20137
  }
19949
20138
  const kind = params.kind ?? "component";
19950
20139
  if (kind !== "component") {
20140
+ const entityId = encodeURIComponent(`${relative13(projectRoot, componentFilePath).replace(/\\/g, "/")}@${className}`);
20141
+ const currentEntityFingerprint = extractEntityFingerprint(classNode, className, sourceFile);
20142
+ const cachedEntityFingerprint = entityFingerprintCache.get(entityId);
20143
+ if (cachedEntityFingerprint !== undefined && !entityFingerprintsEqual(cachedEntityFingerprint, currentEntityFingerprint)) {
20144
+ return fail("structural-change", `${kind} ${className} decorator-args or structural surface changed`);
20145
+ }
19951
20146
  const moduleText = buildSimpleEntityModule(classNode, className);
19952
20147
  if (!moduleText) {
19953
20148
  return fail("unexpected-error", `buildSimpleEntityModule returned null for ${className}`);
19954
20149
  }
20150
+ entityFingerprintCache.set(entityId, currentEntityFingerprint);
19955
20151
  return {
19956
20152
  componentSource: sourceFile,
19957
20153
  fingerprintChanged: false,
@@ -20231,6 +20427,12 @@ var init_fastHmrCompiler = __esm(() => {
20231
20427
  init_typescript_translator();
20232
20428
  fingerprintCache = new Map;
20233
20429
  pendingModuleCache = new Map;
20430
+ entityFingerprintCache = new Map;
20431
+ ENTITY_DECORATOR_NAMES = new Set([
20432
+ "Pipe",
20433
+ "Directive",
20434
+ "Injectable"
20435
+ ]);
20234
20436
  VIEW_ENCAPSULATION_VALUES = {
20235
20437
  Emulated: 0,
20236
20438
  ExperimentalIsolatedShadowDom: 4,
@@ -20260,6 +20462,14 @@ var init_fastHmrCompiler = __esm(() => {
20260
20462
  INPUT_OUTPUT_DECORATORS = new Set(["Input", "Output"]);
20261
20463
  providerProbeCache = new Map;
20262
20464
  TS_EXTENSIONS = [".ts", ".tsx", ".d.ts"];
20465
+ STYLE_PREPROCESSED_EXT = new Set([
20466
+ ".scss",
20467
+ ".sass",
20468
+ ".css",
20469
+ ".less",
20470
+ ".styl",
20471
+ ".stylus"
20472
+ ]);
20263
20473
  projectOptionsCache = new Map;
20264
20474
  });
20265
20475
 
@@ -20929,6 +21139,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20929
21139
  let anyFingerprintChanged = false;
20930
21140
  let totalResolveMs = 0;
20931
21141
  let totalCompileMs = 0;
21142
+ const { resolveDescendantsOfParent: resolveDescendantsOfParent2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
20932
21143
  for (const editedFile of userEdited) {
20933
21144
  const resolveStart = performance.now();
20934
21145
  const owners = resolveOwningComponents2({
@@ -20936,6 +21147,20 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20936
21147
  userAngularRoot: angularDir
20937
21148
  });
20938
21149
  totalResolveMs += performance.now() - resolveStart;
21150
+ if (owners.length === 0) {
21151
+ const descendants = resolveDescendantsOfParent2({
21152
+ changedFilePath: editedFile,
21153
+ userAngularRoot: angularDir
21154
+ });
21155
+ if (descendants.length > 0) {
21156
+ const names = descendants.map((d2) => d2.className).slice(0, 3).join(", ");
21157
+ return {
21158
+ kind: "rebootstrap",
21159
+ reason: `parent class file edited; descendant Angular entities (${names}${descendants.length > 3 ? ", ..." : ""}) need to pick up new prototype`,
21160
+ tier: 1
21161
+ };
21162
+ }
21163
+ }
20939
21164
  if (owners.length === 0 && (editedFile.endsWith(".component.ts") || editedFile.endsWith(".directive.ts") || editedFile.endsWith(".pipe.ts") || editedFile.endsWith(".service.ts"))) {
20940
21165
  return {
20941
21166
  kind: "rebootstrap",
@@ -22963,5 +23188,5 @@ export {
22963
23188
  build
22964
23189
  };
22965
23190
 
22966
- //# debugId=9A589DD8147B77D664756E2164756E21
23191
+ //# debugId=4CA7FE700831304F64756E2164756E21
22967
23192
  //# sourceMappingURL=build.js.map