@absolutejs/absolute 0.20.0-beta.178 → 0.20.0-beta.179

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.
@@ -25,7 +25,7 @@ import {
25
25
  import {
26
26
  installFrameworkDependencies,
27
27
  installPackages
28
- } from "./index-jjfbjv1z.js";
28
+ } from "./index-5q6k5mvr.js";
29
29
  import {
30
30
  readVendoredHtmx,
31
31
  writeHtmx
@@ -0,0 +1,86 @@
1
+ // @bun
2
+ // src/cli/add/dependencies.ts
3
+ var SCAFFOLD_VERSIONS = {
4
+ "@absolutejs/scoped-state": "0.3.1",
5
+ "@angular/common": "21.2.24",
6
+ "@angular/compiler": "21.2.24",
7
+ "@angular/compiler-cli": "21.2.24",
8
+ "@angular/core": "21.2.24",
9
+ "@angular/platform-browser": "21.2.24",
10
+ "@angular/platform-server": "21.2.24",
11
+ "@angular/router": "21.2.24",
12
+ "@angular/ssr": "21.2.24",
13
+ "@types/react": "19.3.0",
14
+ react: "19.3.0",
15
+ "react-dom": "19.3.0",
16
+ "react-refresh": "0.19.0",
17
+ svelte: "5.57.1",
18
+ "svelte-check": "4.7.8",
19
+ svelte2tsx: "0.7.63",
20
+ vue: "3.5.43",
21
+ "vue-router": "4.6.4",
22
+ "vue-tsc": "3.3.14"
23
+ };
24
+ var FRAMEWORK_PACKAGES = {
25
+ angular: {
26
+ dependencies: [
27
+ "@angular/common",
28
+ "@angular/compiler",
29
+ "@angular/compiler-cli",
30
+ "@angular/core",
31
+ "@angular/platform-browser",
32
+ "@angular/platform-server",
33
+ "@angular/router",
34
+ "@angular/ssr"
35
+ ],
36
+ devDependencies: []
37
+ },
38
+ html: { dependencies: [], devDependencies: [] },
39
+ htmx: { dependencies: ["@absolutejs/scoped-state"], devDependencies: [] },
40
+ react: {
41
+ dependencies: ["react", "react-dom"],
42
+ devDependencies: ["@types/react", "react-refresh"]
43
+ },
44
+ svelte: {
45
+ dependencies: ["svelte"],
46
+ devDependencies: ["svelte2tsx", "svelte-check"]
47
+ },
48
+ vue: {
49
+ dependencies: ["vue", "vue-router"],
50
+ devDependencies: ["vue-tsc"]
51
+ }
52
+ };
53
+ var toSpecs = (names) => names.map((name) => `${name}@${SCAFFOLD_VERSIONS[name]}`);
54
+ var plannedFrameworkInstall = (framework) => {
55
+ const packages = FRAMEWORK_PACKAGES[framework];
56
+ return {
57
+ dependencies: toSpecs(packages.dependencies),
58
+ devDependencies: toSpecs(packages.devDependencies)
59
+ };
60
+ };
61
+ var runBunAdd = (cwd, specs, dev) => {
62
+ if (specs.length === 0)
63
+ return true;
64
+ const flags = dev ? ["--dev"] : [];
65
+ const result = Bun.spawnSync(["bun", "add", ...flags, ...specs], {
66
+ cwd,
67
+ stderr: "inherit",
68
+ stdout: "inherit"
69
+ });
70
+ return result.success;
71
+ };
72
+ var frameworkDependencyNames = (framework) => {
73
+ const packages = FRAMEWORK_PACKAGES[framework];
74
+ return [...packages.dependencies, ...packages.devDependencies];
75
+ };
76
+ var installFrameworkDependencies = (cwd, framework, run = runBunAdd) => {
77
+ const { dependencies, devDependencies } = plannedFrameworkInstall(framework);
78
+ const specs = [...dependencies, ...devDependencies];
79
+ if (specs.length === 0)
80
+ return { ok: true, specs };
81
+ const succeeded = run(cwd, dependencies, false) && run(cwd, devDependencies, true);
82
+ return { ok: succeeded, specs };
83
+ };
84
+ var installPackages = (cwd, specs, dev = false) => runBunAdd(cwd, specs, dev);
85
+
86
+ export { frameworkDependencyNames, installFrameworkDependencies, installPackages };
package/dist/cli/index.js CHANGED
@@ -137,7 +137,7 @@ if (command === "dev") {
137
137
  await runGenerate(args);
138
138
  } else if (command === "add") {
139
139
  sendTelemetryEvent("cli:command", { command: "add" });
140
- const { runAdd } = await import("./add-ntg96znk.js");
140
+ const { runAdd } = await import("./add-8gw9mk2b.js");
141
141
  await runAdd(args);
142
142
  } else if (command === "analyze") {
143
143
  sendTelemetryEvent("cli:command", { command: "analyze" });
@@ -149,7 +149,7 @@ if (command === "dev") {
149
149
  await runApi(args);
150
150
  } else if (command === "remove") {
151
151
  sendTelemetryEvent("cli:command", { command: "remove" });
152
- const { runRemove } = await import("./remove-4jh862qa.js");
152
+ const { runRemove } = await import("./remove-x987pvd3.js");
153
153
  await runRemove(args);
154
154
  } else if (command === "htmx") {
155
155
  sendTelemetryEvent("cli:command", { command: "htmx" });
@@ -211,7 +211,7 @@ if (command === "dev") {
211
211
  sendTelemetryEvent("cli:command", {
212
212
  command: `mobile:${workspaceCommand ?? "unknown"}`
213
213
  });
214
- const { runMobile } = await import("./mobile-c92dh8s2.js");
214
+ const { runMobile } = await import("./mobile-93vaawcz.js");
215
215
  try {
216
216
  await runMobile(args);
217
217
  } catch (error) {
@@ -95,7 +95,7 @@ import {
95
95
  } from "./index-cgmp9d02.js";
96
96
  import {
97
97
  installPackages
98
- } from "./index-jjfbjv1z.js";
98
+ } from "./index-5q6k5mvr.js";
99
99
  import {
100
100
  formatBytes
101
101
  } from "./index-7854xf0m.js";
@@ -18,7 +18,7 @@ import {
18
18
  } from "./index-kes8he5s.js";
19
19
  import {
20
20
  frameworkDependencyNames
21
- } from "./index-jjfbjv1z.js";
21
+ } from "./index-5q6k5mvr.js";
22
22
  import"./index-125cfzvn.js";
23
23
  import"./index-3ewt17wm.js";
24
24
  import"./index-pr1skxen.js";
package/dist/index.js CHANGED
@@ -8803,7 +8803,7 @@ import { basename as basename2, dirname as dirname6, extname as extname3, join a
8803
8803
  var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, syncIslandGeneration, transpiler, ensureRelativeImportPath = (from, target) => {
8804
8804
  const importPath = relative3(dirname6(from), target).replace(/\\/g, "/");
8805
8805
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
8806
- }, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
8806
+ }, escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), replaceQuotedSpecifier = (code, spec, target) => code.replace(new RegExp(`(['"])${escapeRegExp(spec)}\\1`, "g"), (_match, quote) => `${quote}${target}${quote}`), processDirectoryEntries = (entries, dir, targetFileName, stack) => {
8807
8807
  for (const entry of entries) {
8808
8808
  const entryPath = join8(dir, entry.name);
8809
8809
  if (entry.isDirectory())
@@ -8848,18 +8848,21 @@ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, syncIslandG
8848
8848
  return null;
8849
8849
  }
8850
8850
  const basePath = resolve6(dirname6(from), spec);
8851
+ const extensions = [
8852
+ ".ts",
8853
+ ".tsx",
8854
+ ".mts",
8855
+ ".cts",
8856
+ ".js",
8857
+ ".jsx",
8858
+ ".mjs",
8859
+ ".cjs",
8860
+ ".json"
8861
+ ];
8851
8862
  const candidates = [
8852
8863
  basePath,
8853
- `${basePath}.ts`,
8854
- `${basePath}.js`,
8855
- `${basePath}.mjs`,
8856
- `${basePath}.cjs`,
8857
- `${basePath}.json`,
8858
- join8(basePath, "index.ts"),
8859
- join8(basePath, "index.js"),
8860
- join8(basePath, "index.mjs"),
8861
- join8(basePath, "index.cjs"),
8862
- join8(basePath, "index.json")
8864
+ ...extensions.map((extension) => `${basePath}${extension}`),
8865
+ ...extensions.map((extension) => join8(basePath, `index${extension}`))
8863
8866
  ];
8864
8867
  const existResults = await Promise.all(candidates.map((candidate) => Bun.file(candidate).exists()));
8865
8868
  const foundIndex = existResults.indexOf(true);
@@ -8944,7 +8947,7 @@ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, syncIslandG
8944
8947
  rewrittenModulePaths.set(spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), resolvedModuleImport));
8945
8948
  }
