sv 0.16.3 → 0.16.4
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 { _ as name, a as detectPackageManager, d as Command, g as helpConfig, h as forwardExitCode, l as from, n as add, r as create, u as program, v as version } from "./engine-
|
|
2
|
+
import { _ as name, a as detectPackageManager, d as Command, g as helpConfig, h as forwardExitCode, l as from, n as add, r as create, u as program, v as version } from "./engine-C5O8updH.mjs";
|
|
3
3
|
import { color, resolveCommandArray } from "@sveltejs/sv-utils";
|
|
4
4
|
import V from "node:process";
|
|
5
5
|
import { execSync } from "node:child_process";
|
|
@@ -1348,7 +1348,7 @@ ${i ? styleText("cyan", x$1) : ""}
|
|
|
1348
1348
|
//#endregion
|
|
1349
1349
|
//#region package.json
|
|
1350
1350
|
var name = "sv";
|
|
1351
|
-
var version = "0.16.
|
|
1351
|
+
var version = "0.16.4";
|
|
1352
1352
|
//#endregion
|
|
1353
1353
|
//#region src/core/errors.ts
|
|
1354
1354
|
var UnsupportedError = class extends Error {
|
|
@@ -7164,14 +7164,9 @@ var paraglide_default = defineAddon({
|
|
|
7164
7164
|
setup: ({ isKit, unsupported }) => {
|
|
7165
7165
|
if (!isKit) unsupported("Requires SvelteKit");
|
|
7166
7166
|
},
|
|
7167
|
-
run: ({ sv, options, file, language, directory
|
|
7167
|
+
run: ({ sv, options, file, language, directory }) => {
|
|
7168
7168
|
const [ts] = createPrinter(language === "ts");
|
|
7169
7169
|
const paraglideOutDir = `${directory.lib}/paraglide`;
|
|
7170
|
-
const env = defineEnv({
|
|
7171
|
-
sv,
|
|
7172
|
-
cwd,
|
|
7173
|
-
dependencyVersion
|
|
7174
|
-
});
|
|
7175
7170
|
sv.devDependency("@inlang/paraglide-js", "^2.18.2");
|
|
7176
7171
|
sv.file(file.viteConfig, transforms.script(({ ast, js }) => {
|
|
7177
7172
|
const vitePluginName = "paraglideVitePlugin";
|
|
@@ -7180,10 +7175,10 @@ var paraglide_default = defineAddon({
|
|
|
7180
7175
|
from: "@inlang/paraglide-js"
|
|
7181
7176
|
});
|
|
7182
7177
|
js.vite.addPlugin(ast, { code: `${vitePluginName}({
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7178
|
+
project: './project.inlang',
|
|
7179
|
+
outdir: './${paraglideOutDir}',
|
|
7180
|
+
emitTsDeclarations: true
|
|
7181
|
+
})` });
|
|
7187
7182
|
}));
|
|
7188
7183
|
sv.file(`src/hooks.${language}`, transforms.script(({ ast, comments, js }) => {
|
|
7189
7184
|
js.imports.addNamed(ast, {
|
|
@@ -7238,66 +7233,11 @@ var paraglide_default = defineAddon({
|
|
|
7238
7233
|
html.addAttribute(htmlNode, "lang", "%paraglide.lang%");
|
|
7239
7234
|
html.addAttribute(htmlNode, "dir", "%paraglide.dir%");
|
|
7240
7235
|
}));
|
|
7241
|
-
sv.file(
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
"overwriteGetLocale",
|
|
7247
|
-
"overwriteSetLocale",
|
|
7248
|
-
"toLocale"
|
|
7249
|
-
],
|
|
7250
|
-
from: "$lib/paraglide/runtime"
|
|
7251
|
-
});
|
|
7252
|
-
js.imports.addNamed(ast, {
|
|
7253
|
-
imports: ["page"],
|
|
7254
|
-
from: "$app/state"
|
|
7255
|
-
});
|
|
7256
|
-
js.imports.addNamed(ast, {
|
|
7257
|
-
imports: ["goto"],
|
|
7258
|
-
from: "$app/navigation"
|
|
7259
|
-
});
|
|
7260
|
-
env.importEnv(ast, js, ["browser"]);
|
|
7261
|
-
if (language === "ts") js.imports.addNamed(ast, {
|
|
7262
|
-
imports: { Locale: "_Locale" },
|
|
7263
|
-
from: "$lib/paraglide/runtime",
|
|
7264
|
-
isType: true
|
|
7265
|
-
});
|
|
7266
|
-
const codeBlock = dedent`
|
|
7267
|
-
export class Locale {
|
|
7268
|
-
#current${ts(": _Locale")} = $state(toLocale(browser && document.querySelector('html')?.lang) ?? baseLocale);
|
|
7269
|
-
constructor() {
|
|
7270
|
-
overwriteGetLocale(() => this.#current);
|
|
7271
|
-
overwriteSetLocale((locale) => {
|
|
7272
|
-
this.#current = locale;
|
|
7273
|
-
goto(localizeUrl(page.url.pathname, { locale }).href);
|
|
7274
|
-
});
|
|
7275
|
-
}
|
|
7276
|
-
}`;
|
|
7277
|
-
js.common.appendFromString(ast, {
|
|
7278
|
-
code: codeBlock,
|
|
7279
|
-
comments
|
|
7280
|
-
});
|
|
7281
|
-
}));
|
|
7282
|
-
sv.file(`src/hooks.client.${language}`, transforms.script(({ ast, comments, js }) => {
|
|
7283
|
-
js.imports.addNamed(ast, {
|
|
7284
|
-
imports: ["Locale"],
|
|
7285
|
-
from: "$lib/paraglide.svelte"
|
|
7286
|
-
});
|
|
7287
|
-
if (language === "ts") js.imports.addNamed(ast, {
|
|
7288
|
-
imports: ["ClientInit"],
|
|
7289
|
-
from: "@sveltejs/kit",
|
|
7290
|
-
isType: true
|
|
7291
|
-
});
|
|
7292
|
-
const init = dedent`
|
|
7293
|
-
export const init${ts(": ClientInit")} = () => {
|
|
7294
|
-
new Locale()
|
|
7295
|
-
}
|
|
7296
|
-
`;
|
|
7297
|
-
js.common.appendFromString(ast, {
|
|
7298
|
-
code: init,
|
|
7299
|
-
comments
|
|
7300
|
-
});
|
|
7236
|
+
sv.file(file.gitignore, transforms.text(({ content, text }) => {
|
|
7237
|
+
if (!content) return false;
|
|
7238
|
+
content = text.upsert(content, paraglideOutDir, { comment: "Paraglide" });
|
|
7239
|
+
content = text.upsert(content, "project.inlang/cache/");
|
|
7240
|
+
return content;
|
|
7301
7241
|
}));
|
|
7302
7242
|
sv.file("project.inlang/settings.json", transforms.json(({ data }) => {
|
|
7303
7243
|
if (Object.keys(data).length > 0) return false;
|
package/dist/src/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as defineAddonOptions, m as create$1, o as officialAddons, s as defineAddon, t as add, y as svDeprecated } from "../engine-
|
|
1
|
+
import { c as defineAddonOptions, m as create$1, o as officialAddons, s as defineAddon, t as add, y as svDeprecated } from "../engine-C5O8updH.mjs";
|
|
2
2
|
//#region src/index.ts
|
|
3
3
|
function create(cwdOrOptions, legacyOptions) {
|
|
4
4
|
if (typeof cwdOrOptions === "string") {
|
package/dist/src/testing.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as __toESM, b as __commonJSMin, f as R, i as addPnpmAllowBuilds, m as create, p as z, t as add, x as __require } from "../engine-
|
|
1
|
+
import { S as __toESM, b as __commonJSMin, f as R, i as addPnpmAllowBuilds, m as create, p as z, t as add, x as __require } from "../engine-C5O8updH.mjs";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import V from "node:process";
|
|
@@ -22,15 +22,14 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"sv": "^0.16.
|
|
25
|
+
"sv": "^0.16.4"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"sv": "^0.16.
|
|
28
|
+
"sv": "^0.16.4",
|
|
29
29
|
"@sveltejs/sv-utils": "^0.3.1",
|
|
30
30
|
"@playwright/test": "^1.60.0",
|
|
31
31
|
"@types/node": "^25.9.1",
|
|
32
32
|
"tsdown": "^0.22.1",
|
|
33
|
-
"unrun": "^0.2.39",
|
|
34
33
|
"vitest": "^4.1.8"
|
|
35
34
|
},
|
|
36
35
|
"keywords": ["sv-add", "svelte", "sveltekit"]
|