@absolutejs/absolute 0.19.0-beta.735 → 0.19.0-beta.736

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
@@ -42200,78 +42200,79 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
42200
42200
  import { existsSync as existsSync13, mkdirSync as mkdirSync5, readFileSync as readFileSync9, writeFileSync as writeFileSync6 } from "fs";
42201
42201
  import { dirname as dirname8, join as join11, relative as relative5, resolve as resolve14 } from "path";
42202
42202
  import { createHash } from "crypto";
42203
- var CACHE_DIR, angularLinkerPlugin;
42204
- var init_angularLinkerPlugin = __esm(() => {
42205
- CACHE_DIR = resolve14(".absolutejs", "cache", "angular-linker");
42206
- angularLinkerPlugin = {
42207
- name: "angular-linker",
42208
- setup(bld) {
42209
- let needsLinking;
42210
- let babelTransform;
42211
- let linkerPlugin;
42212
- bld.onLoad({ filter: /[\\/]@angular[\\/].*\.m?js$/ }, async (args) => {
42213
- const source = await Bun.file(args.path).text();
42214
- if (!needsLinking) {
42215
- const specifier = "@angular/compiler-cli/linker";
42216
- const mod = await import(specifier);
42217
- ({ needsLinking } = mod);
42218
- }
42219
- const checkLink = needsLinking;
42220
- if (!checkLink || !checkLink(args.path, source)) {
42221
- return;
42222
- }
42223
- const hash = createHash("md5").update(source).digest("hex");
42224
- const cachePath = join11(CACHE_DIR, `${hash}.js`);
42225
- if (existsSync13(cachePath)) {
42226
- return {
42227
- contents: readFileSync9(cachePath, "utf-8"),
42228
- loader: "js"
42229
- };
42230
- }
42231
- if (!babelTransform) {
42232
- const babelSpecifier = "@babel/core";
42233
- const babel = await import(babelSpecifier);
42234
- babelTransform = babel.transformSync;
42235
- }
42236
- if (!linkerPlugin) {
42237
- const linkerSpecifier = "@angular/compiler-cli/linker/babel";
42238
- const mod = await import(linkerSpecifier);
42239
- linkerPlugin = mod.createEs2015LinkerPlugin({
42240
- fileSystem: {
42241
- dirname: dirname8,
42242
- exists: existsSync13,
42243
- readFile: readFileSync9,
42244
- relative: relative5,
42245
- resolve: resolve14
42246
- },
42247
- linkerJitMode: false,
42248
- logger: {
42249
- error: console.error,
42250
- level: 1,
42251
- warn: console.warn,
42252
- debug: () => {},
42253
- info: () => {}
42254
- }
42255
- });
42256
- }
42257
- const transform = babelTransform;
42258
- if (!transform) {
42259
- return { contents: source, loader: "js" };
42260
- }
42261
- const result = transform(source, {
42262
- compact: false,
42263
- filename: args.path,
42264
- filenameRelative: args.path,
42265
- plugins: [linkerPlugin],
42266
- sourceMaps: false
42203
+ var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
42204
+ name: "angular-linker",
42205
+ setup(bld) {
42206
+ let needsLinking;
42207
+ let babelTransform;
42208
+ let linkerPlugin;
42209
+ const cacheDir = join11(CACHE_ROOT, linkerJitMode ? "jit" : "aot");
42210
+ bld.onLoad({ filter: /[\\/]@angular[\\/].*\.m?js$/ }, async (args) => {
42211
+ const source = await Bun.file(args.path).text();
42212
+ if (!needsLinking) {
42213
+ const specifier = "@angular/compiler-cli/linker";
42214
+ const mod = await import(specifier);
42215
+ ({ needsLinking } = mod);
42216
+ }
42217
+ const checkLink = needsLinking;
42218
+ if (!checkLink || !checkLink(args.path, source)) {
42219
+ return;
42220
+ }
42221
+ const hash = createHash("md5").update(source).digest("hex");
42222
+ const cachePath = join11(cacheDir, `${hash}.js`);
42223
+ if (existsSync13(cachePath)) {
42224
+ return {
42225
+ contents: readFileSync9(cachePath, "utf-8"),
42226
+ loader: "js"
42227
+ };
42228
+ }
42229
+ if (!babelTransform) {
42230
+ const babelSpecifier = "@babel/core";
42231
+ const babel = await import(babelSpecifier);
42232
+ babelTransform = babel.transformSync;
42233
+ }
42234
+ if (!linkerPlugin) {
42235
+ const linkerSpecifier = "@angular/compiler-cli/linker/babel";
42236
+ const mod = await import(linkerSpecifier);
42237
+ linkerPlugin = mod.createEs2015LinkerPlugin({
42238
+ fileSystem: {
42239
+ dirname: dirname8,
42240
+ exists: existsSync13,
42241
+ readFile: readFileSync9,
42242
+ relative: relative5,
42243
+ resolve: resolve14
42244
+ },
42245
+ linkerJitMode,
42246
+ logger: {
42247
+ error: console.error,
42248
+ level: 1,
42249
+ warn: console.warn,
42250
+ debug: () => {},
42251
+ info: () => {}
42252
+ }
42267
42253
  });
42268
- const linked = result?.code ?? source;
42269
- mkdirSync5(CACHE_DIR, { recursive: true });
42270
- writeFileSync6(cachePath, linked, "utf-8");
42271
- return { contents: linked, loader: "js" };
42254
+ }
42255
+ const transform = babelTransform;
42256
+ if (!transform) {
42257
+ return { contents: source, loader: "js" };
42258
+ }
42259
+ const result = transform(source, {
42260
+ compact: false,
42261
+ filename: args.path,
42262
+ filenameRelative: args.path,
42263
+ plugins: [linkerPlugin],
42264
+ sourceMaps: false
42272
42265
  });
42273
- }
42274
- };
42266
+ const linked = result?.code ?? source;
42267
+ mkdirSync5(cacheDir, { recursive: true });
42268
+ writeFileSync6(cachePath, linked, "utf-8");
42269
+ return { contents: linked, loader: "js" };
42270
+ });
42271
+ }
42272
+ }), angularLinkerPlugin;
42273
+ var init_angularLinkerPlugin = __esm(() => {
42274
+ CACHE_ROOT = resolve14(".absolutejs", "cache", "angular-linker");
42275
+ angularLinkerPlugin = createAngularLinkerPlugin(false);
42275
42276
  });
42276
42277
 
42277
42278
  // src/utils/cleanStaleOutputs.ts
@@ -44777,7 +44778,7 @@ var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS,
44777
44778
  angular.add(spec);
44778
44779
  await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
44779
44780
  return Array.from(angular).filter(isResolvable2);
44780
- }, buildAngularVendor = async (buildDir, directories = []) => {
44781
+ }, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false) => {
44781
44782
  const vendorDir = join17(buildDir, "angular", "vendor");
44782
44783
  mkdirSync7(vendorDir, { recursive: true });
44783
44784
  const tmpDir = join17(buildDir, "_angular_vendor_tmp");
@@ -44795,7 +44796,7 @@ var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS,
44795
44796
  minify: false,
44796
44797
  naming: "[name].[ext]",
44797
44798
  outdir: vendorDir,
44798
- plugins: [angularLinkerPlugin],
44799
+ plugins: [createAngularLinkerPlugin(linkerJitMode)],
44799
44800
  splitting: true,
44800
44801
  target: "browser",
44801
44802
  throw: false
@@ -45800,7 +45801,7 @@ ${content.slice(firstUseIdx)}`;
45800
45801
  outdir: buildPath,
45801
45802
  plugins: [
45802
45803
  stylePreprocessorPlugin2,
45803
- ...angularDir ? [angularLinkerPlugin] : [],
45804
+ ...angularDir ? [createAngularLinkerPlugin(hmr)] : [],
45804
45805
  ...htmlScriptPlugin ? [htmlScriptPlugin] : []
45805
45806
  ],
45806
45807
  root: clientRoot,
@@ -45819,7 +45820,7 @@ ${content.slice(firstUseIdx)}`;
45819
45820
  outdir: buildPath,
45820
45821
  plugins: [
45821
45822
  stylePreprocessorPlugin2,
45822
- ...angularDir ? [angularLinkerPlugin] : []
45823
+ ...angularDir ? [createAngularLinkerPlugin(hmr)] : []
45823
45824
  ],
45824
45825
  root: islandEntryResult.generatedRoot,
45825
45826
  splitting: !isDev2,
@@ -49843,7 +49844,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
49843
49844
  const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
49844
49845
  const [, angularSpecs, , , depPaths] = await Promise.all([
49845
49846
  config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
49846
- config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir, sourceDirs) : Promise.resolve(undefined),
49847
+ config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir, sourceDirs, true) : Promise.resolve(undefined),
49847
49848
  config.svelteDirectory ? buildSvelteVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
49848
49849
  config.vueDirectory ? buildVueVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
49849
49850
  buildDepVendor2(state.resolvedPaths.buildDir, sourceDirs)
@@ -58325,5 +58326,5 @@ export {
58325
58326
  ANGULAR_INIT_TIMEOUT_MS
58326
58327
  };
58327
58328
 
58328
- //# debugId=4F8041289BACD62064756E2164756E21
58329
+ //# debugId=2561B31C4102BB4864756E2164756E21
58329
58330
  //# sourceMappingURL=index.js.map