8946
8949
  for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
8947
- transpiled = transpiled.replaceAll(spec, resolvedModuleImport);
8950
+ transpiled = replaceQuotedSpecifier(transpiled, spec, resolvedModuleImport);
8948
8951
  }
8949
8952
  let compiledCode = compile(transpiled, {
8950
8953
  css: "injected",
@@ -8956,10 +8959,10 @@ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, syncIslandG
8956
8959
  hmr: isDevelopmentRuntime()
8957
8960
  }).js.code;
8958
8961
  for (const [spec, compiledChildPath] of childModulePaths) {
8959
- compiledCode = compiledCode.replaceAll(spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), compiledChildPath));
8962
+ compiledCode = replaceQuotedSpecifier(compiledCode, spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), compiledChildPath));
8960
8963
  }
8961
8964
  for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
8962
- compiledCode = compiledCode.replaceAll(spec, resolvedModuleImport);
8965
+ compiledCode = replaceQuotedSpecifier(compiledCode, spec, resolvedModuleImport);
8963
8966
  }
8964
8967
  const sourceId = JSON.stringify(relative3(process.cwd(), resolutionSourcePath).replace(/\\/g, "/"));
8965
8968
  const componentName = /export default function ([\w$]+)\s*\(/.exec(compiledCode)?.[1];
@@ -9055,7 +9058,13 @@ var serverCacheRoot3, compiledModuleCache3, syncIslandGeneration2, transpiler2,
9055
9058
  ].join(`
9056
9059
  `) : nonVueLines.join(`
9057
9060
  `);
