@visulima/packem 2.0.0-alpha.40 → 2.0.0-alpha.43

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 (103) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/LICENSE.md +1548 -1497
  3. package/dist/builder/typedoc/index.js +160 -3
  4. package/dist/cli/index.js +1377 -45
  5. package/dist/config/index.js +4 -1
  6. package/dist/config/preset/react.d.ts +59 -0
  7. package/dist/config/preset/react.js +43 -0
  8. package/dist/config/preset/solid.d.ts +101 -0
  9. package/dist/config/preset/solid.js +72 -0
  10. package/dist/config/preset/svelte.d.ts +71 -0
  11. package/dist/config/preset/svelte.js +44 -0
  12. package/dist/config/preset/vue.d.ts +53 -0
  13. package/dist/config/preset/vue.js +33 -0
  14. package/dist/index.js +30 -1
  15. package/dist/packem_shared/create-or-update-key-storage-Dd7b8-t1.js +36 -0
  16. package/dist/packem_shared/default-79SPobLI.js +12 -0
  17. package/dist/packem_shared/default-DWBYeUSC.js +210 -0
  18. package/dist/packem_shared/default-DaU6CQEi.js +28 -0
  19. package/dist/packem_shared/default-DavaZMwC.js +32 -0
  20. package/dist/packem_shared/default-DeYZ934H.js +32 -0
  21. package/dist/packem_shared/default-tUOOZ8w7.js +42 -0
  22. package/dist/packem_shared/default-wScAfTaq.js +27 -0
  23. package/dist/packem_shared/index-CTIRxV2x.js +63 -0
  24. package/dist/packem_shared/index-DzTDn4ad.js +9521 -0
  25. package/dist/rollup/plugins/css/loaders/less.js +1 -1
  26. package/dist/rollup/plugins/css/loaders/lightningcss.js +1 -1
  27. package/dist/rollup/plugins/css/loaders/postcss.js +1 -1
  28. package/dist/rollup/plugins/css/loaders/sass.js +1 -1
  29. package/dist/rollup/plugins/css/loaders/sourcemap.js +1 -1
  30. package/dist/rollup/plugins/css/loaders/stylus.js +1 -1
  31. package/dist/rollup/plugins/css/loaders/tailwindcss.js +1 -1
  32. package/dist/rollup/plugins/css/minifiers/cssnano.js +1 -1
  33. package/dist/rollup/plugins/css/minifiers/lightningcss.js +1 -1
  34. package/dist/rollup/plugins/esbuild/index.js +1 -1
  35. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.js +1 -1
  36. package/dist/rollup/plugins/oxc/oxc-transformer.js +1 -1
  37. package/dist/rollup/plugins/sucrase/index.js +1 -1
  38. package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.js +1 -1
  39. package/dist/rollup/plugins/swc/swc-plugin.js +1 -1
  40. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.js +1 -1
  41. package/dist/types.d.ts +2 -1
  42. package/package.json +143 -6
  43. package/dist/builder/typedoc/generate-reference-documentation.d.ts +0 -4
  44. package/dist/cli/commands/add.d.ts +0 -3
  45. package/dist/cli/commands/build.d.ts +0 -21
  46. package/dist/cli/commands/init.d.ts +0 -3
  47. package/dist/cli/commands/migrate.d.ts +0 -21
  48. package/dist/cli/commands/utils/css-loader-dependencies.d.ts +0 -2
  49. package/dist/config/preset/auto.d.ts +0 -3
  50. package/dist/config/preset/utils/infer-entries.d.ts +0 -12
  51. package/dist/config/preset/utils/overwrite-with-publish-config.d.ts +0 -4
  52. package/dist/config/utils/find-packem-file.d.ts +0 -2
  53. package/dist/config/utils/load-package-json.d.ts +0 -6
  54. package/dist/config/utils/load-packem-config.d.ts +0 -7
  55. package/dist/config/utils/load-preset.d.ts +0 -4
  56. package/dist/config/utils/load-tsconfig.d.ts +0 -5
  57. package/dist/config/utils/prepare-entries.d.ts +0 -4
  58. package/dist/jit/create-stub.d.ts +0 -4
  59. package/dist/packem/build.d.ts +0 -21
  60. package/dist/packem/index.d.ts +0 -25
  61. package/dist/packem/utils/brotli-size.d.ts +0 -2
  62. package/dist/packem/utils/group-by-keys.d.ts +0 -3
  63. package/dist/packem/utils/gzip-size.d.ts +0 -2
  64. package/dist/packem_shared/browserslistToEsbuild-C0IWmbNe-C6xPL1oW.js +0 -1
  65. package/dist/packem_shared/create-or-update-key-storage-GwAIWW7R.js +0 -3
  66. package/dist/packem_shared/default-B2EOH52z.js +0 -1
  67. package/dist/packem_shared/default-BYM_JvQL.js +0 -1
  68. package/dist/packem_shared/default-B_dUKZ_J.js +0 -1
  69. package/dist/packem_shared/default-Dego_fiC.js +0 -1
  70. package/dist/packem_shared/default-E4TiWfSK.js +0 -1
  71. package/dist/packem_shared/esbuildPlugin-DpLtQGuZ-Bny-e486.js +0 -3
  72. package/dist/packem_shared/index-CUp9WuCG.js +0 -1
  73. package/dist/packem_shared/index-DFigeRU2.js +0 -174
  74. package/dist/packem_shared/isolatedDeclarationsOxcTransformer-WbfE6cGu-NeZOx2Y7.js +0 -1
  75. package/dist/packem_shared/isolatedDeclarationsSwcTransformer-Ch2AgtWC-B-0lOgFf.js +0 -1
  76. package/dist/packem_shared/isolatedDeclarationsTypescriptTransformer-DkuEkofo-Cwe3ODMG.js +0 -3
  77. package/dist/packem_shared/oxcResolvePlugin-Ccef6pyL-D14z9S9i.js +0 -1
  78. package/dist/packem_shared/oxcTransformPlugin-DfVQouIB-Cpfv95eA.js +0 -4
  79. package/dist/packem_shared/resolveTypescriptMjsCtsPlugin-DcZrZTmM-3AmQC7y7.js +0 -6
  80. package/dist/packem_shared/swcPlugin-Boip4lWG-CwJ-HVJc.js +0 -1
  81. package/dist/rollup/build-types.d.ts +0 -5
  82. package/dist/rollup/build.d.ts +0 -5
  83. package/dist/rollup/get-rollup-options.d.ts +0 -5
  84. package/dist/rollup/utils/resolve-aliases.d.ts +0 -4
  85. package/dist/rollup/watch.d.ts +0 -5
  86. package/dist/utils/clean-distribution-directories.d.ts +0 -4
  87. package/dist/utils/create-or-update-key-storage.d.ts +0 -3
  88. package/dist/utils/extract-export-filenames.d.ts +0 -16
  89. package/dist/utils/find-alternatives.d.ts +0 -2
  90. package/dist/utils/get-package-side-effect.d.ts +0 -3
  91. package/dist/utils/infer-export-type.d.ts +0 -3
  92. package/dist/utils/kill-process.d.ts +0 -14
  93. package/dist/utils/log-build-errors.d.ts +0 -4
  94. package/dist/utils/remove-old-cache-folders.d.ts +0 -3
  95. package/dist/utils/warn-legacy-cjs.d.ts +0 -8
  96. package/dist/validator/attw.d.ts +0 -7
  97. package/dist/validator/package-json/index.d.ts +0 -4
  98. package/dist/validator/package-json/validate-dependencies.d.ts +0 -4
  99. package/dist/validator/package-json/validate-engines.d.ts +0 -4
  100. package/dist/validator/package-json/validate-package-entries.d.ts +0 -4
  101. package/dist/validator/package-json/validate-package-fields.d.ts +0 -4
  102. package/dist/validator/validate-alias-entries.d.ts +0 -3
  103. package/dist/validator/validate-bundle-size.d.ts +0 -4
