@absolutejs/absolute 0.19.0-beta.1004 → 0.19.0-beta.1006

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
@@ -12812,6 +12812,25 @@ var init_compileSvelte = __esm(() => {
12812
12812
  transpiler3 = new Transpiler2({ loader: "ts", target: "browser" });
12813
12813
  });
12814
12814
 
12815
+ // src/build/parseVueSpaRoutes.ts
12816
+ var ROUTES_BLOCK_RE, ROUTE_ENTRY_RE, parseVueSpaRoutes = (source) => {
12817
+ const blockMatch = source.match(ROUTES_BLOCK_RE);
12818
+ if (!blockMatch?.[1])
12819
+ return [];
12820
+ const block = blockMatch[1];
12821
+ const entries = [];
12822
+ for (const match of block.matchAll(ROUTE_ENTRY_RE)) {
12823
+ const [, path, importPath] = match;
12824
+ if (path && importPath)
12825
+ entries.push({ importPath, path });
12826
+ }
12827
+ return entries;
12828
+ };
12829
+ var init_parseVueSpaRoutes = __esm(() => {
12830
+ ROUTES_BLOCK_RE = /export\s+const\s+routes\s*=\s*defineRoutes\s*\(\s*\[([\s\S]*?)\]\s*\)\s*;?/;
12831
+ ROUTE_ENTRY_RE = /path:\s*['"`]([^'"`]+)['"`][\s\S]*?import\(\s*['"`]([^'"`]+\.vue)['"`]\s*\)/g;
12832
+ });
12833
+
12815
12834
  // src/build/chainInlineSourcemaps.ts
12816
12835
  var exports_chainInlineSourcemaps = {};
12817
12836
  __export(exports_chainInlineSourcemaps, {
@@ -13339,6 +13358,7 @@ var resolveDevClientDir3 = () => {
13339
13358
  const { descriptor } = compiler.parse(sourceContent, {
13340
13359
  filename: sourceFilePath
13341
13360
  });
13361
+ const spaRoutes = isEntryPoint ? parseVueSpaRoutes(descriptor.script?.content ?? "") : [];
13342
13362
  const hmrId = generateVueHmrId(sourceFilePath, vueRootDir);
13343
13363
  const changeType = detectVueChangeType(sourceFilePath, descriptor);
13344
13364
  vueHmrMetadata.set(sourceFilePath, { changeType, hmrId });
@@ -13490,6 +13510,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
13490
13510
  cssPaths: cssOutputPaths,
13491
13511
  hmrId,
13492
13512
  serverPath: serverOutputPath,
13513
+ spaRoutes: spaRoutes.length > 0 ? spaRoutes : undefined,
13493
13514
  tsHelperPaths: [
13494
13515
  ...helperModulePaths.map((helper) => resolveHelperTsPath(dirname15(sourceFilePath), helper)),
13495
13516
  ...childBuildResults.flatMap((child) => child.tsHelperPaths)
@@ -13526,7 +13547,9 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
13526
13547
  clientPath: null,
13527
13548
  cssPaths: result.cssPaths,
13528
13549
  indexPath: null,
13529
- serverPath: result.serverPath
13550
+ serverPath: result.serverPath,
13551
+ sourcePath: resolvedEntryPath,
13552
+ spaRoutes: result.spaRoutes
13530
13553
  };
13531
13554
  }
13532
13555
  const entryBaseName = basename8(entryPath, ".vue");
@@ -13677,7 +13700,9 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
13677
13700
  clientPath: clientOutputFile,
13678
13701
  cssPaths: result.cssPaths,
13679
13702
  indexPath: indexOutputFile,
13680
- serverPath: result.serverPath
13703
+ serverPath: result.serverPath,
13704
+ sourcePath: resolvedEntryPath,
13705
+ spaRoutes: result.spaRoutes
13681
13706
  };
13682
13707
  }));
13683
13708
  const queue = Array.from(allTsHelperPaths);
@@ -13712,12 +13737,19 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
13712
13737
  await write3(outServerPath, transpiledCode);
13713
13738
  }));
13714
13739
  const isString = (value) => value !== null;
13740
+ const vueSpaRoutesBySource = new Map;
13741
+ for (const page of compiledPages) {
13742
+ if (page.spaRoutes && page.spaRoutes.length > 0) {
13743
+ vueSpaRoutesBySource.set(page.sourcePath, page.spaRoutes);
13744
+ }
13745
+ }
13715
13746
  return {
13716
13747
  hmrMetadata: new Map(vueHmrMetadata),
13717
13748
  vueClientPaths: compiledPages.map((p2) => p2.clientPath).filter(isString),
13718
13749
  vueCssPaths: compiledPages.flatMap((result) => result.cssPaths),
13719
13750
  vueIndexPaths: compiledPages.map((p2) => p2.indexPath).filter(isString),
13720
- vueServerPaths: compiledPages.map((result) => result.serverPath)
13751
+ vueServerPaths: compiledPages.map((result) => result.serverPath),
13752
+ vueSpaRoutesBySource
13721
13753
  };
13722
13754
  };
