sv 1.0.0-next.1 → 1.0.0-next.2

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/bin.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { A as Command, B as name, C as pipe, D as union, E as transform, F as forwardExitCode, G as ge, H as Ce, I as helpConfig, J as we, K as le, L as normalizePosix, O as from, P as errorAndExit, R as runAndValidateVerifications, S as picklist, T as string, U as Ee, V as version, W as R$1, Y as R, _ as array, a as verifyCleanWorkingDirectory, b as optional, c as AGENT_NAMES, d as installDependencies, f as installOption, i as create, k as program, n as prepareSvApi, o as formatFiles, p as packageManagerPrompt, q as vt, r as add, s as createWorkspace, u as detectPackageManager, v as boolean, w as strictObject, x as parse$1, y as literal, z as runCommand } from "./engine-Cbq-kxIr.mjs";
2
+ import { A as Command, B as name, C as pipe, D as union, E as transform, F as forwardExitCode, G as ge, H as Ce, I as helpConfig, J as we, K as le, L as normalizePosix, O as from, P as errorAndExit, R as runAndValidateVerifications, S as picklist, T as string, U as Ee, V as version, W as R$1, Y as R, _ as array, a as verifyCleanWorkingDirectory, b as optional, c as AGENT_NAMES, d as installDependencies, f as installOption, i as create, k as program, n as prepareSvApi, o as formatFiles, p as packageManagerPrompt, q as vt, r as add, s as createWorkspace, u as detectPackageManager, v as boolean, w as strictObject, x as parse$1, y as literal, z as runCommand } from "./engine-BSJyw47Z.mjs";
3
3
  import { Walker, coerceVersion, color, isVersionUnsupportedBelow, js, loadPackageJson, parse, resolveCommandArray, svelteConfig, transforms } from "@sveltejs/sv-utils";
4
4
  import fs from "node:fs";
5
5
  import path from "node:path";