@@ -1 +1,4 @@
1
- var i=Object.defineProperty;var r=(e,n)=>i(e,"name",{value:n,configurable:!0});var t=Object.defineProperty,f=r((e,n)=>t(e,"name",{value:n,configurable:!0}),"e");const a=f(e=>e,"defineConfig"),d=f(e=>e,"definePreset");export{a as defineConfig,d as definePreset};
1
+ const defineConfig = (config) => config;
2
+ const definePreset = (preset) => preset;
3
+
4
+ export { defineConfig, definePreset };
@@ -0,0 +1,59 @@
1
+ import type { BabelPluginConfig } from "@visulima/packem-rollup/babel";
2
+ import type { BuildConfig } from "../../types.d.ts";
3
+ export interface ReactPresetOptions {
4
+ /**
5
+ * Enable React Compiler optimization
6
+ * @default false
7
+ */
8
+ compiler?: boolean | {
9
+ /**
10
+ * React Compiler compilation mode
11
+ * @default "infer"
12
+ */
13
+ compilationMode?: "infer" | "annotation";
14
+ /**
15
+ * React Compiler panic threshold
16
+ * @default "critical_errors"
17
+ */
18
+ panicThreshold?: "critical_errors" | "all_errors";
19
+ };
20
+ /**
21
+ * Custom Babel plugins to add
22
+ */
23
+ plugins?: BabelPluginConfig["plugins"];
24
+ /**
25
+ * Custom Babel presets to add
26
+ */
27
+ presets?: BabelPluginConfig["presets"];
28
+ }
29
+ /**
30
+ * React preset for Packem. Configures Babel with React presets and optionally React Compiler.
31
+ * @description This preset configures Babel to run before your main transformer (esbuild/SWC/etc.).
32
+ * Babel handles JSX transformation, while TypeScript is handled by the transformer via parser plugins.
33
+ * This matches the approach used by @vitejs/plugin-react.
34
+ * @example
35
+ * ```typescript
36
+ * // Basic usage
37
+ * export default defineConfig({
38
+ * preset: "react"
39
+ * });
40
+ *
41
+ * // With React Compiler
42
+ * import { createReactPreset } from "@visulima/packem/config/preset/react";
43
+ * export default defineConfig({
44
+ * preset: createReactPreset({
45
+ * compiler: true
46
+ * })
47
+ * });
48
+ *
49
+ * // With custom options
50
+ * export default defineConfig({
51
+ * preset: createReactPreset({
52
+ * compiler: {
53
+ * compilationMode: "annotation"
54
+ * }
55
+ * })
56
+ * });
57
+ * ```
58
+ */
59
+ export declare const createReactPreset: (options?: ReactPresetOptions) => BuildConfig;
@@ -0,0 +1,43 @@
1
+ const createReactPreset = (options = {}) => {
2
+ const { compiler = false, plugins = [], presets = [] } = options;
3
+ const babelPlugins = [];
4
+ const babelPresets = [];
5
+ if (compiler) {
6
+ const compilerOptions = typeof compiler === "object" ? compiler : {};
7
+ babelPlugins.push([
8
+ "babel-plugin-react-compiler",
9
+ {
10
+ compilationMode: compilerOptions.compilationMode ?? "infer",
11
+ panicThreshold: compilerOptions.panicThreshold ?? "critical_errors"
12
+ }
13
+ ]);
14
+ }
15
+ babelPresets.push([
16
+ "@babel/preset-react",
17
+ {
18
+ runtime: "automatic"
19
+ }
20
+ ]);
21
+ const finalPlugins = [...babelPlugins, ...Array.isArray(plugins) ? plugins : []];
22
+ const finalPresets = [...babelPresets, ...Array.isArray(presets) ? presets : []];
23
+ return {
24
+ rollup: {
25
+ babel: {
26
+ plugins: finalPlugins.length > 0 ? finalPlugins : void 0,
27
+ presets: finalPresets.length > 0 ? finalPresets : void 0
28
+ }
29
+ },
30
+ validation: {
31
+ dependencies: {
32
+ hoisted: {
33
+ exclude: []
34
+ },
35
+ unused: {
36
+ exclude: ["react", "react-dom"]
37
+ }
38
+ }
39
+ }
40
+ };
41
+ };
42
+
43
+ export { createReactPreset };
@@ -0,0 +1,101 @@
1
+ import type { BabelPluginConfig } from "@visulima/packem-rollup/babel";
2
+ import type { BuildConfig } from "../../types.d.ts";
3
+ export interface SolidPresetOptions {
4
+ /**
5
+ * Pass any additional babel transform options. They will be merged with
6
+ * the transformations required by Solid.
7
+ */
8
+ babel?: BabelPluginConfig | ((source: string, id: string) => BabelPluginConfig | Promise<BabelPluginConfig>);
9
+ /**
10
+ * Custom Babel plugins to add
11
+ */
12
+ plugins?: BabelPluginConfig["plugins"];
13
+ /**
14
+ * Custom Babel presets to add
15
+ */
16
+ presets?: BabelPluginConfig["presets"];
17
+ /**
18
+ * SolidJS-specific options for babel-preset-solid
19
+ */
20
+ solidOptions?: {
21
+ /**
22
+ * Array of Component exports from module, that aren't included by default with the library.
23
+ * This plugin will automatically import them if it comes across them in the JSX.
24
+ * @default ["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"]
25
+ */
26
+ builtIns?: string[];
27
+ /**
28
+ * Boolean indicates whether to set current render context on Custom Elements and slots.
29
+ * Useful for seemless Context API with Web Components.
30
+ * @default true
31
+ */
32
+ contextToCustomElements?: boolean;
33
+ /**
34
+ * Boolean to indicate whether to enable automatic event delegation on camelCase.
35
+ * @default true
36
+ */
37
+ delegateEvents?: boolean;
38
+ /**
39
+ * The output mode of the compiler.
40
+ * Can be:
41
+ * - "dom" is standard output
42
+ * - "ssr" is for server side rendering of strings.
43
+ * - "universal" is for using custom renderers from solid-js/universal
44
+ * @default "dom"
45
+ */
46
+ generate?: "ssr" | "dom" | "universal";
47
+ /**
48
+ * Indicate whether the output should contain hydratable markers.
49
+ * @default false
50
+ */
51
+ hydratable?: boolean;
52
+ /**
53
+ * The name of the runtime module to import the methods from.
54
+ * @default "solid-js/web"
55
+ */
56
+ moduleName?: string;
57
+ /**
58
+ * Boolean indicates whether smart conditional detection should be used.
59
+ * This optimizes simple boolean expressions and ternaries in JSX.
60
+ * @default true
61
+ */
62
+ wrapConditionals?: boolean;
63
+ };
64
+ }
65
+ /**
66
+ * SolidJS preset for Packem. Configures Babel with babel-preset-solid.
67
+ * @description This preset configures Babel to run before your main transformer (esbuild/SWC/etc.).
68
+ * Babel handles JSX transformation for SolidJS using babel-preset-solid. TypeScript is handled
69
+ * automatically via parser plugins based on file extensions (no preset needed).
70
+ * @example
71
+ * ```typescript
72
+ * // Basic usage
73
+ * export default defineConfig({
74
+ * preset: "solid"
75
+ * });
76
+ *
77
+ * // With custom Solid options
78
+ * import { createSolidPreset } from "@visulima/packem/config/preset/solid";
79
+ * export default defineConfig({
80
+ * preset: createSolidPreset({
81
+ * solidOptions: {
82
+ * generate: "ssr",
83
+ * hydratable: true
84
+ * }
85
+ * })
86
+ * });
87
+ *
88
+ * // With custom Babel options
89
+ * export default defineConfig({
90
+ * preset: createSolidPreset({
91
+ * solidOptions: {
92
+ * moduleName: "solid-js/web"
93
+ * },
94
+ * babel: {
95
+ * // Additional babel options
96
+ * }
97
+ * })
98
+ * });
99
+ * ```
100
+ */
101
+ export declare const createSolidPreset: (options?: SolidPresetOptions) => BuildConfig;
@@ -0,0 +1,72 @@
1
+ const buildSolidPresetOptions = (solidOptions) => {
2
+ const presetOptions = {
3
+ contextToCustomElements: solidOptions?.contextToCustomElements ?? true,
4
+ delegateEvents: solidOptions?.delegateEvents ?? true,
5
+ generate: solidOptions?.generate ?? "dom",
6
+ hydratable: solidOptions?.hydratable ?? false,
7
+ moduleName: solidOptions?.moduleName ?? "solid-js/web",
8
+ wrapConditionals: solidOptions?.wrapConditionals ?? true
9
+ };
10
+ if (solidOptions?.builtIns !== void 0) {
11
+ presetOptions.builtIns = solidOptions.builtIns;
12
+ }
13
+ return presetOptions;
14
+ };
15
+ const mergeUserBabelOptions = (baseConfig, userBabelOptions, basePlugins, basePresets) => {
16
+ if (!userBabelOptions || typeof userBabelOptions === "function") {
17
+ return baseConfig;
18
+ }
19
+ let mergedPlugins = basePlugins;
20
+ if (userBabelOptions.plugins) {
21
+ const userPluginsArray = Array.isArray(userBabelOptions.plugins) ? userBabelOptions.plugins : [];
22
+ mergedPlugins = [...basePlugins || [], ...userPluginsArray];
23
+ }
24
+ let mergedPresets = basePresets;
25
+ if (userBabelOptions.presets) {
26
+ const userPresetsArray = Array.isArray(userBabelOptions.presets) ? userBabelOptions.presets : [];
27
+ mergedPresets = [...basePresets || [], ...userPresetsArray];
28
+ }
29
+ return {
30
+ ...baseConfig,
31
+ ...userBabelOptions,
32
+ plugins: mergedPlugins && mergedPlugins.length > 0 ? mergedPlugins : void 0,
33
+ presets: mergedPresets && mergedPresets.length > 0 ? mergedPresets : void 0
34
+ };
35
+ };
36
+ const createSolidPreset = (options = {}) => {
37
+ const { babel: userBabelOptions, plugins = [], presets = [], solidOptions = {} } = options;
38
+ const babelPlugins = [];
39
+ const babelPresets = [];
40
+ const solidPresetOptions = buildSolidPresetOptions(solidOptions);
41
+ const solidPreset = ["babel-preset-solid", solidPresetOptions];
42
+ babelPresets.push(solidPreset);
43
+ const finalPlugins = [...babelPlugins, ...Array.isArray(plugins) ? plugins : []];
44
+ const finalPresets = [...babelPresets, ...Array.isArray(presets) ? presets : []];
45
+ const babelConfig = {
46
+ ast: false,
47
+ babelrc: false,
48
+ configFile: false,
49
+ plugins: finalPlugins.length > 0 ? finalPlugins : void 0,
50
+ presets: finalPresets.length > 0 ? finalPresets : void 0,
51
+ sourceMaps: true
52
+ };
53
+ const mergedBabelConfig = mergeUserBabelOptions(babelConfig, userBabelOptions, finalPlugins, finalPresets);
54
+ return {
55
+ externals: ["solid-js", "solid-js/web", "solid-js/store"],
56
+ rollup: {
57
+ babel: mergedBabelConfig
58
+ },
59
+ validation: {
60
+ dependencies: {
61
+ hoisted: {
62
+ exclude: []
63
+ },
64
+ unused: {
65
+ exclude: ["solid-js"]
66
+ }
67
+ }
68
+ }
69
+ };
70
+ };
71
+
72
+ export { createSolidPreset };
@@ -0,0 +1,71 @@
1
+ import type { BuildConfig } from "../../types.d.ts";
2
+ export interface SveltePresetOptions {
3
+ /**
4
+ * Svelte plugin options
5
+ */
6
+ pluginOptions?: {
7
+ /**
8
+ * Svelte compiler options
9
+ */
10
+ compilerOptions?: {
11
+ /**
12
+ * Custom element mode
13
+ * @default false
14
+ */
15
+ customElement?: boolean;
16
+ /**
17
+ * Enable dev mode
18
+ * @default false
19
+ */
20
+ dev?: boolean;
21
+ /**
22
+ * Generate mode: "client" for client-side rendering, "server" for SSR
23
+ * @default "client"
24
+ */
25
+ generate?: "client" | "server" | false;
26
+ /**
27
+ * Enable hydratable output
28
+ * @default false
29
+ */
30
+ hydratable?: boolean;
31
+ [key: string]: unknown;
32
+ };
33
+ /**
34
+ * Exclude patterns for Svelte files
35
+ */
36
+ exclude?: RegExp | RegExp[];
37
+ /**
38
+ * Include patterns for Svelte files
39
+ * @default [/\.svelte$/]
40
+ */
41
+ include?: RegExp | RegExp[];
42
+ /**
43
+ * Preprocessor options
44
+ */
45
+ preprocess?: unknown;
46
+ };
47
+ }
48
+ /**
49
+ * Svelte preset for Packem. Configures Rollup with rollup-plugin-svelte.
50
+ * @description This preset configures the Svelte plugin to handle .svelte file compilation.
51
+ * @example
52
+ * ```typescript
53
+ * // Basic usage
54
+ * export default defineConfig({
55
+ * preset: "svelte"
56
+ * });
57
+ *
58
+ * // With custom options
59
+ * import { createSveltePreset } from "@visulima/packem/config/preset/svelte";
60
+ * export default defineConfig({
61
+ * preset: createSveltePreset({
62
+ * pluginOptions: {
63
+ * compilerOptions: {
64
+ * hydratable: true
65
+ * }
66
+ * }
67
+ * })
68
+ * });
69
+ * ```
70
+ */
71
+ export declare const createSveltePreset: (options?: SveltePresetOptions) => BuildConfig;
@@ -0,0 +1,44 @@
1
+ import svelte from 'rollup-plugin-svelte';
2
+ import { D as DEFAULT_EXTENSIONS } from '../../packem_shared/index-CTIRxV2x.js';
3
+
4
+ const createSveltePreset = (options = {}) => {
5
+ const { pluginOptions = {} } = options;
6
+ return {
7
+ rollup: {
8
+ plugins: [
9
+ {
10
+ enforce: "pre",
11
+ plugin: svelte({
12
+ compilerOptions: {
13
+ generate: "client",
14
+ runes: true,
15
+ ...pluginOptions.compilerOptions
16
+ },
17
+ emitCss: false,
18
+ extensions: [".svelte"],
19
+ exclude: pluginOptions.exclude,
20
+ include: pluginOptions.include ?? [/\.svelte$/],
21
+ preprocess: pluginOptions.preprocess
22
+ })
23
+ }
24
+ ],
25
+ resolve: {
26
+ browser: true,
27
+ exportConditions: ["svelte"],
28
+ extensions: [...DEFAULT_EXTENSIONS, ".svelte"]
29
+ }
30
+ },
31
+ validation: {
32
+ dependencies: {
33
+ hoisted: {
34
+ exclude: []
35
+ },
36
+ unused: {
37
+ exclude: ["svelte"]
38
+ }
39
+ }
40
+ }
41
+ };
42
+ };
43
+
44
+ export { createSveltePreset };
@@ -0,0 +1,53 @@
1
+ import type { BuildConfig } from "../../types.d.ts";
2
+ export interface VuePresetOptions {
3
+ /**
4
+ * Vue plugin options
5
+ */
6
+ pluginOptions?: {
7
+ /**
8
+ * Enable custom elements mode
9
+ * @default false
10
+ */
11
+ customElement?: boolean;
12
+ /**
13
+ * Exclude patterns for Vue files
14
+ */
15
+ exclude?: RegExp | RegExp[];
16
+ /**
17
+ * Include patterns for Vue files
18
+ * @default [/\.vue$/]
19
+ */
20
+ include?: RegExp | RegExp[];
21
+ /**
22
+ * Template compiler options
23
+ */
24
+ template?: {
25
+ compilerOptions?: {
26
+ [key: string]: unknown;
27
+ isCustomElement?: (tag: string) => boolean;
28
+ };
29
+ };
30
+ };
31
+ }
32
+ /**
33
+ * Vue preset for Packem. Configures Rollup with unplugin-vue.
34
+ * @description This preset configures the Vue plugin to handle .vue file compilation.
35
+ * @example
36
+ * ```typescript
37
+ * // Basic usage
38
+ * export default defineConfig({
39
+ * preset: "vue"
40
+ * });
41
+ *
42
+ * // With custom options
43
+ * import { createVuePreset } from "@visulima/packem/config/preset/vue";
44
+ * export default defineConfig({
45
+ * preset: createVuePreset({
46
+ * pluginOptions: {
47
+ * customElement: true
48
+ * }
49
+ * })
50
+ * });
51
+ * ```
52
+ */
53
+ export declare const createVuePreset: (options?: VuePresetOptions) => BuildConfig;
@@ -0,0 +1,33 @@
1
+ import Vue from 'unplugin-vue/rollup';
2
+
3
+ const createVuePreset = (options = {}) => {
4
+ const { pluginOptions = {} } = options;
5
+ return {
6
+ rollup: {
7
+ plugins: [
8
+ {
9
+ enforce: "pre",
10
+ plugin: Vue({
11
+ customElement: pluginOptions.customElement ?? false,
12
+ exclude: pluginOptions.exclude,
13
+ include: pluginOptions.include ?? [/\.vue$/],
14
+ template: pluginOptions.template,
15
+ exportMode: "default"
16
+ })
17
+ }
18
+ ]
19
+ },
20
+ validation: {
21
+ dependencies: {
22
+ hoisted: {
23
+ exclude: []
24
+ },
25
+ unused: {
26
+ exclude: ["vue"]
27
+ }
28
+ }
29
+ }
30
+ };
31
+ };
32
+
33
+ export { createVuePreset };
package/dist/index.js CHANGED
@@ -1 +1,30 @@
1
- var c=Object.defineProperty;var o=(e,r)=>c(e,"name",{value:r,configurable:!0});import{createPail as s}from"@visulima/pail";import{SimpleReporter as u}from"@visulima/pail/reporter";import{x as g}from"./packem_shared/index-DFigeRU2.js";var f=Object.defineProperty,l=o((e,r)=>f(e,"name",{value:r,configurable:!0}),"r");const C=l(async(e,r={})=>{const{debug:t,environment:i,logger:a,mode:n,tsconfigPath:m,...d}={debug:!1,environment:"production",logger:{},mode:"build",tsconfigPath:void 0,...r},p=s({reporters:[new u({error:{hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0}})],scope:"packem",...a});await g(e,n,i,p,t,d,m)},"packem");export{C as packem};
1
+ import { createPail } from '@visulima/pail';
2
+ import { SimpleReporter } from '@visulima/pail/reporter';
3
+ import { p as packem$1 } from './packem_shared/index-DzTDn4ad.js';
4
+
5
+ const packem = async (rootDirectory, options = {}) => {
6
+ const { debug, environment, logger, mode, tsconfigPath, ...inputConfig } = {
7
+ debug: false,
8
+ environment: "production",
9
+ logger: {},
10
+ mode: "build",
11
+ tsconfigPath: void 0,
12
+ ...options
13
+ };
14
+ const pail = createPail({
15
+ reporters: [
16
+ new SimpleReporter({
17
+ error: {
18
+ hideErrorCauseCodeView: true,
19
+ hideErrorCodeView: true,
20
+ hideErrorErrorsCodeView: true
21
+ }
22
+ })
23
+ ],
24
+ scope: "packem",
25
+ ...logger
26
+ });
27
+ await packem$1(rootDirectory, mode, environment, pail, debug, inputConfig, tsconfigPath);
28
+ };
29
+
30
+ export { packem };
@@ -0,0 +1,36 @@
1
+ import { writeJsonSync, isAccessibleSync, readJsonSync } from '@visulima/fs';
2
+ import { join } from '@visulima/path';
3
+
4
+ const replaceContentWithinMarker = (content, marker, replacement) => {
5
+ const regex = new RegExp(`(<!-- ${marker} -->)[\\s\\S]*?(<!-- /${marker} -->)`, "g");
6
+ if (!regex.test(content)) {
7
+ return void 0;
8
+ }
9
+ return content.replace(regex, `$1
10
+ ${replacement}
11
+ $2`);
12
+ };
13
+
14
+ const createOrUpdateKeyStorage = (hashKey, storePath, logger, shouldUpdate) => {
15
+ try {
16
+ let keyStore = {};
17
+ const keyStorePath = join(storePath, "keystore.json");
18
+ if (shouldUpdate && isAccessibleSync(keyStorePath)) {
19
+ keyStore = readJsonSync(keyStorePath);
20
+ }
21
+ if (keyStore[hashKey] === void 0) {
22
+ keyStore[hashKey] = (/* @__PURE__ */ new Date()).toISOString();
23
+ }
24
+ writeJsonSync(keyStorePath, keyStore, {
25
+ overwrite: true
26
+ });
27
+ } catch (error) {
28
+ logger.debug({
29
+ context: [error],
30
+ message: error.message,
31
+ prefix: "cache-key-store"
32
+ });
33
+ }
34
+ };
35
+
36
+ export { createOrUpdateKeyStorage as c, replaceContentWithinMarker as r };
@@ -0,0 +1,12 @@
1
+ import { isolatedDeclaration } from 'oxc-transform';
2
+
3
+ const isolatedDeclarationsOxcTransformer = (id, code, sourceMap, transformOptions) => {
4
+ const result = isolatedDeclaration(id, code, { ...transformOptions, sourcemap: sourceMap });
5
+ return {
6
+ errors: result.errors.map((error) => error.message),
7
+ map: result.map?.mappings,
8
+ sourceText: result.code
9
+ };
10
+ };
11
+
12
+ export { isolatedDeclarationsOxcTransformer as default };