svelte-bundle 0.4.0 → 0.5.0

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.
Files changed (2) hide show
  1. package/dist/cli.js +59 -10
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2949,6 +2949,8 @@ function validatePackageName(name) {
2949
2949
  }
2950
2950
  return null;
2951
2951
  }
2952
+ // package.json
2953
+ var version = "0.5.0";
2952
2954
 
2953
2955
  // src/commands/create/prompts.ts
2954
2956
  function assertNotCancelled(value) {
@@ -2959,7 +2961,7 @@ function assertNotCancelled(value) {
2959
2961
  return value;
2960
2962
  }
2961
2963
  async function runCreatePrompts(nameArg, pmArg) {
2962
- we(import_picocolors3.default.bgCyan(import_picocolors3.default.black(" svelte-bundle ")) + import_picocolors3.default.dim(" v0.2.0"));
2964
+ we(import_picocolors3.default.bgCyan(import_picocolors3.default.black(" svelte-bundle ")) + import_picocolors3.default.dim(`v${version}`));
2963
2965
  let name;
2964
2966
  if (nameArg !== undefined && nameArg.length > 0) {
2965
2967
  const validationError = validatePackageName(nameArg);
@@ -2980,7 +2982,12 @@ async function runCreatePrompts(nameArg, pmArg) {
2980
2982
  }
2981
2983
  let packageManager;
2982
2984
  if (pmArg !== undefined) {
2983
- const validPMs = ["bun", "npm", "pnpm", "yarn"];
2985
+ const validPMs = [
2986
+ "bun",
2987
+ "npm",
2988
+ "pnpm",
2989
+ "yarn"
2990
+ ];
2984
2991
  const matched = validPMs.find((pm) => pm === pmArg);
2985
2992
  if (matched === undefined) {
2986
2993
  ve2(`Unknown package manager "${pmArg}". Must be one of: bun, npm, pnpm, yarn.`);
@@ -3001,11 +3008,40 @@ async function runCreatePrompts(nameArg, pmArg) {
3001
3008
  const features = assertNotCancelled(await pe({
3002
3009
  message: "Add optional features: (space to toggle, enter to confirm)",
3003
3010
  options: [
3004
- { value: "tailwind", label: "Tailwind CSS", hint: "utility-first CSS framework" },
3011
+ {
3012
+ value: "tailwind",
3013
+ label: "Tailwind CSS",
3014
+ hint: "utility-first CSS framework"
3015
+ },
3005
3016
  { value: "eslint", label: "ESLint", hint: "code linting" },
3006
3017
  { value: "prettier", label: "Prettier", hint: "code formatting" },
3007
3018
  { value: "vitest", label: "Vitest", hint: "unit testing" },
3008
- { value: "playwright", label: "Playwright", hint: "end-to-end testing" }
3019
+ {
3020
+ value: "playwright",
3021
+ label: "Playwright",
3022
+ hint: "end-to-end testing"
3023
+ }
3024
+ ],
3025
+ required: false
3026
+ }));
3027
+ const buildFlags = assertNotCancelled(await pe({
3028
+ message: "Customize the build command: (space to toggle, enter to confirm)",
3029
+ options: [
3030
+ {
3031
+ value: "hydrate",
3032
+ label: "--hydrate",
3033
+ hint: "SSR pre-rendering for SEO-friendly output"
3034
+ },
3035
+ {
3036
+ value: "inline-assets",
3037
+ label: "--inline-assets",
3038
+ hint: "embed binary assets as base64 data URIs"
3039
+ },
3040
+ {
3041
+ value: "mode-development",
3042
+ label: "--mode development",
3043
+ hint: "build in development mode instead of production"
3044
+ }
3009
3045
  ],
3010
3046
  required: false
3011
3047
  }));
@@ -3022,6 +3058,7 @@ async function runCreatePrompts(nameArg, pmArg) {
3022
3058
  name,
3023
3059
  packageManager,
3024
3060
  features,
3061
+ buildFlags,
3025
3062
  git,
3026
3063
  install
3027
3064
  };
@@ -3261,6 +3298,15 @@ test('has title', async ({ page }) => {
3261
3298
  ]
3262
3299
  }
3263
3300
  };
3301
+ var BUILD_FLAG_ARGS = {
3302
+ hydrate: "--hydrate",
3303
+ "inline-assets": "--inline-assets",
3304
+ "mode-development": "--mode development"
3305
+ };
3306
+ function buildScript(flags) {
3307
+ const args = flags.map((f3) => BUILD_FLAG_ARGS[f3]);
3308
+ return args.length > 0 ? `svelte-bundle build ${args.join(" ")}` : "svelte-bundle build";
3309
+ }
3264
3310
  function buildPackageJson(ctx) {
3265
3311
  const pkg = {
3266
3312
  name: ctx.name,
@@ -3269,7 +3315,7 @@ function buildPackageJson(ctx) {
3269
3315
  type: "module",
3270
3316
  scripts: {
3271
3317
  dev: "vite",
3272
- build: "vite build",
3318
+ build: buildScript(ctx.buildFlags),
3273
3319
  preview: "vite preview",
3274
3320
  "type-check": "tsc --noEmit"
3275
3321
  },
@@ -3277,7 +3323,8 @@ function buildPackageJson(ctx) {
3277
3323
  "@sveltejs/vite-plugin-svelte": "^5.0.0",
3278
3324
  svelte: "^5.0.0",
3279
3325
  typescript: "^5.0.0",
3280
- vite: "^6.0.0"
3326
+ vite: "^6.0.0",
3327
+ "svelte-bundle": `^${version}`
3281
3328
  }
3282
3329
  };
3283
3330
  for (const feature of ctx.features) {
@@ -3297,7 +3344,10 @@ function buildPackageJson(ctx) {
3297
3344
  }
3298
3345
  function buildViteConfig(ctx) {
3299
3346
  const hasTailwind = ctx.features.includes("tailwind");
3300
- const imports = ["import { defineConfig } from 'vite';", "import { svelte } from '@sveltejs/vite-plugin-svelte';"];
3347
+ const imports = [
3348
+ "import { defineConfig } from 'vite';",
3349
+ "import { svelte } from '@sveltejs/vite-plugin-svelte';"
3350
+ ];
3301
3351
  if (hasTailwind) {
3302
3352
  imports.push("import tailwindcss from '@tailwindcss/vite';");
3303
3353
  }
@@ -3310,7 +3360,6 @@ export default defineConfig({
3310
3360
  esbuild: {
3311
3361
  // Strip all legal/license comments (e.g. from lucide-svelte) from JS and CSS
3312
3362
  legalComments: 'none',
3313
- comments: false,
3314
3363
  },
3315
3364
  });
3316
3365
  `;
@@ -3736,8 +3785,8 @@ var buildCommand = defineCommand({
3736
3785
  var main = defineCommand({
3737
3786
  meta: {
3738
3787
  name: "svelte-bundle",
3739
- version: "0.2.0",
3740
- description: "Scaffold and bundle Svelte components with Vite"
3788
+ version,
3789
+ description: "Scaffold and bundle a svelte project into a single html file with Vite."
3741
3790
  },
3742
3791
  subCommands: {
3743
3792
  create: createCommand,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-bundle",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "A powerful CLI for scaffolding and bundling Svelte components",
5
5
  "type": "module",
6
6
  "bin": {