13723
13755
  var init_compileVue = __esm(() => {
@@ -13725,6 +13757,7 @@ var init_compileVue = __esm(() => {
13725
13757
  init_generatedDir();
13726
13758
  init_resolvePackageImport();
13727
13759
  init_sourceMetadata();
13760
+ init_parseVueSpaRoutes();
13728
13761
  init_chainInlineSourcemaps();
13729
13762
  init_vueAutoRouterTransform();
13730
13763
  init_stylePreprocessor();
@@ -20366,7 +20399,13 @@ ${content.slice(firstUseIdx)}`;
20366
20399
  }
20367
20400
  const [
20368
20401
  { svelteServerPaths, svelteIndexPaths, svelteClientPaths },
20369
- { vueServerPaths, vueIndexPaths, vueClientPaths, vueCssPaths },
20402
+ {
20403
+ vueServerPaths,
20404
+ vueIndexPaths,
20405
+ vueClientPaths,
20406
+ vueCssPaths,
20407
+ vueSpaRoutesBySource
20408
+ },
20370
20409
  { clientPaths: angularClientPaths, serverPaths: angularServerPaths },
20371
20410
  { clientPaths: emberClientPaths, serverPaths: emberServerPaths },
20372
20411
  { svelteClientPaths: islandSvelteClientPaths },
@@ -20382,7 +20421,8 @@ ${content.slice(firstUseIdx)}`;
20382
20421
  vueClientPaths: [...emptyStringArray],
20383
20422
  vueCssPaths: [...emptyStringArray],
20384
20423
  vueIndexPaths: [...emptyStringArray],
20385
- vueServerPaths: [...emptyStringArray]
20424
+ vueServerPaths: [...emptyStringArray],
20425
+ vueSpaRoutesBySource: new Map
20386
20426
  },
20387
20427
  shouldCompileAngular ? tracePhase("compile/angular", async () => {
20388
20428
  const mod = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
@@ -20994,12 +21034,14 @@ ${content.slice(firstUseIdx)}`;
20994
21034
  }
20995
21035
  const fsPromises = await import("fs/promises");
20996
21036
  const siblingCssPaths = [];
21037
+ const serverJsByPascalName = new Map;
20997
21038
  await Promise.all(serverOutputs.map(async (artifact) => {
20998
21039
  if (extname8(artifact.path) !== ".js")
20999
21040
  return;
21000
21041
  const pascalName = stripHash(basename11(artifact.path), artifact.hash);
21001
21042
  if (!pascalName)
21002
21043
  return;
21044
+ serverJsByPascalName.set(pascalName, artifact);
21003
21045
  const cssArtifact = cssByName.get(`${toKebab(pascalName)}-compiled`);
21004
21046
  if (!cssArtifact)
21005
21047
  return;
@@ -21008,6 +21050,31 @@ ${content.slice(firstUseIdx)}`;
21008
21050
  siblingCssPaths.push(siblingCssPath);
21009
21051
  manifest[`${pascalName}Css`] = siblingCssPath;
21010
21052
  }));
21053
+ const spaSideManifestPaths = [];
21054
+ if (vueSpaRoutesBySource && vueSpaRoutesBySource.size > 0) {
21055
+ await Promise.all([...vueSpaRoutesBySource.entries()].map(async ([source, routes]) => {
21056
+ const parentName = basename11(source, ".vue");
21057
+ const parentArtifact = serverJsByPascalName.get(parentName);
21058
+ if (!parentArtifact)
21059
+ return;
21060
+ const sourceDir = dirname19(source);
21061
+ const entries = routes.flatMap(({ path, importPath }) => {
21062
+ const childSourcePath = resolve28(sourceDir, importPath);
21063
+ const childName = basename11(childSourcePath, ".vue");
21064
+ const childArtifact = serverJsByPascalName.get(childName);
21065
+ if (!childArtifact)
21066
+ return [];
21067
+ const cssPath = childArtifact.path.replace(/\.js$/, ".css");
21068
+ return [{ cssPath, path }];
21069
+ });
21070
+ if (entries.length === 0)
21071
+ return;
21072
+ const sideManifestPath = parentArtifact.path.replace(/\.js$/, ".spa.json");
21073
+ await fsPromises.writeFile(sideManifestPath, JSON.stringify(entries));
21074
+ spaSideManifestPaths.push(sideManifestPath);
21075
+ manifest[`${parentName}SpaManifest`] = sideManifestPath;
21076
+ }));
21077
+ }
21011
21078
  for (const serverPath of emberServerPaths) {
21012
21079
  const fileBase = basename11(serverPath, ".js");
21013
21080
  manifest[toPascal(fileBase)] = serverPath;
@@ -21103,6 +21170,7 @@ ${content.slice(firstUseIdx)}`;
21103
21170
  ...islandClientOutputs.map((a) => a.path),
21104
21171
  ...cssOutputs.map((a) => a.path),
21105
21172
  ...siblingCssPaths,
21173
+ ...spaSideManifestPaths,
21106
21174
  ...conventionOutputPaths
21107
21175
  ]));
21108
21176
  }
@@ -23215,6 +23283,10 @@ ${code}`;
23215
23283
  ${templateResult.code}`;
23216
23284
  code += `
23217
23285
  __script__.render = render;`;
23286
+ if (isScoped) {
23287
+ code += `
23288
+ __script__.__scopeId = "data-v-${componentId}";`;
23289
+ }
23218
23290
  code += `
23219
23291
  export default __script__;`;
23220
23292
  return code;
@@ -35749,5 +35821,5 @@ export {
35749
35821
  ANGULAR_INIT_TIMEOUT_MS
35750
35822
  };
35751
35823
 
35752
- //# debugId=CA144ECF7D56382464756E2164756E21
35824
+ //# debugId=3F7666EF01B29DF064756E2164756E21
35753
35825
  //# sourceMappingURL=index.js.map