@slidev/cli 0.48.0-beta.16 → 0.48.0-beta.17

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.
@@ -2,7 +2,7 @@ import {
2
2
  ViteSlidevPlugin,
3
3
  getIndexHtml,
4
4
  mergeViteConfigs
5
- } from "./chunk-TMXTXTYI.mjs";
5
+ } from "./chunk-I5ZCLMQU.mjs";
6
6
  import "./chunk-O6TYYGU6.mjs";
7
7
  import "./chunk-G3BP3FUT.mjs";
8
8
  import "./chunk-BXO7ZPPU.mjs";
@@ -2496,7 +2496,7 @@ var require_semver2 = __commonJS({
2496
2496
  });
2497
2497
 
2498
2498
  // package.json
2499
- var version = "0.48.0-beta.16";
2499
+ var version = "0.48.0-beta.17";
2500
2500
 
2501
2501
  // node/common.ts
2502
2502
  import { existsSync, promises as fs } from "node:fs";
@@ -2690,24 +2690,22 @@ function createConfigPlugin(options) {
2690
2690
  rollupOptions: {
2691
2691
  output: {
2692
2692
  chunkFileNames(chunkInfo) {
2693
- const DEFAULT = "[name]-[hash].js";
2694
- if (chunkInfo.name.includes("/") || chunkInfo.name === "entry")
2693
+ const DEFAULT = "assets/[name]-[hash].js";
2694
+ if (chunkInfo.name.includes("/"))
2695
2695
  return DEFAULT;
2696
2696
  if (chunkInfo.moduleIds.filter((i) => isSlidevClient(i)).length > chunkInfo.moduleIds.length * 0.6)
2697
- return "slidev/[name]-[hash].js";
2698
- if (chunkInfo.moduleIds.filter((i) => i.includes("/monaco-editor/")).length > chunkInfo.moduleIds.length * 0.6)
2699
- return "monaco/[name]-[hash].js";
2697
+ return "assets/slidev/[name]-[hash].js";
2698
+ if (chunkInfo.moduleIds.filter((i) => i.match(/\/monaco-editor(-core)?\//)).length > chunkInfo.moduleIds.length * 0.6)
2699
+ return "assets/monaco/[name]-[hash].js";
2700
2700
  return DEFAULT;
2701
2701
  },
2702
2702
  manualChunks(id) {
2703
- if (id.startsWith("/@slidev-monaco-types/") || id.includes("/@slidev/monaco-types") || id.match(/(\.d\.[mc]?ts|package.json)\?raw$/))
2703
+ if (id.startsWith("/@slidev-monaco-types/") || id.includes("/@slidev/monaco-types") || id.endsWith("?monaco-types&raw"))
2704
2704
  return "monaco/bundled-types";
2705
2705
  if (id.includes("/shiki/") || id.includes("/@shikijs/"))
2706
2706
  return `modules/shiki`;
2707
2707
  if (id.startsWith("~icons/"))
2708
2708
  return "modules/unplugin-icons";
2709
- if (id.includes("/client/main.ts"))
2710
- return "entry";
2711
2709
  const matchedAsyncModule = ASYNC_MODULES.find((i) => id.includes(`/node_modules/${i}`));
2712
2710
  if (matchedAsyncModule)
2713
2711
  return `modules/${matchedAsyncModule.replace("@", "").replace("/", "-")}`;
@@ -2757,7 +2755,7 @@ function getDefine(options) {
2757
2755
  // node/plugins/loaders.ts
2758
2756
  import { basename as basename2, join as join4, resolve as resolve2 } from "node:path";
2759
2757
  import { builtinModules } from "node:module";
2760
- import { isString, isTruthy as isTruthy2, notNullish, objectMap, range } from "@antfu/utils";
2758
+ import { isString, isTruthy as isTruthy2, notNullish, objectMap, range, uniq as uniq2 } from "@antfu/utils";
2761
2759
  import fg2 from "fast-glob";
2762
2760
  import fs5 from "fs-extra";
2763
2761
  import Markdown2 from "markdown-it";
@@ -3454,7 +3452,7 @@ function transformHighlighter(md2) {
3454
3452
  return md2.replace(
3455
3453
  reCodeBlock,
3456
3454
  (full, lang = "", rangeStr = "", options = "", attrs = "", code) => {
3457
- const ranges = rangeStr.split(/\|/g).map((i) => i.trim());
3455
+ const ranges = !rangeStr.trim() ? [] : rangeStr.trim().split(/\|/g).map((i) => i.trim());
3458
3456
  code = code.trimEnd();
3459
3457
  options = options.trim() || "{}";
3460
3458
  return `
@@ -4077,7 +4075,7 @@ defineProps<{ no: number | string }>()`);
4077
4075
  "}"
4078
4076
  ].join("\n");
4079
4077
  for (const file of files) {
4080
- const url = `${toAtFS(resolve2(typesRoot, file))}?raw`;
4078
+ const url = `${toAtFS(resolve2(typesRoot, file))}?monaco-types&raw`;
4081
4079
  result += `addFile(import(${JSON.stringify(url)}), ${JSON.stringify(file)})
4082
4080
  `;
4083
4081
  }
@@ -4096,11 +4094,11 @@ defineProps<{ no: number | string }>()`);
4096
4094
  const moduleName = a.startsWith("@") ? `${a}/${b}` : a;
4097
4095
  return moduleName;
4098
4096
  }
4099
- for (const specifier of deps) {
4097
+ for (const specifier of uniq2(deps)) {
4100
4098
  if (specifier[0] === ".")
4101
4099
  continue;
4102
4100
  const moduleName = mapModuleNameToModule(specifier);
4103
- result += `import(${JSON.stringify(`/@slidev-monaco-types/resolve/${moduleName}`)})
4101
+ result += `import(${JSON.stringify(`/@slidev-monaco-types/resolve?pkg=${moduleName}`)})
4104
4102
  `;
4105
4103
  }
4106
4104
  return result;
@@ -4257,7 +4255,7 @@ export default {
4257
4255
  // node/plugins/setupClient.ts
4258
4256
  import { existsSync as existsSync2 } from "node:fs";
4259
4257
  import { join as join5, resolve as resolve3 } from "node:path";
4260
- import { slash as slash2, uniq as uniq2 } from "@antfu/utils";
4258
+ import { slash as slash2, uniq as uniq3 } from "@antfu/utils";
4261
4259
  function createClientSetupPlugin({ themeRoots, addonRoots, userRoot, clientRoot }) {
4262
4260
  const setupEntry = slash2(resolve3(clientRoot, "setup"));
4263
4261
  return {
@@ -4272,7 +4270,7 @@ function createClientSetupPlugin({ themeRoots, addonRoots, userRoot, clientRoot
4272
4270
  const name = id.slice(setupEntry.length + 1).replace(/\?.*$/, "");
4273
4271
  const imports = [];
4274
4272
  const injections = [];
4275
- const setups = uniq2([
4273
+ const setups = uniq3([
4276
4274
  ...themeRoots,
4277
4275
  ...addonRoots,
4278
4276
  userRoot
@@ -4348,7 +4346,7 @@ function createMonacoTypesLoader({ userRoot }) {
4348
4346
  return null;
4349
4347
  },
4350
4348
  async load(id) {
4351
- const matchResolve = id.match(/^\/\@slidev-monaco-types\/resolve\/(.*?)(?:\?importer=(.*))?$/);
4349
+ const matchResolve = id.match(/^\/\@slidev-monaco-types\/resolve\?pkg=(.*?)(?:&importer=(.*))?$/);
4352
4350
  if (matchResolve) {
4353
4351
  const [_, pkg, importer = userRoot] = matchResolve;
4354
4352
  const resolvedDeps = resolvedDepsMap[importer] ??= /* @__PURE__ */ new Set();
@@ -4362,23 +4360,24 @@ function createMonacoTypesLoader({ userRoot }) {
4362
4360
  const pkgJson = JSON.parse(await fs6.readFile(pkgJsonPath, "utf-8"));
4363
4361
  const deps = pkgJson.dependencies ?? {};
4364
4362
  return [
4365
- `import "/@slidev-monaco-types/load/${slash3(root)}&name=${pkgJson.name}"`,
4366
- ...Object.keys(deps).map((dep) => `import "/@slidev-monaco-types/resolve/${dep}?importer=${slash3(root)}"`)
4363
+ `import "/@slidev-monaco-types/load?root=${slash3(root)}&name=${pkgJson.name}"`,
4364
+ ...Object.keys(deps).map((dep) => `import "/@slidev-monaco-types/resolve?pkg=${dep}&importer=${slash3(root)}"`)
4367
4365
  ].join("\n");
4368
4366
  }
4369
- const matchLoad = id.match(/^\/\@slidev-monaco-types\/load(\/.*?)&name=(.*)$/);
4367
+ const matchLoad = id.match(/^\/\@slidev-monaco-types\/load\?root=(.*?)&name=(.*)$/);
4370
4368
  if (matchLoad) {
4371
4369
  const [_, root, name] = matchLoad;
4372
4370
  const files = await fg3(
4373
4371
  [
4374
- "**/*.d.ts",
4375
- "**/*.d.mts",
4376
- "**/*.d.cts",
4372
+ "**/*.ts",
4373
+ "**/*.mts",
4374
+ "**/*.cts",
4377
4375
  "package.json"
4378
4376
  ],
4379
4377
  {
4380
4378
  cwd: root,
4381
- followSymbolicLinks: true
4379
+ followSymbolicLinks: true,
4380
+ ignore: ["**/node_modules/**"]
4382
4381
  }
4383
4382
  );
4384
4383
  if (!files.length)
@@ -4391,7 +4390,7 @@ function createMonacoTypesLoader({ userRoot }) {
4391
4390
  ' monaco.languages.typescript.typescriptDefaults.addExtraLib(code, "file://" + path)',
4392
4391
  ' monaco.editor.createModel(code, "javascript", monaco.Uri.file(path))',
4393
4392
  "}",
4394
- ...files.map((file) => `addFile(import(${JSON.stringify(`${toAtFS(resolve4(root, file))}?raw`)}), ${JSON.stringify(file)})`)
4393
+ ...files.map((file) => `addFile(import(${JSON.stringify(`${toAtFS(resolve4(root, file))}?monaco-types&raw`)}), ${JSON.stringify(file)})`)
4395
4394
  ].join("\n");
4396
4395
  }
4397
4396
  }
@@ -4,7 +4,7 @@ import {
4
4
  mergeViteConfigs,
5
5
  require_semver,
6
6
  version
7
- } from "./chunk-TMXTXTYI.mjs";
7
+ } from "./chunk-I5ZCLMQU.mjs";
8
8
  import {
9
9
  createResolver,
10
10
  getRoots,
package/dist/cli.mjs CHANGED
@@ -5,10 +5,10 @@ import {
5
5
  resolveAddons,
6
6
  resolveOptions,
7
7
  resolveTheme
8
- } from "./chunk-6SJIO2WJ.mjs";
8
+ } from "./chunk-M42N6HWT.mjs";
9
9
  import {
10
10
  version
11
- } from "./chunk-TMXTXTYI.mjs";
11
+ } from "./chunk-I5ZCLMQU.mjs";
12
12
  import {
13
13
  loadSetups
14
14
  } from "./chunk-O6TYYGU6.mjs";
@@ -277,7 +277,7 @@ cli.command(
277
277
  }).strict().help(),
278
278
  async (args) => {
279
279
  const { entry, theme, watch, base, download, out, inspect } = args;
280
- const { build } = await import("./build-BFCSVURA.mjs");
280
+ const { build } = await import("./build-TRJ6GBCA.mjs");
281
281
  for (const entryFile of entry) {
282
282
  const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
283
283
  if (download && !options.data.config.download)
package/dist/index.mjs CHANGED
@@ -2,10 +2,10 @@ import {
2
2
  createServer,
3
3
  parser,
4
4
  resolveOptions
5
- } from "./chunk-6SJIO2WJ.mjs";
5
+ } from "./chunk-M42N6HWT.mjs";
6
6
  import {
7
7
  ViteSlidevPlugin
8
- } from "./chunk-TMXTXTYI.mjs";
8
+ } from "./chunk-I5ZCLMQU.mjs";
9
9
  import "./chunk-O6TYYGU6.mjs";
10
10
  import "./chunk-G3BP3FUT.mjs";
11
11
  import "./chunk-BXO7ZPPU.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
- "version": "0.48.0-beta.16",
3
+ "version": "0.48.0-beta.17",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -104,9 +104,9 @@
104
104
  "vitefu": "^0.2.5",
105
105
  "vue": "^3.4.20",
106
106
  "yargs": "^17.7.2",
107
- "@slidev/client": "0.48.0-beta.16",
108
- "@slidev/parser": "0.48.0-beta.16",
109
- "@slidev/types": "0.48.0-beta.16"
107
+ "@slidev/client": "0.48.0-beta.17",
108
+ "@slidev/parser": "0.48.0-beta.17",
109
+ "@slidev/types": "0.48.0-beta.17"
110
110
  },
111
111
  "devDependencies": {
112
112
  "@hedgedoc/markdown-it-plugins": "^2.1.4",