9058
- }, extractRelativeVueImports = (sourceCode) => Array.from(sourceCode.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((importPath) => typeof importPath === "string" && importPath.startsWith(".") && importPath.endsWith(".vue")), compileVueServerModule = async (sourcePath) => {
9061
+ }, RELATIVE_SPECIFIER_PATTERN, extractRelativeImports = (code) => Array.from(new Set(Array.from(code.matchAll(RELATIVE_SPECIFIER_PATTERN), (match) => match.groups?.spec).filter((spec) => spec !== undefined))), resolveFromSource = (spec, sourcePath) => {
9062
+ try {
9063
+ return Bun.resolveSync(spec, dirname7(sourcePath));
9064
+ } catch {
9065
+ return null;
9066
+ }
9067
+ }, compileVueServerModule = async (sourcePath) => {
9059
9068
  syncIslandGeneration2();
9060
9069
  const cachedModulePath = compiledModuleCache3.get(sourcePath);
9061
9070
  if (cachedModulePath)
@@ -9088,10 +9097,10 @@ var serverCacheRoot3, compiledModuleCache3, syncIslandGeneration2, transpiler2,
9088
9097
  ssr: true,
9089
9098
  ssrCssVars: descriptor.cssVars
9090
9099
  }).code : "const ssrRender = () => {};";