@@ -1419,6 +1419,7 @@ function migrateComments(comments) {
1419
1419
  //#endregion
1420
1420
  //#region src/migrate/migrations/sveltekit-3/tasks/lib-alias.ts
1421
1421
  const LIB_ALIAS = /(?<=['"`])\$lib(\/(.+)['"`]|['"`])/g;
1422
+ const STYLE_TAG = /(<style\b[^>]*>)([\s\S]*?)(<\/style\s*>)/gi;
1422
1423
  function libSubpathImports(libDir) {
1423
1424
  return {
1424
1425
  "#lib": `./${libDir}/index.js`,
@@ -1438,8 +1439,10 @@ var lib_alias_default = defineMigrationTask({
1438
1439
  sv.files({
1439
1440
  include: `${directory.src}/**/*.{svelte,svelte.ts,svelte.js,ts,js,svx,md}`,
1440
1441
  where: (content) => content.includes("$lib")
1441
- }, (content) => {
1442
- const rewritten = content.replace(LIB_ALIAS, (match, _, import_path) => {
1442
+ }, (content, file) => {
1443
+ let styleLibPath = path.posix.relative(path.posix.dirname(file.replaceAll("\\", "/")), directory.lib.replaceAll("\\", "/"));
1444
+ if (!styleLibPath.startsWith(".")) styleLibPath = `./${styleLibPath}`;
1445
+ const rewritten = content.replace(STYLE_TAG, (_, open, css, close) => `${open}${css.replace(LIB_ALIAS, (match) => match.replace("$lib", styleLibPath))}${close}`).replace(LIB_ALIAS, (match, _, import_path) => {
1443
1446
  match = match.replace("$lib", "#lib");
1444
1447
  if (import_path && !import_path.endsWith(".js") && !import_path.endsWith(".ts")) {
1445
1448
  for (const ending of [
@@ -1912,6 +1915,7 @@ function withoutLeadingSlash(expression) {
1912
1915
  function removeStaticLeadingSlash(expression) {
1913
1916
  if (expression.type === "Literal" && typeof expression.value === "string") {
1914
1917
  if (!expression.value.startsWith("/")) return false;
1918
+ if (expression.value === "/") return false;
1915
1919
  expression.value = expression.value.slice(1);
1916
1920
  expression.raw = void 0;
1917
1921
  return true;
@@ -1919,6 +1923,7 @@ function removeStaticLeadingSlash(expression) {
1919
1923
  if (expression.type === "TemplateLiteral") {
1920
1924
  const quasi = expression.quasis[0];
1921
1925
  if (!quasi?.value.raw.startsWith("/")) return false;
1926
+ if (quasi.value.raw === "/") return false;
1922
1927
  quasi.value.raw = quasi.value.raw.slice(1);
1923
1928
  if (quasi.value.cooked !== void 0 && quasi.value.cooked !== null) quasi.value.cooked = quasi.value.cooked.slice(1);
1924
1929
  return true;
@@ -2142,6 +2147,8 @@ var svelte_config_default = defineMigrationTask({
2142
2147
  sv,
2143
2148
  cwd
2144
2149
  }, ({ ast, override, comments }) => {
2150
+ const existingAttachments = collectComments(ast, comments);
2151
+ comments.remove(() => true);
2145
2152
  const configDeclaration = originalConfigObject.ast.body.find((node) => node.type === "VariableDeclaration" && node.declarations.some((d) => d.init === originalConfigObject.config));
2146
2153
  const originalImports = [];
2147
2154
  const originalStatements = [];
@@ -2226,6 +2233,7 @@ var svelte_config_default = defineMigrationTask({
2226
2233
  };
2227
2234
  let rootConfig;
2228
2235
  forEachNode(ast, (node) => {
2236
+ apply(node, existingAttachments.get(node));
2229
2237
  apply(node, attachments.get(node));
2230
2238
  if (node.type === "CallExpression" && node.callee.type === "Identifier" && node.callee.name === "sveltekit" && node.arguments[0]?.type === "ObjectExpression") rootConfig = node.arguments[0];
2231
2239
  });
@@ -1339,7 +1339,7 @@ ${i ? styleText("cyan", x$1) : ""}
1339
1339
  //#endregion
1340
1340
  //#region package.json
1341
1341
  var name = "sv";
1342
- var version = "1.0.0-next.1";
1342
+ var version = "1.0.0-next.2";
1343
1343
  //#endregion
1344
1344
  //#region src/core/errors.ts
1345
1345
  var UnsupportedError = class extends Error {
@@ -1,2 +1,2 @@
1
- import { N as create, g as defineAddonOptions, h as defineAddon, m as officialAddons, t as add } from "../engine-Cbq-kxIr.mjs";
1
+ import { N as create, g as defineAddonOptions, h as defineAddon, m as officialAddons, t as add } from "../engine-BSJyw47Z.mjs";
2
2
  export { add, create, defineAddon, defineAddonOptions, officialAddons };
@@ -1,4 +1,4 @@
1
- import { M as z, N as create, Q as __toESM, X as __commonJSMin, Z as __require, j as R, l as addPnpmAllowBuilds, t as add } from "../engine-Cbq-kxIr.mjs";
1
+ import { M as z, N as create, Q as __toESM, X as __commonJSMin, Z as __require, j as R, l as addPnpmAllowBuilds, t as add } from "../engine-BSJyw47Z.mjs";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import V from "node:process";
@@ -22,11 +22,11 @@
22
22
  "access": "public"
23
23
  },
24
24
  "peerDependencies": {
25
- "sv": "^1.0.0-next.1"
25
+ "sv": "^1.0.0-next.2"
26
26
  },
27
27
  "devDependencies": {
28
- "sv": "^1.0.0-next.1",
29
- "@sveltejs/sv-utils": "^1.0.0-next.1",
28
+ "sv": "^1.0.0-next.2",
29
+ "@sveltejs/sv-utils": "^1.0.0-next.2",
30
30
  "@playwright/test": "^1.60.0",
31
31
  "@types/node": "^25.9.1",
32
32
  "tsdown": "^0.22.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sv",
3
- "version": "1.0.0-next.1",
3
+ "version": "1.0.0-next.2",
4
4
  "type": "module",
5
5
  "description": "A command line interface (CLI) for creating and maintaining Svelte applications",
6
6
  "license": "MIT",
@@ -25,7 +25,7 @@
25
25
  }
26
26
  },
27
27
  "dependencies": {
28
- "@sveltejs/sv-utils": "1.0.0-next.1"
28
+ "@sveltejs/sv-utils": "1.0.0-next.2"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@clack/prompts": "1.5.0",