sv 0.6.23 → 0.6.24

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { AtRule, Element, __commonJS, __require, __toESM, addPnpmBuildDependendencies, box, cancel, confirm, create, detectSync, esm_exports, from, getUserAgent, group, installDependencies, intro, isCancel, log, multiselect, note, outro, packageManagerPrompt, parseCss, parseHtml, parseHtml$1, parseJson, parseScript, parseSvelte, resolveCommand, select, spinner, templates, text, up, walk_exports } from "./package-manager-f0ge7H2V.js";
3
- import { __commonJS$1, __export, __toESM$1, addFromString, applyAddons, array_exports, common_exports, createWorkspace, dedent_default, exports_exports, formatFiles, function_exports, getHighlighter, imports_exports, kit_exports, object_exports, require_picocolors, setupAddons, variables_exports } from "./install-PTlNv0EA.js";
2
+ import { Element, __commonJS, __require, __toESM, addPnpmBuildDependendencies, box, cancel, confirm, create, detectSync, esm_exports, from, getUserAgent, group, installDependencies, intro, isCancel, log, multiselect, note, outro, packageManagerPrompt, parseCss, parseHtml, parseHtml$1, parseJson, parseScript, parseSvelte, resolveCommand, select, spinner, templates, text, up, walk_exports } from "./package-manager-DYKbLpuq.js";
3
+ import { __commonJS$1, __export, __toESM$1, addFromString, applyAddons, array_exports, common_exports, createWorkspace, dedent_default, exports_exports, formatFiles, function_exports, getHighlighter, imports_exports, kit_exports, object_exports, require_picocolors, setupAddons, variables_exports } from "./install-Bjzz5ixb.js";
4
4
  import fs, { existsSync } from "node:fs";
5
5
  import path, { dirname, join } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
@@ -12,7 +12,7 @@ import { promisify } from "node:util";
12
12
 
13
13
  //#region packages/cli/package.json
14
14
  var name = "sv";
15
- var version = "0.6.23";
15
+ var version = "0.6.24";
16
16
  var type = "module";
17
17
  var description = "A CLI for creating and updating SvelteKit projects";
18
18
  var license = "MIT";
@@ -4378,7 +4378,7 @@ function addEslintConfigPrettier(content) {
4378
4378
  const eslintConfig = defaultExport.value;
4379
4379
  if (eslintConfig.type !== "ArrayExpression" && eslintConfig.type !== "CallExpression") return content;
4380
4380
  const prettier = common_exports.expressionFromString("prettier");
4381
- const sveltePrettierConfig = common_exports.expressionFromString(`${svelteImportName}.configs['flat/prettier']`);
4381
+ const sveltePrettierConfig = common_exports.expressionFromString(`${svelteImportName}.configs.prettier`);
4382
4382
  const configSpread = common_exports.createSpreadElement(sveltePrettierConfig);
4383
4383
  const nodesToInsert = [];
4384
4384
  if (!common_exports.hasNode(eslintConfig, prettier)) nodesToInsert.push(prettier);
@@ -6535,36 +6535,6 @@ var storybook_default = defineAddon({
6535
6535
  }
6536
6536
  });
6537
6537
 
6538
- //#endregion
6539
- //#region packages/core/dist/css.js
6540
- function addImports(ast, imports) {
6541
- let prev;
6542
- const nodes = imports.map((param) => {
6543
- const found = ast.nodes.find((x) => x.type === "atrule" && x.name === "import" && x.params === param);
6544
- if (found) return prev = found;
6545
- const rule = new AtRule({
6546
- name: "import",
6547
- params: param
6548
- });
6549
- if (prev) ast.insertAfter(prev, rule);
6550
- else ast.prepend(rule);
6551
- return prev = rule;
6552
- });
6553
- return nodes;
6554
- }
6555
- function addAtRule(ast, name$1, params, append = false) {
6556
- const atRules = ast.nodes.filter((x) => x.type == "atrule");
6557
- let atRule = atRules.find((x) => x.name == name$1 && x.params == params);
6558
- if (atRule) return atRule;
6559
- atRule = new AtRule({
6560
- name: name$1,
6561
- params
6562
- });
6563
- if (!append) ast.prepend(atRule);
6564
- else ast.append(atRule);
6565
- return atRule;
6566
- }
6567
-
6568
6538
  //#endregion
6569
6539
  //#region packages/addons/tailwindcss/index.ts