9091
- const childImportPaths = extractRelativeVueImports(compiledScript.content);
9092
- const compiledChildren = await Promise.all(childImportPaths.map(async (relativeImport) => ({
9093
- compiledPath: await compileVueServerModule(resolve7(dirname7(sourcePath), relativeImport)),
9094
- spec: relativeImport
9100
+ const relativeImports = extractRelativeImports(compiledScript.content);
9101
+ const compiledChildren = await Promise.all(relativeImports.filter((spec) => spec.endsWith(".vue")).map(async (spec) => ({
9102
+ compiledPath: await compileVueServerModule(resolve7(dirname7(sourcePath), spec)),
9103
+ spec
9095
9104
  })));
9096
9105
  const strippedScript = stripExports(compiledScript.content);
9097
9106
  const transpiledScript = transpiler2.transformSync(strippedScript);
@@ -9103,10 +9112,22 @@ var serverCacheRoot3, compiledModuleCache3, syncIslandGeneration2, transpiler2,
9103
9112
  ].join(`
9104
9113
  `));
9105
9114
  const compiledModulePath = getCachedModulePath3(sourcePath);
9106
- let rewritten = assembled;
9115
+ const rewrittenSpecifiers = new Map;
9107
9116
  for (const child of compiledChildren) {
9108
- rewritten = rewritten.replaceAll(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
9117
+ rewrittenSpecifiers.set(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
9118
+ }
9119
+ for (const spec of extractRelativeImports(assembled)) {
9120
+ if (rewrittenSpecifiers.has(spec))
9121
+ continue;
9122
+ const resolvedImport = resolveFromSource(spec, sourcePath);
9123
+ if (!resolvedImport)
9124
+ continue;
9125
+ rewrittenSpecifiers.set(spec, ensureRelativeImportPath2(compiledModulePath, resolvedImport));
9109
9126
  }
9127
+ const rewritten = assembled.replace(RELATIVE_SPECIFIER_PATTERN, (match, prefix, quote, spec) => {
9128
+ const target = rewrittenSpecifiers.get(spec);
9129
+ return target ? `${prefix}${quote}${target}${quote}` : match;
9130
+ });
9110
9131
  await mkdir4(dirname7(compiledModulePath), { recursive: true });
9111
9132
  await writeIfChanged2(compiledModulePath, rewritten);
9112
9133
  compiledModuleCache3.set(sourcePath, compiledModulePath);
@@ -9120,6 +9141,7 @@ var init_vueServerModule = __esm(() => {
9120
9141
  compiledModuleCache3.clear();
9121
9142
  });
9122
9143
  transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
9144
+ RELATIVE_SPECIFIER_PATTERN = /(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(?<spec>\.{1,2}\/[^'"]*)\2/g;
9123
9145
  });
9124
9146
 
9125
9147
  // src/core/islandMarkupAttributes.ts
@@ -11580,7 +11602,7 @@ var init_idleScheduler = () => {};
11580
11602
  // src/core/serverOnlyStaticFiles.ts
11581
11603
  import { existsSync as existsSync11, readFileSync as readFileSync13 } from "fs";
11582
11604
  import { isAbsolute as isAbsolute3, join as join15, relative as relative7, sep as sep2 } from "path";
11583
- var STATIC_PLUGIN_DEFAULTS, SERVER_OUTPUTS_FILE = "server-outputs.json", RUNTIME_FILE_NAMES, SERVER_ONLY_PATTERNS, escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), isStringArray = (value) => Array.isArray(value) && value.every((entry) => typeof entry === "string"), readServerOutputs = (buildDir) => {
11605
+ var STATIC_PLUGIN_DEFAULTS, SERVER_OUTPUTS_FILE = "server-outputs.json", RUNTIME_FILE_NAMES, SERVER_ONLY_PATTERNS, escapeRegExp2 = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), isStringArray = (value) => Array.isArray(value) && value.every((entry) => typeof entry === "string"), readServerOutputs = (buildDir) => {
11584
11606
  const path = join15(buildDir, SERVER_OUTPUTS_FILE);
11585
11607
  if (!existsSync11(path))
11586
11608
  return [];
@@ -11594,7 +11616,7 @@ var STATIC_PLUGIN_DEFAULTS, SERVER_OUTPUTS_FILE = "server-outputs.json", RUNTIME
11594
11616
  const outputs = readServerOutputs(buildDir);
11595
11617
  if (outputs.length === 0)
11596
11618
  return null;
11597
- return new RegExp(`^/(?:${outputs.map(escapeRegExp).join("|")})(?:\\.br|\\.gz|\\.map)?$`);
11619
+ return new RegExp(`^/(?:${outputs.map(escapeRegExp2).join("|")})(?:\\.br|\\.gz|\\.map)?$`);
11598
11620
  }, productionStaticIgnorePatterns = (buildDir, serverBundle) => {
11599
11621
  const patterns = [
11600
11622
  ...STATIC_PLUGIN_DEFAULTS,
@@ -11607,7 +11629,7 @@ var STATIC_PLUGIN_DEFAULTS, SERVER_OUTPUTS_FILE = "server-outputs.json", RUNTIME
11607
11629
  const insideBuildDir = bundlePath !== "" && !bundlePath.startsWith("..") && !isAbsolute3(bundlePath);
11608
11630
  if (insideBuildDir) {
11609
11631
  const urlPath = bundlePath.split(sep2).join("/");
11610
- patterns.push(new RegExp(`^/${escapeRegExp(urlPath)}(?:\\.br|\\.gz|\\.map)?$`));
11632
+ patterns.push(new RegExp(`^/${escapeRegExp2(urlPath)}(?:\\.br|\\.gz|\\.map)?$`));
11611
11633
  }
11612
11634
  return patterns;
11613
11635
  };
@@ -16654,7 +16676,7 @@ var CLIENT_FRAMEWORK_PACKAGES, CLIENT_FRAMEWORKS, isPackageInstalled = (packageN
16654
16676
  vue: config.vueDirectory
16655
16677
  },
16656
16678
  projectRoot
16657
- }), escapeRegExp2 = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), packagePattern = (pattern) => pattern.endsWith("/*") ? `${escapeRegExp2(pattern.slice(0, -1))}.+` : `${escapeRegExp2(pattern)}(?:/.*)?`, missingFrameworkSpecifierPattern = (frameworks) => {
16679
+ }), escapeRegExp3 = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), packagePattern = (pattern) => pattern.endsWith("/*") ? `${escapeRegExp3(pattern.slice(0, -1))}.+` : `${escapeRegExp3(pattern)}(?:/.*)?`, missingFrameworkSpecifierPattern = (frameworks) => {
16658
16680
  const alternatives = frameworks.flatMap((framework) => CLIENT_FRAMEWORK_PACKAGES[framework].packages.map(packagePattern));
16659
16681
  return alternatives.length > 0 ? new RegExp(`^(?:${alternatives.join("|")})$`) : null;
16660
16682
  }, frameworkOf = (specifier) => CLIENT_FRAMEWORKS.find((framework) => {
@@ -19306,7 +19328,7 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => lazyTypescript.isIdenti
19306
19328
  output = output.slice(0, edit.start) + edit.text + output.slice(edit.end);
19307
19329
  }
19308
19330
  return output;
19309
- }, escapeRegExp3 = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), loaderForPath = (filePath) => {
19331
+ }, escapeRegExp4 = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), loaderForPath = (filePath) => {
19310
19332
  if (filePath.endsWith(".tsx"))
19311
19333
  return "tsx";
19312
19334
  if (filePath.endsWith(".jsx"))
@@ -19317,7 +19339,7 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => lazyTypescript.isIdenti
19317
19339
  return "ts";
19318
19340
  }, createIslandRegistryDefinitionPlugin = (info) => {
19319
19341
  const registryBase = basename13(info.resolvedRegistryPath).replace(/\.[mc]?[jt]sx?$/, "");
19320
- const filter = new RegExp(`(^|[/\\\\])${escapeRegExp3(registryBase)}\\.[mc]?[jt]sx?$`);
19342
+ const filter = new RegExp(`(^|[/\\\\])${escapeRegExp4(registryBase)}\\.[mc]?[jt]sx?$`);
19321
19343
  return {
19322
19344
  name: "absolute-island-registry-definitions",
19323
19345
  setup(build) {
@@ -24756,7 +24778,7 @@ import { createHash as createHash8 } from "crypto";
24756
24778
  import { existsSync as existsSync40, readFileSync as readFileSync39 } from "fs";
24757
24779
  import { mkdir as mkdir10, rename as rename2, writeFile as writeFile11 } from "fs/promises";
24758
24780
  import { join as join52, resolve as resolve39 } from "path";
24759
- var CACHE_DIR_NAME = "compile-cache", ABSOLUTE_CACHE_DIR_NAME2 = ".absolutejs", CACHE_FORMAT_VERSION = 3, FILE_NAME_HASH_LENGTH = 32, vueCompileCacheEnabled = () => process.env.ABSOLUTE_COMPILE_CACHE !== "0", hashContent = (content) => createHash8("sha256").update(content).digest("hex"), hashParts = (parts) => {
24781
+ var CACHE_DIR_NAME = "compile-cache", ABSOLUTE_CACHE_DIR_NAME2 = ".absolutejs", CACHE_FORMAT_VERSION = 4, FILE_NAME_HASH_LENGTH = 32, vueCompileCacheEnabled = () => process.env.ABSOLUTE_COMPILE_CACHE !== "0", hashContent = (content) => createHash8("sha256").update(content).digest("hex"), hashParts = (parts) => {
24760
24782
  const hash = createHash8("sha256");
24761
24783
  for (const part of parts) {
24762
24784
  hash.update(part);
@@ -25022,7 +25044,7 @@ var transpiler5, toJs = (filePath, sourceDir) => {
25022
25044
  return `${filePath}/index.js`;
25023
25045
  }
25024
25046
  return `${filePath}.js`;
25025
- }, stripExports2 = (code) => code.replace(/export\s+default/, "const script ="), mergeVueImports2 = (code) => {
25047
+ }, mergeVueImports2 = (code) => {
25026
25048
  const lines = code.split(`
25027
25049
  `);
25028
25050
  const specifierSet = new Set;
@@ -25094,19 +25116,20 @@ const ${localName} = (source) => ${importedName}(
25094
25116
  return content;
25095
25117
  }
25096
25118
  },
25119
+ genDefaultAs: "script",
25097
25120
  id: componentId,
25098
25121
  inlineTemplate: false,
25099
25122
  sourceMap: true
25100
- }) : { bindings: {}, content: "export default {};", map: undefined };
25123
+ }) : { bindings: {}, content: "const script = {};", map: undefined };
25101
25124
  const typeDependencies = "deps" in compiledScript ? compiledScript.deps ?? [] : [];
25102
25125
  for (const dep of typeDependencies) {
25103
25126
  if (dep in typeDepHashes || !existsSync42(dep))
25104
25127
  continue;
25105
25128
  typeDepHashes[dep] = hashContent(readFileSync41(dep, "utf-8"));
25106
25129
  }
25107
- const strippedScript = stripExports2(compiledScript.content);
25130
+ const scriptCode = compiledScript.content;
25108
25131
  const sourceDir = dirname30(sourceFilePath);
25109
- const transpiledScript = rewriteRelativeImports(transpiler5.transformSync(strippedScript), sourceDir);
25132
+ const transpiledScript = rewriteRelativeImports(transpiler5.transformSync(scriptCode), sourceDir);
25110
25133
  const generateRenderFunction = (ssr) => {
25111
25134
  const rendered = compiler.compileTemplate({
25112
25135
  compilerOptions: {
@@ -25172,7 +25195,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
25172
25195
  const inlineSourceMapFor = (finalContent) => {
25173
25196
  if (!compiledScript.map || !hasScript)
25174
25197
  return "";
25175
- const remap = buildLineRemap(strippedScript, finalContent);
25198
+ const remap = buildLineRemap(scriptCode, finalContent);
25176
25199
  const mappings = remapGeneratedLines(compiledScript.map.mappings, remap);
25177
25200
  const map = {
25178
25201
  ...compiledScript.map,
@@ -34191,8 +34214,10 @@ ${code}`;
34191
34214
  }, compileVueTemplate = (descriptor, compiledScript, filePath, componentId) => {
34192
34215
  const compiler = getLoadedVueCompiler();
34193
34216
  const scriptContent = compiledScript.content;
34194
- if (!descriptor.template)
34195
- return scriptContent;
34217
+ if (!descriptor.template) {
34218
+ return `${scriptContent}
34219
+ export default __script__;`;
34220
+ }
34196
34221
  const isScoped = descriptor.styles.some((style) => style.scoped);
34197
34222
  const templateResult = compiler.compileTemplate({
34198
34223
  compilerOptions: {
@@ -34206,8 +34231,7 @@ ${code}`;
34206
34231
  scoped: isScoped,
34207
34232
  source: descriptor.template.content
34208
34233
  });
34209
- let code = scriptContent.replace("export default", "const __script__ =");
34210
- code += `
34234
+ let code = `${scriptContent}
34211
34235
  ${templateResult.code}`;
34212
34236
  code += `
34213
34237
  __script__.render = render;`;
@@ -34259,9 +34283,10 @@ ${code}`;
34259
34283
  realpath: realpathSync9,
34260
34284
  readFile: (file) => isFile(file) ? readFileSync51(file, "utf-8") : undefined
34261
34285
  },
34286
+ genDefaultAs: "__script__",
34262
34287
  id: componentId,
34263
34288
  inlineTemplate: false
34264
- }) : { bindings: {}, content: "export default {};" };
34289
+ }) : { bindings: {}, content: "const __script__ = {};" };
34265
34290
  const compiledSfcScript = {
34266
34291
  bindings: compiledScript.bindings ?? {},
34267
34292
  content: compiledScript.content
@@ -49560,5 +49585,5 @@ export {
49560
49585
  wrapPageHandlerWithStreamingSlots
49561
49586
  };
49562
49587
 
49563
- //# debugId=74B7718917212AE664756E2164756E21
49588
+ //# debugId=0135FA899DABAE4364756E2164756E21
49564
49589
  //# sourceMappingURL=index.js.map