@absolutejs/absolute 0.19.0-beta.690 → 0.19.0-beta.691

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.
@@ -1354,8 +1354,9 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
1354
1354
  // src/build/stylePreprocessor.ts
1355
1355
  import { readFileSync as readFileSync3 } from "fs";
1356
1356
  import { readFile } from "fs/promises";
1357
- import { dirname as dirname2, extname } from "path";
1358
- var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
1357
+ import { createRequire } from "module";
1358
+ import { dirname as dirname2, extname, join as join3 } from "path";
1359
+ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, requireFromCwd, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
1359
1360
  const normalized = filePathOrLanguage.toLowerCase();
1360
1361
  if (normalized === "scss" || normalized.endsWith(".scss"))
1361
1362
  return "scss";
@@ -1364,7 +1365,13 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
1364
1365
  if (normalized === "less" || normalized.endsWith(".less"))
1365
1366
  return "less";
1366
1367
  return null;
1367
- }, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), compileStyleSource = async (filePath, source, languageHint) => {
1368
+ }, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), requireOptionalPeerSync = (specifier) => {
1369
+ try {
1370
+ return requireFromCwd(specifier);
1371
+ } catch {
1372
+ return requireOptionalPeer(specifier);
1373
+ }
1374
+ }, compileStyleSource = async (filePath, source, languageHint) => {
1368
1375
  const language = getStyleLanguage(languageHint ?? filePath);
1369
1376
  const contents = source ?? await readFile(filePath, "utf-8");
1370
1377
  if (language === "scss" || language === "sass") {
@@ -1425,7 +1432,7 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
1425
1432
  if (language === "scss" || language === "sass") {
1426
1433
  let sass;
1427
1434
  try {
1428
- sass = requireOptionalPeer("sass");
1435
+ sass = requireOptionalPeerSync("sass");
1429
1436
  } catch {
1430
1437
  throw missingDependencyError("sass", filePath);
1431
1438
  }
@@ -1447,6 +1454,7 @@ var init_stylePreprocessor = __esm(() => {
1447
1454
  STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less)$/i;
1448
1455
  importOptionalPeer = new Function("specifier", "return import(specifier)");
1449
1456
  requireOptionalPeer = new Function("specifier", "return require(specifier)");
1457
+ requireFromCwd = createRequire(join3(process.cwd(), "package.json"));
1450
1458
  stylePreprocessorPlugin = {
1451
1459
  name: "absolute-style-preprocessor",
1452
1460
  setup(build) {
@@ -1485,13 +1493,13 @@ var init_stylePreprocessor = __esm(() => {
1485
1493
 
1486
1494
  // src/core/svelteServerModule.ts
1487
1495
  import { mkdir, readdir } from "fs/promises";
1488
- import { basename as basename2, dirname as dirname3, extname as extname2, join as join3, relative, resolve as resolve4 } from "path";
1496
+ import { basename as basename2, dirname as dirname3, extname as extname2, join as join4, relative, resolve as resolve4 } from "path";
1489
1497
  var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
1490
1498
  const importPath = relative(dirname3(from), target).replace(/\\/g, "/");
1491
1499
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
1492
1500
  }, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
1493
1501
  for (const entry of entries) {
1494
- const entryPath = join3(dir, entry.name);
1502
+ const entryPath = join4(dir, entry.name);
1495
1503
  if (entry.isDirectory())
1496
1504
  stack.push(entryPath);
1497
1505
  if (entry.isFile() && entry.name === targetFileName) {
@@ -1521,11 +1529,11 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
1521
1529
  if (cachedPath !== undefined) {
1522
1530
  return cachedPath;
1523
1531
  }
1524
- if (!sourcePath.includes(`${join3(process.cwd(), "build")}${process.platform === "win32" ? "" : "/"}`) && !sourcePath.includes("/build/")) {
1532
+ if (!sourcePath.includes(`${join4(process.cwd(), "build")}${process.platform === "win32" ? "" : "/"}`) && !sourcePath.includes("/build/")) {
1525
1533
  originalSourcePathCache.set(sourcePath, sourcePath);
1526
1534
  return sourcePath;
1527
1535
  }
1528
- const resolvedSourcePath = await findSourceFileByBasename(join3(process.cwd(), "src"), normalizeBuiltSvelteFileName(sourcePath));
1536
+ const resolvedSourcePath = await findSourceFileByBasename(join4(process.cwd(), "src"), normalizeBuiltSvelteFileName(sourcePath));
1529
1537
  const nextPath = resolvedSourcePath ?? sourcePath;
1530
1538
  originalSourcePathCache.set(sourcePath, nextPath);
1531
1539
  return nextPath;
@@ -1541,11 +1549,11 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
1541
1549
  `${basePath}.mjs`,
1542
1550
  `${basePath}.cjs`,
1543
1551
  `${basePath}.json`,
1544
- join3(basePath, "index.ts"),
1545
- join3(basePath, "index.js"),
1546
- join3(basePath, "index.mjs"),
1547
- join3(basePath, "index.cjs"),
1548
- join3(basePath, "index.json")
1552
+ join4(basePath, "index.ts"),
1553
+ join4(basePath, "index.js"),
1554
+ join4(basePath, "index.mjs"),
1555
+ join4(basePath, "index.cjs"),
1556
+ join4(basePath, "index.json")
1549
1557
  ];
1550
1558
  const existResults = await Promise.all(candidates.map((candidate) => Bun.file(candidate).exists()));
1551
1559
  const foundIndex = existResults.indexOf(true);
@@ -1553,7 +1561,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
1553
1561
  }, getCachedModulePath = (sourcePath) => {
1554
1562
  const relativeSourcePath = relative(process.cwd(), sourcePath).replace(/\\/g, "/");
1555
1563
  const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
1556
- return join3(serverCacheRoot, `${normalizedSourcePath}.server.js`);
1564
+ return join4(serverCacheRoot, `${normalizedSourcePath}.server.js`);
1557
1565
  }, resolveSvelteImport = async (spec, from) => {
1558
1566
  if (!spec.startsWith(".") && !spec.startsWith("/")) {
1559
1567
  const resolved = resolvePackageImport(spec);
@@ -1654,7 +1662,7 @@ var init_svelteServerModule = __esm(() => {
1654
1662
  init_lowerIslandSyntax();
1655
1663
  init_lowerAwaitSlotSyntax();
1656
1664
  init_stylePreprocessor();
1657
- serverCacheRoot = join3(process.cwd(), ".absolutejs", "islands", "svelte");
1665
+ serverCacheRoot = join4(process.cwd(), ".absolutejs", "islands", "svelte");
1658
1666
  compiledModuleCache = new Map;
1659
1667
  originalSourcePathCache = new Map;
1660
1668
  transpiler = new Bun.Transpiler({
@@ -3539,7 +3547,7 @@ __export(exports_compileAngular, {
3539
3547
  compileAngular: () => compileAngular
3540
3548
  });
3541
3549
  import { existsSync as existsSync4, readFileSync as readFileSync4, promises as fs } from "fs";
3542
- import { join as join4, basename as basename3, sep, dirname as dirname4, resolve as resolve5, relative as relative2 } from "path";
3550
+ import { join as join5, basename as basename3, sep, dirname as dirname4, resolve as resolve5, relative as relative2 } from "path";
3543
3551
  import ts from "typescript";
3544
3552
  import { createHash } from "crypto";
3545
3553
  var computeConfigHash = () => {
@@ -3650,7 +3658,7 @@ ${registrations}
3650
3658
  const originalGetSourceFile = host.getSourceFile;
3651
3659
  host.getSourceFile = (fileName, languageVersion, onError) => {
3652
3660
  if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
3653
- const resolvedPath = join4(tsLibDir, fileName);
3661
+ const resolvedPath = join5(tsLibDir, fileName);
3654
3662
  return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
3655
3663
  }
3656
3664
  return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
@@ -3708,7 +3716,7 @@ ${registrations}
3708
3716
  }
3709
3717
  throwOnCompilationErrors(diagnostics);
3710
3718
  const entries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => {
3711
- const target = join4(outDir, fileName);
3719
+ const target = join5(outDir, fileName);
3712
3720
  let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
3713
3721
  if (!path.match(/\.(js|ts|mjs|cjs)$/)) {
3714
3722
  return `from ${quote}${path}.js${quote}`;
@@ -3864,7 +3872,7 @@ ${fields}
3864
3872
  }, inlineTemplateAndLowerDefer = async (source, fileDir) => {
3865
3873
  const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
3866
3874
  if (templateUrlMatch?.[1]) {
3867
- const templatePath = join4(fileDir, templateUrlMatch[1]);
3875
+ const templatePath = join5(fileDir, templateUrlMatch[1]);
3868
3876
  if (!existsSync4(templatePath)) {
3869
3877
  return { deferSlots: [], source };
3870
3878
  }
@@ -3895,7 +3903,7 @@ ${fields}
3895
3903
  }, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
3896
3904
  const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
3897
3905
  if (templateUrlMatch?.[1]) {
3898
- const templatePath = join4(fileDir, templateUrlMatch[1]);
3906
+ const templatePath = join5(fileDir, templateUrlMatch[1]);
3899
3907
  if (!existsSync4(templatePath)) {
3900
3908
  return { deferSlots: [], source };
3901
3909
  }
@@ -3937,7 +3945,7 @@ ${fields}
3937
3945
  return source;
3938
3946
  const inlinedStyles = urlMatches.map((urlMatch) => {
3939
3947
  const styleUrl = urlMatch.replace(/['"]/g, "");
3940
- return readAndEscapeFileSync(join4(fileDir, styleUrl));
3948
+ return readAndEscapeFileSync(join5(fileDir, styleUrl));
3941
3949
  }).filter(Boolean).map((escaped) => `\`${escaped}\``);
3942
3950
  if (inlinedStyles.length === 0)
3943
3951
  return source;
@@ -3946,7 +3954,7 @@ ${fields}
3946
3954
  const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
3947
3955
  if (!styleUrlMatch?.[1])
3948
3956
  return source;
3949
- const escaped = readAndEscapeFileSync(join4(fileDir, styleUrlMatch[1]));
3957
+ const escaped = readAndEscapeFileSync(join5(fileDir, styleUrlMatch[1]));
3950
3958
  if (!escaped)
3951
3959
  return source;
3952
3960
  return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
@@ -3968,7 +3976,7 @@ ${fields}
3968
3976
  return source;
3969
3977
  const stylePromises = urlMatches.map((urlMatch) => {
3970
3978
  const styleUrl = urlMatch.replace(/['"]/g, "");
3971
- return readAndEscapeFile(join4(fileDir, styleUrl));
3979
+ return readAndEscapeFile(join5(fileDir, styleUrl));
3972
3980
  });
3973
3981
  const results = await Promise.all(stylePromises);
3974
3982
  const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
@@ -3979,7 +3987,7 @@ ${fields}
3979
3987
  const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
3980
3988
  if (!styleUrlMatch?.[1])
3981
3989
  return source;
3982
- const escaped = await readAndEscapeFile(join4(fileDir, styleUrlMatch[1]));
3990
+ const escaped = await readAndEscapeFile(join5(fileDir, styleUrlMatch[1]));
3983
3991
  if (!escaped)
3984
3992
  return source;
3985
3993
  return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
@@ -4054,8 +4062,8 @@ ${fields}
4054
4062
  const inputDir = dirname4(actualPath);
4055
4063
  const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
4056
4064
  const fileBase = basename3(actualPath).replace(/\.ts$/, ".js");
4057
- const targetDir = join4(outDir, relativeDir);
4058
- const targetPath = join4(targetDir, fileBase);
4065
+ const targetDir = join5(outDir, relativeDir);
4066
+ const targetPath = join5(targetDir, fileBase);
4059
4067
  const localImports = [];
4060
4068
  const fromRegex = /(?:from|import)\s+['"](\.\.?\/[^'"]+)['"]/g;
4061
4069
  const dynamicImportRegex = /import\(\s*['"](\.\.?\/[^'"]+)['"]\s*\)/g;
@@ -4088,13 +4096,13 @@ ${fields}
4088
4096
  await transpileFile(inputPath);
4089
4097
  return allOutputs;
4090
4098
  }, compileAngular = async (entryPoints, outRoot, hmr = false) => {
4091
- const compiledParent = join4(outRoot, "generated");
4099
+ const compiledParent = join5(outRoot, "generated");
4092
4100
  if (entryPoints.length === 0) {
4093
4101
  const emptyPaths = [];
4094
4102
  return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
4095
4103
  }
4096
4104
  const compiledRoot = compiledParent;
4097
- const indexesDir = join4(compiledParent, "indexes");
4105
+ const indexesDir = join5(compiledParent, "indexes");
4098
4106
  await fs.mkdir(indexesDir, { recursive: true });
4099
4107
  const compileTasks = entryPoints.map(async (entry) => {
4100
4108
  const resolvedEntry = resolve5(entry);
@@ -4104,9 +4112,9 @@ ${fields}
4104
4112
  const fileBase = basename3(resolvedEntry).replace(/\.[tj]s$/, "");
4105
4113
  const jsName = `${fileBase}.js`;
4106
4114
  const compiledFallbackPaths = [
4107
- join4(compiledRoot, relativeEntry),
4108
- join4(compiledRoot, "pages", jsName),
4109
- join4(compiledRoot, jsName)
4115
+ join5(compiledRoot, relativeEntry),
4116
+ join5(compiledRoot, "pages", jsName),
4117
+ join5(compiledRoot, jsName)
4110
4118
  ].map((file) => resolve5(file));
4111
4119
  const resolveRawServerFile = (candidatePaths) => {
4112
4120
  const normalizedCandidates = [
@@ -4140,7 +4148,7 @@ ${fields}
4140
4148
  const componentClassName = `${toPascal(fileBase)}Component`;
4141
4149
  const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
4142
4150
  const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
4143
- const clientFile = join4(indexesDir, jsName);
4151
+ const clientFile = join5(indexesDir, jsName);
4144
4152
  if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync4(clientFile)) {
4145
4153
  return {
4146
4154
  clientPath: clientFile,
@@ -4328,8 +4336,8 @@ var init_compileAngular = __esm(() => {
4328
4336
  init_lowerDeferSyntax();
4329
4337
  init_stylePreprocessor();
4330
4338
  devClientDir = resolveDevClientDir();
4331
- hmrClientPath = join4(devClientDir, "hmrClient.ts").replace(/\\/g, "/");
4332
- hmrRuntimePath = join4(devClientDir, "handlers", "angularRuntime.ts").replace(/\\/g, "/");
4339
+ hmrClientPath = join5(devClientDir, "hmrClient.ts").replace(/\\/g, "/");
4340
+ hmrRuntimePath = join5(devClientDir, "handlers", "angularRuntime.ts").replace(/\\/g, "/");
4333
4341
  jitContentCache = new Map;
4334
4342
  wrapperOutputCache = new Map;
4335
4343
  });
@@ -4338,15 +4346,15 @@ var init_compileAngular = __esm(() => {
4338
4346
  import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
4339
4347
  import { mkdir as mkdir2, symlink } from "fs/promises";
4340
4348
  import { tmpdir } from "os";
4341
- import { basename as basename4, dirname as dirname5, join as join5, resolve as resolve6 } from "path";
4349
+ import { basename as basename4, dirname as dirname5, join as join6, resolve as resolve6 } from "path";
4342
4350
  var ssrDirty = false, lastSelector = "angular-page", isRecord5 = (value) => typeof value === "object" && value !== null, isAngularComponent = (value) => typeof value === "function", compilerImportPromise = null, ensureAngularCompiler = () => {
4343
4351
  if (!compilerImportPromise) {
4344
4352
  compilerImportPromise = import("@angular/compiler");
4345
4353
  }
4346
4354
  return compilerImportPromise;
4347
- }, readAngularPageModule = (value) => isRecord5(value) ? value : null, resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ?? join5(tmpdir(), "absolutejs", "generated", "angular-ssr"), ensureAngularSsrNodeModules = async (outDir) => {
4355
+ }, readAngularPageModule = (value) => isRecord5(value) ? value : null, resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ?? join6(tmpdir(), "absolutejs", "generated", "angular-ssr"), ensureAngularSsrNodeModules = async (outDir) => {
4348
4356
  const outRoot = resolve6(dirname5(dirname5(outDir)));
4349
- const nodeModulesLink = join5(outRoot, "node_modules");
4357
+ const nodeModulesLink = join6(outRoot, "node_modules");
4350
4358
  if (process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR) {
4351
4359
  return;
4352
4360
  }
@@ -13721,5 +13729,5 @@ export {
13721
13729
  Island
13722
13730
  };
13723
13731
 
13724
- //# debugId=E85EC96FCBEF255064756E2164756E21
13732
+ //# debugId=B10258ED4C6BE30164756E2164756E21
13725
13733
  //# sourceMappingURL=index.js.map