@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/index.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) {
@@ -17789,6 +17807,7 @@ var init_rewriteImports = __esm(() => {
17789
17807
  var exports_resolveOwningComponents = {};
17790
17808
  __export(exports_resolveOwningComponents, {
17791
17809
  resolveOwningComponents: () => resolveOwningComponents,
17810
+ resolveDescendantsOfParent: () => resolveDescendantsOfParent,
17792
17811
  invalidateResourceIndex: () => invalidateResourceIndex
17793
17812
  });
17794
17813
  import { readdirSync as readdirSync2, readFileSync as readFileSync19, statSync as statSync3 } from "fs";
@@ -17869,11 +17888,23 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
17869
17888
  const kind = ENTITY_DECORATORS[fn2.text];
17870
17889
  if (!kind)
17871
17890
  continue;
17891
+ let extendsName = null;
17892
+ for (const heritage of node.heritageClauses ?? []) {
17893
+ if (heritage.token !== ts3.SyntaxKind.ExtendsKeyword) {
17894
+ continue;
17895
+ }
17896
+ const first = heritage.types[0];
17897
+ if (first && ts3.isIdentifier(first.expression)) {
17898
+ extendsName = first.expression.text;
17899
+ }
17900
+ break;
17901
+ }
17872
17902
  const entry = {
17873
17903
  className: node.name.text,
17874
17904
  kind,
17875
17905
  styleUrls: [],
17876
- templateUrls: []
17906
+ templateUrls: [],
17907
+ extendsName
17877
17908
  };
17878
17909
  const arg = expr.arguments[0];
17879
17910
  if (arg && ts3.isObjectLiteralExpression(arg) && kind === "component") {
@@ -17926,36 +17957,117 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
17926
17957
  out.push(...owners);
17927
17958
  }
17928
17959
  return out;
17929
- }, resourceIndexByRoot, getOrBuildResourceIndex = (userAngularRoot) => {
17930
- const cached = resourceIndexByRoot.get(userAngularRoot);
17960
+ }, indexByRoot, resolveParentClassFile = (parentName, childFilePath, angularRoot) => {
17961
+ let source;
17962
+ try {
17963
+ source = readFileSync19(childFilePath, "utf8");
17964
+ } catch {
17965
+ return null;
17966
+ }
17967
+ const sf = ts3.createSourceFile(childFilePath, source, ts3.ScriptTarget.ES2022, true, ts3.ScriptKind.TS);
17968
+ const childDir = dirname18(childFilePath);
17969
+ for (const stmt of sf.statements) {
17970
+ if (!ts3.isImportDeclaration(stmt))
17971
+ continue;
17972
+ if (!ts3.isStringLiteral(stmt.moduleSpecifier))
17973
+ continue;
17974
+ const clause = stmt.importClause;
17975
+ if (!clause || clause.isTypeOnly)
17976
+ continue;
17977
+ let matchesName = false;
17978
+ if (clause.name && clause.name.text === parentName)
17979
+ matchesName = true;
17980
+ if (!matchesName && clause.namedBindings && ts3.isNamedImports(clause.namedBindings)) {
17981
+ for (const el of clause.namedBindings.elements) {
17982
+ if (el.isTypeOnly)
17983
+ continue;
17984
+ if (el.name.text === parentName) {
17985
+ matchesName = true;
17986
+ break;
17987
+ }
17988
+ }
17989
+ }
17990
+ if (!matchesName)
17991
+ continue;
17992
+ const spec = stmt.moduleSpecifier.text;
17993
+ if (!spec.startsWith(".") && !spec.startsWith("/")) {
17994
+ return null;
17995
+ }
17996
+ const base = resolve33(childDir, spec);
17997
+ const candidates = [
17998
+ `${base}.ts`,
17999
+ `${base}.tsx`,
18000
+ `${base}/index.ts`,
18001
+ `${base}/index.tsx`
18002
+ ];
18003
+ const angularRootNorm = safeNormalize(angularRoot);
18004
+ for (const candidate of candidates) {
18005
+ try {
18006
+ if (statSync3(candidate).isFile()) {
18007
+ const norm = safeNormalize(candidate);
18008
+ if (!norm.startsWith(angularRootNorm))
18009
+ return null;
18010
+ return norm;
18011
+ }
18012
+ } catch {}
18013
+ }
18014
+ return null;
18015
+ }
18016
+ return null;
18017
+ }, getOrBuildIndexes = (userAngularRoot) => {
18018
+ const cached = indexByRoot.get(userAngularRoot);
17931
18019
  if (cached)
17932
18020
  return cached;
17933
- const index = new Map;
18021
+ const resource = new Map;
18022
+ const parentFile = new Map;
17934
18023
  for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
17935
18024
  const classes = parseDecoratedClasses(tsPath);
17936
18025
  const componentDir = dirname18(tsPath);
17937
18026
  for (const cls of classes) {
17938
- if (cls.kind !== "component")
17939
- continue;
17940
- const owner = {
18027
+ const entity = {
17941
18028
  className: cls.className,
17942
18029
  componentFilePath: tsPath,
17943
- kind: "component"
18030
+ kind: cls.kind
17944
18031
  };
17945
- for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
17946
- const abs = safeNormalize(resolve33(componentDir, url));
17947
- const existing = index.get(abs);
17948
- if (existing)
17949
- existing.push(owner);
17950
- else
17951
- index.set(abs, [owner]);
18032
+ if (cls.kind === "component") {
18033
+ for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
18034
+ const abs = safeNormalize(resolve33(componentDir, url));
18035
+ const existing = resource.get(abs);
18036
+ if (existing)
18037
+ existing.push(entity);
18038
+ else
18039
+ resource.set(abs, [entity]);
18040
+ }
18041
+ }
18042
+ if (cls.extendsName !== null) {
18043
+ const parentPath = resolveParentClassFile(cls.extendsName, tsPath, userAngularRoot);
18044
+ if (parentPath !== null && parentPath !== safeNormalize(tsPath)) {
18045
+ const existing = parentFile.get(parentPath);
18046
+ if (existing)
18047
+ existing.push(entity);
18048
+ else
18049
+ parentFile.set(parentPath, [entity]);
18050
+ }
17952
18051
  }
17953
18052
  }
17954
18053
  }
17955
- resourceIndexByRoot.set(userAngularRoot, index);
17956
- return index;
18054
+ const bundle = { parentFile, resource };
18055
+ indexByRoot.set(userAngularRoot, bundle);
18056
+ return bundle;
18057
+ }, getOrBuildResourceIndex = (userAngularRoot) => getOrBuildIndexes(userAngularRoot).resource, resolveDescendantsOfParent = (params) => {
18058
+ const norm = safeNormalize(params.changedFilePath);
18059
+ let rootStat;
18060
+ try {
18061
+ rootStat = statSync3(params.userAngularRoot);
18062
+ } catch {
18063
+ return [];
18064
+ }
18065
+ if (!rootStat.isDirectory())
18066
+ return [];
18067
+ const bundle = getOrBuildIndexes(params.userAngularRoot);
18068
+ return bundle.parentFile.get(norm) ?? [];
17957
18069
  }, invalidateResourceIndex = () => {
17958
- resourceIndexByRoot.clear();
18070
+ indexByRoot.clear();
17959
18071
  };
17960
18072
  var init_resolveOwningComponents = __esm(() => {
17961
18073
  ENTITY_DECORATORS = {
@@ -17964,7 +18076,7 @@ var init_resolveOwningComponents = __esm(() => {
17964
18076
  Pipe: "pipe",
17965
18077
  Injectable: "service"
17966
18078
  };
17967
- resourceIndexByRoot = new Map;
18079
+ indexByRoot = new Map;
17968
18080
  });
17969
18081
 
17970
18082
  // src/dev/angular/hmrImportGenerator.ts
@@ -18644,7 +18756,7 @@ __export(exports_fastHmrCompiler, {
18644
18756
  invalidateFingerprintCache: () => invalidateFingerprintCache
18645
18757
  });
18646
18758
  import { existsSync as existsSync26, readFileSync as readFileSync20, statSync as statSync4 } from "fs";
18647
- import { dirname as dirname19, relative as relative13, resolve as resolve34 } from "path";
18759
+ import { dirname as dirname19, extname as extname10, relative as relative13, resolve as resolve34 } from "path";
18648
18760
  import ts7 from "typescript";
18649
18761
  var fail = (reason, detail, location) => ({
18650
18762
  ok: false,
@@ -18702,6 +18814,74 @@ var fail = (reason, detail, location) => ({
18702
18814
  fingerprintCache.set(id, fp);
18703
18815
  }, invalidateFingerprintCache = () => {
18704
18816
  fingerprintCache.clear();
18817
+ entityFingerprintCache.clear();
18818
+ }, entityFingerprintCache, entityFingerprintsEqual = (a, b2) => {
18819
+ if (a.className !== b2.className)
18820
+ return false;
18821
+ if (a.decoratorArgsText !== b2.decoratorArgsText)
18822
+ return false;
18823
+ if (!arraysEqual(a.ctorParamTypes, b2.ctorParamTypes))
18824
+ return false;
18825
+ if (!arraysEqual(a.topLevelImports, b2.topLevelImports))
18826
+ return false;
18827
+ if (!arraysEqual(a.memberDecoratorSig, b2.memberDecoratorSig))
18828
+ return false;
18829
+ if (!arraysEqual(a.arrowFieldSig, b2.arrowFieldSig))
18830
+ return false;
18831
+ if (!arraysEqual(a.propertyFieldNames, b2.propertyFieldNames))
18832
+ return false;
18833
+ return true;
18834
+ }, ENTITY_DECORATOR_NAMES, findEntityDecorator = (cls) => {
18835
+ for (const dec of ts7.getDecorators(cls) ?? []) {
18836
+ const expr = dec.expression;
18837
+ if (!ts7.isCallExpression(expr))
18838
+ continue;
18839
+ if (!ts7.isIdentifier(expr.expression))
18840
+ continue;
18841
+ if (ENTITY_DECORATOR_NAMES.has(expr.expression.text))
18842
+ return dec;
18843
+ }
18844
+ return null;
18845
+ }, extractEntityFingerprint = (cls, className, sourceFile) => {
18846
+ const decorator = findEntityDecorator(cls);
18847
+ let decoratorArgsText = "";
18848
+ if (decorator !== null) {
18849
+ const expr = decorator.expression;
18850
+ const arg = expr.arguments[0];
18851
+ if (arg !== undefined) {
18852
+ decoratorArgsText = arg.getText().replace(/\s+/g, " ").trim();
18853
+ }
18854
+ }
18855
+ const ctorParamTypes = [];
18856
+ for (const member of cls.members) {
18857
+ if (!ts7.isConstructorDeclaration(member))
18858
+ continue;
18859
+ for (const param of member.parameters) {
18860
+ const typeText = param.type ? param.type.getText() : "";
18861
+ const decorators = ts7.getDecorators(param) ?? [];
18862
+ const decoratorSig = decorators.length === 0 ? "" : decorators.map((d2) => {
18863
+ const e = d2.expression;
18864
+ if (ts7.isCallExpression(e) && ts7.isIdentifier(e.expression)) {
18865
+ const args = e.arguments.map((a) => a.getText()).join(",");
18866
+ return `@${e.expression.text}(${args})`;
18867
+ }
18868
+ if (ts7.isIdentifier(e))
18869
+ return `@${e.text}`;
18870
+ return "@<unknown>";
18871
+ }).join("");
18872
+ ctorParamTypes.push(`${typeText}${decoratorSig}`);
18873
+ }
18874
+ break;
18875
+ }
18876
+ return {
18877
+ className,
18878
+ decoratorArgsText,
18879
+ ctorParamTypes,
18880
+ topLevelImports: extractTopLevelImports(sourceFile),
18881
+ memberDecoratorSig: extractMemberDecoratorSig(cls),
18882
+ arrowFieldSig: extractArrowFieldSig(cls),
18883
+ propertyFieldNames: extractPropertyFieldNames(cls)
18884
+ };
18705
18885
  }, findClassDeclaration = (sourceFile, className) => {
18706
18886
  let found = null;
18707
18887
  const walk = (node) => {
@@ -19664,7 +19844,7 @@ var fail = (reason, detail, location) => ({
19664
19844
  const init = member.initializer;
19665
19845
  if (!init)
19666
19846
  continue;
19667
- if (!ts7.isArrowFunction(init) && !ts7.isFunctionExpression(init)) {
19847
+ if (!ts7.isArrowFunction(init) && !ts7.isFunctionExpression(init) && !ts7.isCallExpression(init) && !ts7.isNewExpression(init)) {
19668
19848
  continue;
19669
19849
  }
19670
19850
  const name = member.name.getText();
@@ -19967,11 +20147,20 @@ ${transpiled}
19967
20147
  if (__desc) Object.defineProperty(${className}.prototype, __name, __desc);
19968
20148
  }
19969
20149
  }${staticPatch}`;
19970
- }, resolveAndReadResource = (componentDir, url) => {
20150
+ }, STYLE_PREPROCESSED_EXT, resolveAndReadStyleResource = (componentDir, url) => {
19971
20151
  const abs = resolve34(componentDir, url);
19972
20152
  if (!existsSync26(abs))
19973
20153
  return null;
19974
- return readFileSync20(abs, "utf8");
20154
+ const ext = extname10(abs).toLowerCase();
20155
+ if (!STYLE_PREPROCESSED_EXT.has(ext) || ext === ".css") {
20156
+ return readFileSync20(abs, "utf8");
20157
+ }
20158
+ try {
20159
+ const { compileStyleFileIfNeededSync: compileStyleFileIfNeededSync2 } = (init_stylePreprocessor(), __toCommonJS(exports_stylePreprocessor));
20160
+ return compileStyleFileIfNeededSync2(abs);
20161
+ } catch {
20162
+ return null;
20163
+ }
19975
20164
  }, collectStyles = (decoratorMeta, componentDir) => {
19976
20165
  const styles = [...decoratorMeta.styles];
19977
20166
  const urls = [];
@@ -19979,7 +20168,7 @@ ${transpiled}
19979
20168
  urls.push(decoratorMeta.styleUrl);
19980
20169
  urls.push(...decoratorMeta.styleUrls);
19981
20170
  for (const url of urls) {
19982
- const css = resolveAndReadResource(componentDir, url);
20171
+ const css = resolveAndReadStyleResource(componentDir, url);
19983
20172
  if (css === null)
19984
20173
  return { styles, missing: url };
19985
20174
  styles.push(css);
@@ -20045,10 +20234,17 @@ ${block}
20045
20234
  }
20046
20235
  const kind = params.kind ?? "component";
20047
20236
  if (kind !== "component") {
20237
+ const entityId = encodeURIComponent(`${relative13(projectRoot, componentFilePath).replace(/\\/g, "/")}@${className}`);
20238
+ const currentEntityFingerprint = extractEntityFingerprint(classNode, className, sourceFile);
20239
+ const cachedEntityFingerprint = entityFingerprintCache.get(entityId);
20240
+ if (cachedEntityFingerprint !== undefined && !entityFingerprintsEqual(cachedEntityFingerprint, currentEntityFingerprint)) {
20241
+ return fail("structural-change", `${kind} ${className} decorator-args or structural surface changed`);
20242
+ }
20048
20243
  const moduleText = buildSimpleEntityModule(classNode, className);
20049
20244
  if (!moduleText) {
20050
20245
  return fail("unexpected-error", `buildSimpleEntityModule returned null for ${className}`);
20051
20246
  }
20247
+ entityFingerprintCache.set(entityId, currentEntityFingerprint);
20052
20248
  return {
20053
20249
  componentSource: sourceFile,
20054
20250
  fingerprintChanged: false,
@@ -20328,6 +20524,12 @@ var init_fastHmrCompiler = __esm(() => {
20328
20524
  init_typescript_translator();
20329
20525
  fingerprintCache = new Map;
20330
20526
  pendingModuleCache = new Map;
20527
+ entityFingerprintCache = new Map;
20528
+ ENTITY_DECORATOR_NAMES = new Set([
20529
+ "Pipe",
20530
+ "Directive",
20531
+ "Injectable"
20532
+ ]);
20331
20533
  VIEW_ENCAPSULATION_VALUES = {
20332
20534
  Emulated: 0,
20333
20535
  ExperimentalIsolatedShadowDom: 4,
@@ -20357,6 +20559,14 @@ var init_fastHmrCompiler = __esm(() => {
20357
20559
  INPUT_OUTPUT_DECORATORS = new Set(["Input", "Output"]);
20358
20560
  providerProbeCache = new Map;
20359
20561
  TS_EXTENSIONS = [".ts", ".tsx", ".d.ts"];
20562
+ STYLE_PREPROCESSED_EXT = new Set([
20563
+ ".scss",
20564
+ ".sass",
20565
+ ".css",
20566
+ ".less",
20567
+ ".styl",
20568
+ ".stylus"
20569
+ ]);
20360
20570
  projectOptionsCache = new Map;
20361
20571
  });
20362
20572
 
@@ -21026,6 +21236,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21026
21236
  let anyFingerprintChanged = false;
21027
21237
  let totalResolveMs = 0;
21028
21238
  let totalCompileMs = 0;
21239
+ const { resolveDescendantsOfParent: resolveDescendantsOfParent2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
21029
21240
  for (const editedFile of userEdited) {
21030
21241
  const resolveStart = performance.now();
21031
21242
  const owners = resolveOwningComponents2({
@@ -21033,6 +21244,20 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21033
21244
  userAngularRoot: angularDir
21034
21245
  });
21035
21246
  totalResolveMs += performance.now() - resolveStart;
21247
+ if (owners.length === 0) {
21248
+ const descendants = resolveDescendantsOfParent2({
21249
+ changedFilePath: editedFile,
21250
+ userAngularRoot: angularDir
21251
+ });
21252
+ if (descendants.length > 0) {
21253
+ const names = descendants.map((d2) => d2.className).slice(0, 3).join(", ");
21254
+ return {
21255
+ kind: "rebootstrap",
21256
+ reason: `parent class file edited; descendant Angular entities (${names}${descendants.length > 3 ? ", ..." : ""}) need to pick up new prototype`,
21257
+ tier: 1
21258
+ };
21259
+ }
21260
+ }
21036
21261
  if (owners.length === 0 && (editedFile.endsWith(".component.ts") || editedFile.endsWith(".directive.ts") || editedFile.endsWith(".pipe.ts") || editedFile.endsWith(".service.ts"))) {
21037
21262
  return {
21038
21263
  kind: "rebootstrap",
@@ -31621,5 +31846,5 @@ export {
31621
31846
  ANGULAR_INIT_TIMEOUT_MS
31622
31847
  };
31623
31848
 
31624
- //# debugId=C219645E0797323764756E2164756E21
31849
+ //# debugId=3C7894D67ABEB41664756E2164756E21
31625
31850
  //# sourceMappingURL=index.js.map