@visulima/packem 2.0.0-alpha.43 → 2.0.0-alpha.44
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/CHANGELOG.md +6 -0
- package/LICENSE.md +156 -102
- package/dist/builder/typedoc/generate-reference-documentation.d.ts +4 -0
- package/dist/builder/typedoc/index.js +3 -160
- package/dist/cli/commands/add.d.ts +4 -0
- package/dist/cli/commands/build.d.ts +21 -0
- package/dist/cli/commands/init.d.ts +3 -0
- package/dist/cli/commands/migrate.d.ts +21 -0
- package/dist/cli/commands/utils/css-loader-dependencies.d.ts +2 -0
- package/dist/cli/index.js +52 -1377
- package/dist/config/index.js +1 -4
- package/dist/config/preset/auto.d.ts +3 -0
- package/dist/config/preset/react.js +1 -43
- package/dist/config/preset/solid.js +1 -72
- package/dist/config/preset/svelte.d.ts +1 -1
- package/dist/config/preset/svelte.js +1 -44
- package/dist/config/preset/utils/infer-entries.d.ts +12 -0
- package/dist/config/preset/utils/overwrite-with-publish-config.d.ts +4 -0
- package/dist/config/preset/vue.js +1 -33
- package/dist/config/utils/find-packem-file.d.ts +2 -0
- package/dist/config/utils/load-package-json.d.ts +6 -0
- package/dist/config/utils/load-packem-config.d.ts +7 -0
- package/dist/config/utils/load-preset.d.ts +4 -0
- package/dist/config/utils/load-tsconfig.d.ts +5 -0
- package/dist/config/utils/prepare-entries.d.ts +4 -0
- package/dist/index.js +1 -30
- package/dist/jit/create-stub.d.ts +4 -0
- package/dist/packem/build.d.ts +21 -0
- package/dist/packem/index.d.ts +25 -0
- package/dist/packem/utils/brotli-size.d.ts +2 -0
- package/dist/packem/utils/group-by-keys.d.ts +3 -0
- package/dist/packem/utils/gzip-size.d.ts +2 -0
- package/dist/packem_shared/browserslistToEsbuild-C0IWmbNe-C6xPL1oW.js +1 -0
- package/dist/packem_shared/create-or-update-key-storage-C0tWtgSr.js +3 -0
- package/dist/packem_shared/default-5XUc-qHw.js +1 -0
- package/dist/packem_shared/default-B2EOH52z.js +1 -0
- package/dist/packem_shared/default-BYM_JvQL.js +1 -0
- package/dist/packem_shared/default-B_dUKZ_J.js +1 -0
- package/dist/packem_shared/default-DsjSAv7m.js +1 -0
- package/dist/packem_shared/esbuildPlugin-pPPsJB9N-YI_X-5wr.js +3 -0
- package/dist/packem_shared/index-CUp9WuCG.js +1 -0
- package/dist/packem_shared/index-ChtiNkgT.js +174 -0
- package/dist/packem_shared/isolatedDeclarationsOxcTransformer-WbfE6cGu-NeZOx2Y7.js +1 -0
- package/dist/packem_shared/isolatedDeclarationsSwcTransformer-Ch2AgtWC-B-0lOgFf.js +1 -0
- package/dist/packem_shared/isolatedDeclarationsTypescriptTransformer-DkuEkofo-Cwe3ODMG.js +3 -0
- package/dist/packem_shared/oxcResolvePlugin-Ccef6pyL-D14z9S9i.js +1 -0
- package/dist/packem_shared/oxcTransformPlugin-DfVQouIB-Cpfv95eA.js +4 -0
- package/dist/packem_shared/resolveTypescriptMjsCtsPlugin-DcZrZTmM-CauidYR5.js +6 -0
- package/dist/packem_shared/swcPlugin-Boip4lWG-CwJ-HVJc.js +1 -0
- package/dist/rollup/build-types.d.ts +5 -0
- package/dist/rollup/build.d.ts +5 -0
- package/dist/rollup/get-rollup-options.d.ts +5 -0
- package/dist/rollup/plugins/css/loaders/less.js +1 -1
- package/dist/rollup/plugins/css/loaders/lightningcss.js +1 -1
- package/dist/rollup/plugins/css/loaders/postcss.js +1 -1
- package/dist/rollup/plugins/css/loaders/sass.js +1 -1
- package/dist/rollup/plugins/css/loaders/sourcemap.js +1 -1
- package/dist/rollup/plugins/css/loaders/stylus.js +1 -1
- package/dist/rollup/plugins/css/loaders/tailwindcss.js +1 -1
- package/dist/rollup/plugins/css/minifiers/cssnano.js +1 -1
- package/dist/rollup/plugins/css/minifiers/lightningcss.js +1 -1
- package/dist/rollup/plugins/esbuild/index.js +1 -1
- package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.js +1 -1
- package/dist/rollup/plugins/oxc/oxc-transformer.js +1 -1
- package/dist/rollup/plugins/sucrase/index.js +1 -1
- package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.js +1 -1
- package/dist/rollup/plugins/swc/swc-plugin.js +1 -1
- package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.js +1 -1
- package/dist/rollup/utils/resolve-aliases.d.ts +4 -0
- package/dist/rollup/watch.d.ts +5 -0
- package/dist/utils/clean-distribution-directories.d.ts +4 -0
- package/dist/utils/create-or-update-key-storage.d.ts +3 -0
- package/dist/utils/extract-export-filenames.d.ts +16 -0
- package/dist/utils/find-alternatives.d.ts +2 -0
- package/dist/utils/get-package-side-effect.d.ts +3 -0
- package/dist/utils/infer-export-type.d.ts +3 -0
- package/dist/utils/kill-process.d.ts +14 -0
- package/dist/utils/log-build-errors.d.ts +4 -0
- package/dist/utils/remove-old-cache-folders.d.ts +3 -0
- package/dist/utils/warn-legacy-cjs.d.ts +8 -0
- package/dist/validator/attw.d.ts +7 -0
- package/dist/validator/package-json/index.d.ts +4 -0
- package/dist/validator/package-json/validate-dependencies.d.ts +4 -0
- package/dist/validator/package-json/validate-engines.d.ts +4 -0
- package/dist/validator/package-json/validate-package-entries.d.ts +4 -0
- package/dist/validator/package-json/validate-package-fields.d.ts +4 -0
- package/dist/validator/validate-alias-entries.d.ts +3 -0
- package/dist/validator/validate-bundle-size.d.ts +4 -0
- package/package.json +1 -111
- package/dist/packem_shared/create-or-update-key-storage-Dd7b8-t1.js +0 -36
- package/dist/packem_shared/default-79SPobLI.js +0 -12
- package/dist/packem_shared/default-DWBYeUSC.js +0 -210
- package/dist/packem_shared/default-DaU6CQEi.js +0 -28
- package/dist/packem_shared/default-DavaZMwC.js +0 -32
- package/dist/packem_shared/default-DeYZ934H.js +0 -32
- package/dist/packem_shared/default-tUOOZ8w7.js +0 -42
- package/dist/packem_shared/default-wScAfTaq.js +0 -27
- package/dist/packem_shared/index-CTIRxV2x.js +0 -63
- package/dist/packem_shared/index-DzTDn4ad.js +0 -9521
package/dist/config/index.js
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const definePreset = (preset) => preset;
|
|
3
|
-
|
|
4
|
-
export { defineConfig, definePreset };
|
|
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,43 +1 @@
|
|
|
1
|
-
const
|
|
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 };
|
|
1
|
+
var p=Object.defineProperty;var n=(r,e)=>p(r,"name",{value:e,configurable:!0});var u=Object.defineProperty,d=n((r,e)=>u(r,"name",{value:e,configurable:!0}),"p");const h=d((r={})=>{const{compiler:e=!1,plugins:t=[],presets:a=[]}=r,c=[],o=[];if(e){const l=typeof e=="object"?e:{};c.push(["babel-plugin-react-compiler",{compilationMode:l.compilationMode??"infer",panicThreshold:l.panicThreshold??"critical_errors"}])}o.push(["@babel/preset-react",{runtime:"automatic"}]);const i=[...c,...Array.isArray(t)?t:[]],s=[...o,...Array.isArray(a)?a:[]];return{rollup:{babel:{plugins:i.length>0?i:void 0,presets:s.length>0?s:void 0}},validation:{dependencies:{hoisted:{exclude:[]},unused:{exclude:["react","react-dom"]}}}}},"createReactPreset");export{h as createReactPreset};
|
|
@@ -1,72 +1 @@
|
|
|
1
|
-
const buildSolidPresetOptions = (
|
|
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 };
|
|
1
|
+
var g=Object.defineProperty;var u=(s,e)=>g(s,"name",{value:e,configurable:!0});var f=Object.defineProperty,d=u((s,e)=>f(s,"name",{value:e,configurable:!0}),"o");const y=d(s=>{const e={contextToCustomElements:s?.contextToCustomElements??!0,delegateEvents:s?.delegateEvents??!0,generate:s?.generate??"dom",hydratable:s?.hydratable??!1,moduleName:s?.moduleName??"solid-js/web",wrapConditionals:s?.wrapConditionals??!0};return s?.builtIns!==void 0&&(e.builtIns=s.builtIns),e},"buildSolidPresetOptions"),m=d((s,e,o,i)=>{if(!e||typeof e=="function")return s;let t=o;if(e.plugins){const l=Array.isArray(e.plugins)?e.plugins:[];t=[...o||[],...l]}let r=i;if(e.presets){const l=Array.isArray(e.presets)?e.presets:[];r=[...i||[],...l]}return{...s,...e,plugins:t&&t.length>0?t:void 0,presets:r&&r.length>0?r:void 0}},"mergeUserBabelOptions"),h=d((s={})=>{const{babel:e,plugins:o=[],presets:i=[],solidOptions:t={}}=s,r=[],l=[],p=["babel-preset-solid",y(t)];l.push(p);const a=[...r,...Array.isArray(o)?o:[]],n=[...l,...Array.isArray(i)?i:[]],c={ast:!1,babelrc:!1,configFile:!1,plugins:a.length>0?a:void 0,presets:n.length>0?n:void 0,sourceMaps:!0},b=m(c,e,a,n);return{externals:["solid-js","solid-js/web","solid-js/store"],rollup:{babel:b},validation:{dependencies:{hoisted:{exclude:[]},unused:{exclude:["solid-js"]}}}}},"createSolidPreset");export{h as createSolidPreset};
|
|
@@ -8,6 +8,7 @@ export interface SveltePresetOptions {
|
|
|
8
8
|
* Svelte compiler options
|
|
9
9
|
*/
|
|
10
10
|
compilerOptions?: {
|
|
11
|
+
[key: string]: unknown;
|
|
11
12
|
/**
|
|
12
13
|
* Custom element mode
|
|
13
14
|
* @default false
|
|
@@ -28,7 +29,6 @@ export interface SveltePresetOptions {
|
|
|
28
29
|
* @default false
|
|
29
30
|
*/
|
|
30
31
|
hydratable?: boolean;
|
|
31
|
-
[key: string]: unknown;
|
|
32
32
|
};
|
|
33
33
|
/**
|
|
34
34
|
* Exclude patterns for Svelte files
|
|
@@ -1,44 +1 @@
|
|
|
1
|
-
import
|
|
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 };
|
|
1
|
+
var s=Object.defineProperty;var t=(r,e)=>s(r,"name",{value:e,configurable:!0});import{_ as n}from"../../packem_shared/index-CUp9WuCG.js";import o from"rollup-plugin-svelte";var l=Object.defineProperty,i=t((r,e)=>l(r,"name",{value:e,configurable:!0}),"n");const d=i((r={})=>{const{pluginOptions:e={}}=r;return{rollup:{plugins:[{enforce:"pre",plugin:o({compilerOptions:{generate:"client",runes:!0,...e.compilerOptions},emitCss:!1,exclude:e.exclude,extensions:[".svelte"],include:e.include??[/\.svelte$/],preprocess:e.preprocess})}],resolve:{browser:!0,exportConditions:["svelte"],extensions:[...n,".svelte"]}},validation:{dependencies:{hoisted:{exclude:[]},unused:{exclude:["svelte"]}}}}},"createSveltePreset");export{d as createSveltePreset};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PackageJson } from "@visulima/package";
|
|
2
|
+
import type { BuildContext } from "@visulima/packem-share/types";
|
|
3
|
+
import type { InferEntriesResult, InternalBuildOptions } from "../../../types.d.ts";
|
|
4
|
+
/**
|
|
5
|
+
* Infer entries from package files.
|
|
6
|
+
* @param packageJson
|
|
7
|
+
* @param sourceFiles A list of source files to use for inferring entries.
|
|
8
|
+
* @param context
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
declare const inferEntries: (packageJson: PackageJson, sourceFiles: string[], context: BuildContext<InternalBuildOptions>) => Promise<InferEntriesResult>;
|
|
12
|
+
export default inferEntries;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NormalizedPackageJson } from "@visulima/package";
|
|
2
|
+
import type { BuildConfig } from "../../../types.d.ts";
|
|
3
|
+
declare const overwriteWithPublishConfig: (packageJson: NormalizedPackageJson, declaration?: BuildConfig["declaration"]) => NormalizedPackageJson;
|
|
4
|
+
export default overwriteWithPublishConfig;
|
|
@@ -1,33 +1 @@
|
|
|
1
|
-
import
|
|
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 };
|
|
1
|
+
var l=Object.defineProperty;var u=(t,e)=>l(t,"name",{value:e,configurable:!0});import n from"unplugin-vue/rollup";var r=Object.defineProperty,o=u((t,e)=>r(t,"name",{value:e,configurable:!0}),"n");const a=o((t={})=>{const{pluginOptions:e={}}=t;return{rollup:{plugins:[{enforce:"pre",plugin:n({customElement:e.customElement??!1,exclude:e.exclude,exportMode:"default",include:e.include??[/\.vue$/],template:e.template})}]},validation:{dependencies:{hoisted:{exclude:[]},unused:{exclude:["vue"]}}}}},"createVuePreset");export{a as createVuePreset};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Jiti } from "jiti";
|
|
2
|
+
import type { BuildConfig, Environment, Mode } from "../../types.d.ts";
|
|
3
|
+
declare const loadPackemConfig: (jiti: Jiti, rootDirectory: string, environment: Environment, mode: Mode, configPath?: string) => Promise<{
|
|
4
|
+
config: BuildConfig;
|
|
5
|
+
path: string;
|
|
6
|
+
}>;
|
|
7
|
+
export default loadPackemConfig;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { NormalizedPackageJson } from "@visulima/package";
|
|
2
|
+
import type { Pail } from "@visulima/pail";
|
|
3
|
+
import type { TsConfigResult } from "@visulima/tsconfig";
|
|
4
|
+
declare const loadTsconfig: (rootDirectory: string, packageJson: NormalizedPackageJson, logger: Pail, tsconfigPath?: string) => Promise<TsConfigResult | undefined>;
|
|
5
|
+
export default loadTsconfig;
|
package/dist/index.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
import {
|
|
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 };
|
|
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{j as g}from"./packem_shared/index-ChtiNkgT.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};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { FileCache } from "@visulima/packem-share";
|
|
2
|
+
import type { BuildContext } from "@visulima/packem-share/types";
|
|
3
|
+
import type { InternalBuildOptions } from "../types.d.ts";
|
|
4
|
+
/**
|
|
5
|
+
* Main build function that orchestrates the entire build process.
|
|
6
|
+
* Handles both JavaScript/TypeScript compilation and type definition generation.
|
|
7
|
+
* @param context Build context containing configuration and state
|
|
8
|
+
* @param fileCache Cache instance for file operations
|
|
9
|
+
* @returns Promise resolving to a boolean indicating build success
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const success = await build(BuildContext<InternalBuildOptions>, new FileCache());
|
|
13
|
+
* if (success) {
|
|
14
|
+
* console.log('Build completed successfully');
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
* @throws {Error} If the build process encounters critical errors
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
declare const build: (context: BuildContext<InternalBuildOptions>, fileCache: FileCache) => Promise<boolean>;
|
|
21
|
+
export default build;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Pail } from "@visulima/pail";
|
|
2
|
+
import type { BuildConfig, Environment, Mode } from '../types.d.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Main entry point for the Packem bundler.
|
|
5
|
+
* Handles the complete build process including configuration loading, validation,
|
|
6
|
+
* and execution of the build/watch process.
|
|
7
|
+
* @param rootDirectory Root directory of the project
|
|
8
|
+
* @param mode Build mode (build/watch)
|
|
9
|
+
* @param environment Build environment (development/production)
|
|
10
|
+
* @param logger Logger instance for output
|
|
11
|
+
* @param inputConfig User provided build configuration and options
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import packem from 'packem';
|
|
15
|
+
*
|
|
16
|
+
* await packem('/path/to/project', 'build', 'production', logger, {
|
|
17
|
+
* debug: true,
|
|
18
|
+
* configPath: './packem.config.js'
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
* @throws {Error} If configuration validation fails or build process encounters errors
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
declare const packem: (rootDirectory: string, mode: Mode, environment: Environment, logger: Pail, debug: boolean, config: BuildConfig, tsconfigPath?: string) => Promise<void>;
|
|
25
|
+
export default packem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i=Object.defineProperty;var s=(a,t)=>i(a,"name",{value:t,configurable:!0});var o=Object.defineProperty,n=s((a,t)=>o(a,"name",{value:t,configurable:!0}),"r"),l=Object.defineProperty,d=n((a,t)=>l(a,"name",{value:t,configurable:!0}),"a"),f=Object.defineProperty,c=d((a,t)=>f(a,"name",{value:t,configurable:!0}),"r");const m=new Set(["chrome","edge","es","firefox","ie","ios","node","opera","safari"]),p=["android 4"],u={android:"chrome",ios_saf:"ios"},b=" ",O=c(a=>{let t=a.filter(e=>!p.some(r=>e.startsWith(r))).map(e=>e.split(b)).map(([e,r])=>[u[e]||e,r]).map(([e,r])=>[e,r.includes("-")?r.slice(0,r.indexOf("-")):r]).map(([e,r])=>[e,r.endsWith(".0")?r.slice(0,-2):r]).filter(([,e])=>/^\d+(?:\.\d+)*$/.test(e)).filter(([e])=>m.has(e));return t=Object.entries(Object.fromEntries(t)),t.map(([e,r])=>`${e}${r}`)},"browserslistToEsbuild");export{O as b};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var i=Object.defineProperty;var c=(e,r)=>i(e,"name",{value:r,configurable:!0});import{isAccessibleSync as s,readJsonSync as u,writeJsonSync as f}from"@visulima/fs";import{join as g}from"@visulima/path";var l=Object.defineProperty,p=c((e,r)=>l(e,"name",{value:r,configurable:!0}),"a$1"),v=Object.defineProperty,y=p((e,r)=>v(e,"name",{value:r,configurable:!0}),"a"),b=Object.defineProperty,m=y((e,r)=>b(e,"name",{value:r,configurable:!0}),"t");const w=m((e,r,n)=>{const a=new RegExp(String.raw`(<!-- ${r} -->)[\s\S]*?(<!-- /${r} -->)`,"g");if(a.test(e))return e.replace(a,`$1
|
|
2
|
+
${n}
|
|
3
|
+
$2`)},"replaceContentWithinMarker");var d=Object.defineProperty,S=c((e,r)=>d(e,"name",{value:r,configurable:!0}),"i");const x=S((e,r,n,a)=>{try{let t={};const o=g(r,"keystore.json");a&&s(o)&&(t=u(o)),t[e]===void 0&&(t[e]=new Date().toISOString()),f(o,t,{overwrite:!0})}catch(t){n.debug({context:[t],message:t.message,prefix:"cache-key-store"})}},"createOrUpdateKeyStorage");export{x as d,w as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{v as r}from"./isolatedDeclarationsTypescriptTransformer-DkuEkofo-Cwe3ODMG.js";import{P as o,P as p,N as t,D as a,i as c}from"./resolveTypescriptMjsCtsPlugin-DcZrZTmM-CauidYR5.js";export{r as isolatedDeclarationsTypescriptTransformer,o as patchTypescriptTypes,p as patchTypescriptTypesPlugin,t as resolveTsconfigPathsPlugin,a as resolveTsconfigRootDirectoriesPlugin,c as resolveTypescriptMjsCtsPlugin};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as a}from"./isolatedDeclarationsOxcTransformer-WbfE6cGu-NeZOx2Y7.js";import{z as s}from"./oxcResolvePlugin-Ccef6pyL-D14z9S9i.js";import{n as x}from"./oxcTransformPlugin-DfVQouIB-Cpfv95eA.js";export{a as isolatedDeclarationsOxcTransformer,s as oxcResolvePlugin,x as oxcTransformPlugin};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as a}from"./isolatedDeclarationsSwcTransformer-Ch2AgtWC-B-0lOgFf.js";import{t as e}from"./swcPlugin-Boip4lWG-CwJ-HVJc.js";export{a as isolatedDeclarationsSwcTransformer,e as swcPlugin};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var m=Object.defineProperty;var n=(e,r)=>m(e,"name",{value:r,configurable:!0});import{createFilter as f}from"@rollup/pluginutils";import{f as l}from"./index-CUp9WuCG.js";import{transform as p}from"sucrase";var d=Object.defineProperty,v=n((e,r)=>d(e,"name",{value:r,configurable:!0}),"n"),b=Object.defineProperty,P=v((e,r)=>b(e,"name",{value:r,configurable:!0}),"a"),g=Object.defineProperty,y=P((e,r)=>g(e,"name",{value:r,configurable:!0}),"n");const o=y(({exclude:e,include:r,...t})=>{const c=f(r,e??l);return{name:"packem:sucrase",async transform(u,a){if(!c(a))return;const{code:s,sourceMap:i}=p(u,{...t,filePath:a,sourceMapOptions:{compiledFilename:a}});return{code:s,map:i}}}},"sucraseTransformPlugin");o.NAME="sucrase";const F=o;export{F as sucrasePlugin};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as r}from"./browserslistToEsbuild-C0IWmbNe-C6xPL1oW.js";import{z as e}from"./esbuildPlugin-pPPsJB9N-YI_X-5wr.js";export{r as browserslistToEsbuild,e as esbuildPlugin};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var x=Object.defineProperty;var v=(e,r)=>x(e,"name",{value:r,configurable:!0});import{createFilter as O}from"@rollup/pluginutils";import{a as k}from"./index-CUp9WuCG.js";import{extname as M,join as P}from"@visulima/path";import{transform as y,formatMessages as $,build as E}from"esbuild";import{findCacheDirSync as S}from"@visulima/find-cache-dir";import{readFileSync as A}from"@visulima/fs";import*as W from"rs-module-lexer";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
2
|
+
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
3
|
+
var C=Object.defineProperty,F=v((e,r)=>C(e,"name",{value:r,configurable:!0}),"h"),I=Object.defineProperty,f=F((e,r)=>I(e,"name",{value:r,configurable:!0}),"u"),R=Object.defineProperty,q=f((e,r)=>R(e,"name",{value:r,configurable:!0}),"n$1");const w=q(async(e,r)=>{r.length>0&&(await $(r,{color:!0,kind:"warning"})).forEach(s=>e.warn(s))},"warn");var L=Object.defineProperty,D=f((e,r)=>L(e,"name",{value:r,configurable:!0}),"t");const N=D(e=>{if(e==="es")return"esm";if(e==="cjs")return e},"getEsbuildFormat"),T=D(({sourceMap:e=!0,...r})=>async function(s,n,i){if(r.minify||r.minifyWhitespace||r.minifyIdentifiers||r.minifySyntax){const t=N(i.format),c=await y(s,{format:t,loader:"js",sourcemap:e,...r});if(await w(this,c.warnings),c.code)return{code:c.code,map:c.map||void 0}}},"getRenderChunk");var B=Object.defineProperty,j=f((e,r)=>B(e,"name",{value:r,configurable:!0}),"n");const h=j(e=>e.replaceAll("\\","/"),"slash"),{parseAsync:G}=W,H=j(async e=>{const r=S("@visulima/packem/optimize-deps",{create:!0,cwd:e.cwd});if(!r)throw new Error('[packem:optimize-deps]: failed to find or create cache directory "node_modules/.cache/packem/optimize_deps".');await E({absWorkingDir:e.cwd,bundle:!0,entryPoints:e.include,format:"esm",ignoreAnnotations:!0,metafile:!0,outdir:r,sourcemap:e.sourceMap,splitting:!0,...e.esbuildOptions,plugins:[{name:"optimize-deps",async setup(n){n.onResolve({filter:/.*/},async i=>{if(e.exclude?.includes(i.path))return{external:!0};if(!i.pluginData?.__resolving_dep_path__&&e.include.includes(i.path)){const t=await n.resolve(i.path,{kind:"import-statement",pluginData:{__resolving_dep_path__:!0},resolveDir:i.resolveDir});return t.errors.length>0||t.warnings.length>0?t:{namespace:"optimize-deps",path:i.path,pluginData:{absolute:t.path,resolveDir:i.resolveDir}}}}),n.onLoad({filter:/.*/,namespace:"optimize-deps"},async i=>{const{absolute:t,resolveDir:c}=i.pluginData,p=A(t),{output:g}=await G({input:[{code:p,filename:t}]});return{contents:(g[0]?.exports??[]).length>0?`export * from '${h(t)}'`:`module.exports = require('${h(t)}')`,resolveDir:c}})}},...e.esbuildOptions?.plugins??[]]});const s=new Map;for(const n of e.include)s.set(n,{file:P(r,`${n}.js`)});return{cacheDir:r,optimized:s}},"optimizeDeps");var U=Object.defineProperty,J=f((e,r)=>U(e,"name",{value:r,configurable:!0}),"g");const K=J(({exclude:e,include:r,loaders:s,logger:n,optimizeDeps:i,sourceMap:t,...c})=>{const p=k;if(s!==void 0)for(let[o,a]of Object.entries(s)){const l=o.startsWith(".")?o:`.${o}`;typeof a=="string"?p[l]=a:a||delete p[l]}const g=Object.keys(p),z=new RegExp(String.raw`\.(${g.map(o=>o.slice(1)).join("|")})$`),_=O(r??z,e);let u,b=process.cwd();return{async buildStart(){!i||u||(u=await H({cwd:b,sourceMap:t??!1,...i}),n.debug("optimized %O",u.optimized))},name:"packem:esbuild",options({context:o}){o&&(b=o)},renderChunk:T({...c,sourceMap:t}),async resolveId(o){if(u?.optimized.has(o)){const a=u.optimized.get(o);if(a)return n.debug("resolved %s to %s",o,a.file),a.file}},async transform(o,a){if(!_(a)||u?.optimized.has(a))return;const l=M(a),d=p[l];if(n.debug("transforming %s with %s loader",a,d),!d)return;const m=await y(o,{format:["base64","binary","dataurl","text","json"].includes(d)?"esm":void 0,loader:d,sourcefile:a.replace(/\.[cm]ts/,".ts"),sourcemap:t,...c});if(await w(this,m.warnings),m.code)return{code:m.code,map:m.map||void 0}}}},"esbuildTransformer");K.NAME="esbuild";export{K as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const s=[".js",".mjs",".cjs",".ts",".mts",".cts",".d.ts",".d.mts",".d.cts",".jsx",".tsx",".json",".node"],c=[...s,".ctsx",".mtsx"],l={".aac":"file",".cjs":"js",".cts":"ts",".ctsx":"tsx",".eot":"file",".flac":"file",".js":"js",".jsx":"jsx",".mjs":"js",".mp3":"file",".mp4":"file",".mts":"ts",".mtsx":"tsx",".ogg":"file",".otf":"file",".ts":"ts",".tsx":"tsx",".ttf":"file",".wav":"file",".webm":"file",".woff":"file",".woff2":"file"},t="production",e="development",f=new Set(["edge-light","react-native","react-server"]),m=new Set([e,t,...f]),i=/node_modules/,x=/(?:\.d\.[mc]?tsx?|\.\w+)$/,j="packem_chunks",o="packem_shared",a=/\.(?:m|c)?(?:j|t)sx?$/;export{e as E,m as N,j as O,c as _,l as a,x as c,f as e,i as f,o as l,a as m,s,t};
|