6570
6540
  const plugins = [{
@@ -6616,18 +6586,25 @@ var tailwindcss_default = defineAddon({
6616
6586
  return generateCode();
6617
6587
  });
6618
6588
  sv.file("src/app.css", (content) => {
6619
- if (content.includes("tailwindcss")) return content;
6620
- const { ast, generateCode } = parseCss(content);
6621
- const originalFirst = ast.first;
6622
- const nodes = addImports(ast, ["'tailwindcss'"]);
6589
+ let atRules = parseCss(content).ast.nodes.filter((node) => node.type === "atrule");
6590
+ const findAtRule = (name$1, params) => atRules.find((rule) => rule.name === name$1 && rule.params.replace(/['"]/g, "") === params);
6591
+ let code = content;
6592
+ const importsTailwind = findAtRule("import", "tailwindcss");
6593
+ if (!importsTailwind) {
6594
+ code = "@import 'tailwindcss';\n" + code;
6595
+ atRules = parseCss(code).ast.nodes.filter((node) => node.type === "atrule");
6596
+ }
6597
+ const lastAtRule = atRules.findLast((rule) => ["plugin", "import"].includes(rule.name));
6598
+ const pluginPos = lastAtRule.source.end.offset;
6623
6599
  for (const plugin of plugins) {
6624
6600
  if (!options$6.plugins.includes(plugin.id)) continue;
6625
- addAtRule(ast, "plugin", `'${plugin.package}'`, true);
6601
+ const pluginRule = findAtRule("plugin", plugin.package);
6602
+ if (!pluginRule) {
6603
+ const pluginImport = `\n@plugin '${plugin.package}';`;
6604
+ code = code.substring(0, pluginPos) + pluginImport + code.substring(pluginPos);
6605
+ }
6626
6606
  }
6627
- if (originalFirst !== ast.first && originalFirst?.type === "atrule" && originalFirst.name === "import") originalFirst.raws.before = "\n";
6628
- nodes.shift();
6629
- nodes.forEach((n$1) => n$1.raws.before = "\n");
6630
- return generateCode();
6607
+ return code;
6631
6608
  });
6632
6609
  if (!kit) sv.file("src/App.svelte", (content) => {
6633
6610
  const { script, generateCode } = parseSvelte(content, { typescript });
@@ -10186,15 +10163,15 @@ async function createProject(cwd, options$6) {
10186
10163
  language: () => {
10187
10164
  if (options$6.types) return Promise.resolve(options$6.types);
10188
10165
  return select({
10189
- message: "Add type checking with Typescript?",
10166
+ message: "Add type checking with TypeScript?",
10190
10167
  initialValue: "typescript",
10191
10168
  options: [
10192
10169
  {
10193
- label: "Yes, using Typescript syntax",
10170
+ label: "Yes, using TypeScript syntax",
10194
10171
  value: "typescript"
10195
10172
  },
10196
10173
  {
10197
- label: "Yes, using Javascript with JSDoc comments",
10174
+ label: "Yes, using JavaScript with JSDoc comments",
10198
10175
  value: "checkjs"
10199
10176
  },
10200
10177
  {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { create } from "./package-manager-f0ge7H2V.js";
2
- import { installAddon } from "./install-PTlNv0EA.js";
1
+ import { create } from "./package-manager-DYKbLpuq.js";
2
+ import { installAddon } from "./install-Bjzz5ixb.js";
3
3
 
4
4
  export { create, installAddon };
@@ -1,4 +1,4 @@
1
- import { __commonJS, __toESM, be, detectSync, getUserAgent, log, parseJson, parseScript as parseScript$1, parseScript$1 as parseScript, resolveCommand, serializeScript, stripAst, up, walk_exports } from "./package-manager-f0ge7H2V.js";
1
+ import { __commonJS, __toESM, be, detectSync, getUserAgent, log, parseJson, parseScript as parseScript$1, parseScript$1 as parseScript, resolveCommand, serializeScript, stripAst, up, walk_exports } from "./package-manager-DYKbLpuq.js";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import process$1 from "node:process";
@@ -40223,4 +40223,4 @@ else packageDirectory = cwd$1;
40223
40223
  }
40224
40224
 
40225
40225
  //#endregion
40226
- export { AtRule, Element, __commonJS$3 as __commonJS, __require$1 as __require, __toESM$3 as __toESM, addPnpmBuildDependendencies, be, box, cancel, confirm, create, detectSync, esm_exports, from, getUserAgent, group, installDependencies, intro, isCancel, log, multiselect, note, outro, packageManagerPrompt, parseCss, parseHtml, parseHtml$1, parseJson, parseScript, parseScript$1, parseSvelte, resolveCommand, select, serializeScript, spinner, stripAst, templates, text, up, walk_exports };
40226
+ export { Element, __commonJS$3 as __commonJS, __require$1 as __require, __toESM$3 as __toESM, addPnpmBuildDependendencies, be, box, cancel, confirm, create, detectSync, esm_exports, from, getUserAgent, group, installDependencies, intro, isCancel, log, multiselect, note, outro, packageManagerPrompt, parseCss, parseHtml, parseHtml$1, parseJson, parseScript, parseScript$1, parseSvelte, resolveCommand, select, serializeScript, spinner, stripAst, templates, text, up, walk_exports };
package/dist/testing.js CHANGED
@@ -1,4 +1,4 @@
1
- import { __commonJS, __require, __toESM, addPnpmBuildDependendencies, be, create } from "./package-manager-f0ge7H2V.js";
1
+ import { __commonJS, __require, __toESM, addPnpmBuildDependendencies, be, create } from "./package-manager-DYKbLpuq.js";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import process$1 from "node:process";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sv",
3
- "version": "0.6.23",
3
+ "version": "0.6.24",
4
4
  "type": "module",
5
5
  "description": "A CLI for creating and updating SvelteKit projects",
6
6
  "license": "MIT",