@bemedev/dev-utils 1.4.0 → 1.5.1
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/README.md +89 -20
- package/lib/_virtual/_rolldown/runtime.cjs +1 -2
- package/lib/build-tests/addTarball.cjs +8 -3
- package/lib/build-tests/addTarball.cjs.map +1 -1
- package/lib/build-tests/addTarball.d.ts +7 -1
- package/lib/build-tests/addTarball.js +8 -3
- package/lib/build-tests/addTarball.js.map +1 -1
- package/lib/build-tests/buildPackageJson.cjs +9 -4
- package/lib/build-tests/buildPackageJson.cjs.map +1 -1
- package/lib/build-tests/buildPackageJson.d.ts +14 -2
- package/lib/build-tests/buildPackageJson.js +9 -4
- package/lib/build-tests/buildPackageJson.js.map +1 -1
- package/lib/build-tests/cleanup.cjs +5 -3
- package/lib/build-tests/cleanup.cjs.map +1 -1
- package/lib/build-tests/cleanup.d.ts +4 -1
- package/lib/build-tests/cleanup.js +5 -3
- package/lib/build-tests/cleanup.js.map +1 -1
- package/lib/build-tests/cli/cli.cjs +6 -4
- package/lib/build-tests/cli/cli.cjs.map +1 -1
- package/lib/build-tests/cli/cli.d.ts +3 -0
- package/lib/build-tests/cli/cli.js +6 -4
- package/lib/build-tests/cli/cli.js.map +1 -1
- package/lib/build-tests/cli/index.cjs +1 -2
- package/lib/build-tests/cli/index.cjs.map +1 -1
- package/lib/build-tests/cli/index.js +1 -2
- package/lib/build-tests/cli/post.cjs +5 -3
- package/lib/build-tests/cli/post.cjs.map +1 -1
- package/lib/build-tests/cli/post.d.ts +4 -1
- package/lib/build-tests/cli/post.js +5 -3
- package/lib/build-tests/cli/post.js.map +1 -1
- package/lib/build-tests/cli/pre.cjs +5 -3
- package/lib/build-tests/cli/pre.cjs.map +1 -1
- package/lib/build-tests/cli/pre.d.ts +4 -1
- package/lib/build-tests/cli/pre.js +5 -3
- package/lib/build-tests/cli/pre.js.map +1 -1
- package/lib/build-tests/cli/test.cjs +4 -2
- package/lib/build-tests/cli/test.cjs.map +1 -1
- package/lib/build-tests/cli/test.d.ts +3 -0
- package/lib/build-tests/cli/test.js +4 -2
- package/lib/build-tests/cli/test.js.map +1 -1
- package/lib/build-tests/constants.cjs +1 -2
- package/lib/build-tests/constants.js +1 -2
- package/lib/build-tests/getRelativePath.cjs +1 -2
- package/lib/build-tests/getRelativePath.d.ts +1 -1
- package/lib/build-tests/getRelativePath.js +1 -2
- package/lib/build-tests/getTypescriptOutdir.cjs +1 -2
- package/lib/build-tests/getTypescriptOutdir.d.ts +1 -1
- package/lib/build-tests/getTypescriptOutdir.js +1 -2
- package/lib/build-tests/import.cjs +1 -2
- package/lib/build-tests/import.js +1 -2
- package/lib/build-tests/imports/create.cjs +1 -2
- package/lib/build-tests/imports/create.js +1 -2
- package/lib/build-tests/imports/helper.cjs +1 -2
- package/lib/build-tests/imports/helper.js +1 -2
- package/lib/build-tests/imports/index.js +1 -2
- package/lib/build-tests/index.cjs +1 -1
- package/lib/build-tests/index.js +1 -1
- package/lib/build-tests/pack.cjs +2 -3
- package/lib/build-tests/pack.d.ts +1 -1
- package/lib/build-tests/pack.js +2 -3
- package/lib/pack/config.cjs +103 -0
- package/lib/pack/config.cjs.map +1 -0
- package/lib/pack/config.d.ts +21 -0
- package/lib/pack/config.js +102 -0
- package/lib/pack/config.js.map +1 -0
- package/lib/pack/constants.cjs +45 -0
- package/lib/pack/constants.cjs.map +1 -0
- package/lib/pack/constants.d.ts +23 -0
- package/lib/pack/constants.js +40 -0
- package/lib/pack/constants.js.map +1 -0
- package/lib/pack/index.cjs +17 -0
- package/lib/pack/index.d.ts +6 -0
- package/lib/pack/index.js +6 -0
- package/lib/pack/input.cjs +19 -0
- package/lib/pack/input.cjs.map +1 -0
- package/lib/pack/input.d.ts +10 -0
- package/lib/pack/input.js +18 -0
- package/lib/pack/input.js.map +1 -0
- package/lib/pack/output.cjs +26 -0
- package/lib/pack/output.cjs.map +1 -0
- package/lib/pack/output.d.ts +13 -0
- package/lib/pack/output.js +25 -0
- package/lib/pack/output.js.map +1 -0
- package/lib/pack/plugins/circulars.cjs +39 -0
- package/lib/pack/plugins/circulars.cjs.map +1 -0
- package/lib/pack/plugins/circulars.d.ts +18 -0
- package/lib/pack/plugins/circulars.js +38 -0
- package/lib/pack/plugins/circulars.js.map +1 -0
- package/lib/pack/plugins/index.cjs +22 -0
- package/lib/pack/plugins/index.cjs.map +1 -0
- package/lib/pack/plugins/index.d.ts +25 -0
- package/lib/pack/plugins/index.js +21 -0
- package/lib/pack/plugins/index.js.map +1 -0
- package/lib/pack/project.cjs +32 -0
- package/lib/pack/project.cjs.map +1 -0
- package/lib/pack/project.d.ts +9 -0
- package/lib/pack/project.js +31 -0
- package/lib/pack/project.js.map +1 -0
- package/lib/pack/types.d.ts +46 -0
- package/lib/plugins/hmr.cjs +19 -5
- package/lib/plugins/hmr.cjs.map +1 -1
- package/lib/plugins/hmr.d.ts +14 -1
- package/lib/plugins/hmr.js +18 -4
- package/lib/plugins/hmr.js.map +1 -1
- package/lib/plugins/suppressWarnings.cjs +1 -2
- package/lib/plugins/suppressWarnings.js +1 -2
- package/lib/rolldown-config/config.cjs +3 -4
- package/lib/rolldown-config/config.cjs.map +1 -1
- package/lib/rolldown-config/config.js +3 -4
- package/lib/rolldown-config/config.js.map +1 -1
- package/lib/rolldown-config/constants.cjs +1 -2
- package/lib/rolldown-config/constants.js +1 -2
- package/lib/rolldown-config/helpers.cjs +1 -2
- package/lib/rolldown-config/helpers.js +1 -2
- package/lib/rolldown-config/index.cjs +1 -1
- package/lib/rolldown-config/index.js +1 -1
- package/lib/rolldown-config/input.cjs +1 -2
- package/lib/rolldown-config/input.js +1 -2
- package/lib/rolldown-config/output.cjs +1 -2
- package/lib/rolldown-config/output.js +1 -2
- package/lib/rolldown-config/plugins/circulars.cjs +1 -2
- package/lib/rolldown-config/plugins/circulars.js +1 -2
- package/lib/rolldown-config/plugins/clean.cjs +2 -3
- package/lib/rolldown-config/plugins/clean.js +2 -3
- package/lib/rolldown-config/plugins/externals.cjs +1 -2
- package/lib/rolldown-config/plugins/externals.js +1 -2
- package/lib/rolldown-config/plugins/index.cjs +1 -2
- package/lib/rolldown-config/plugins/index.js +1 -2
- package/lib/rolldown-config/plugins/typescript.cjs +1 -2
- package/lib/rolldown-config/plugins/typescript.config.cjs +1 -2
- package/lib/rolldown-config/plugins/typescript.config.js +1 -2
- package/lib/rolldown-config/plugins/typescript.fast.cjs +1 -2
- package/lib/rolldown-config/plugins/typescript.fast.js +1 -2
- package/lib/rolldown-config/plugins/typescript.js +1 -2
- package/lib/utils/array.cjs +1 -2
- package/lib/utils/array.js +1 -2
- package/lib/utils/bemedev/globals/types.d.ts +1 -0
- package/lib/utils/bemedev/globals/utils/_unknown.cjs +1 -2
- package/lib/utils/bemedev/globals/utils/_unknown.js +1 -2
- package/lib/utils/bemedev/globals/utils/expandFn.cjs +1 -2
- package/lib/utils/bemedev/globals/utils/expandFn.js +1 -2
- package/lib/utils/clamp.cjs +1 -2
- package/lib/utils/clamp.js +1 -2
- package/lib/utils/identity.cjs +1 -2
- package/lib/utils/identity.js +1 -2
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/sleep.cjs +1 -2
- package/lib/utils/sleep.js +1 -2
- package/lib/utils/types.d.ts +1 -1
- package/lib/vitest-exclude/constants.cjs +1 -2
- package/lib/vitest-exclude/constants.js +1 -2
- package/lib/vitest-exclude/index.js +1 -2
- package/lib/vitest-exclude/vitest.cjs +2 -3
- package/lib/vitest-exclude/vitest.js +2 -3
- package/lib/vitest-exclude/vitest.utils.cjs +1 -2
- package/lib/vitest-exclude/vitest.utils.js +1 -2
- package/lib/vitest-extended/acceptation.cjs +1 -2
- package/lib/vitest-extended/acceptation.js +1 -2
- package/lib/vitest-extended/createTests.cjs +2 -3
- package/lib/vitest-extended/createTests.js +2 -3
- package/lib/vitest-extended/done.cjs +1 -2
- package/lib/vitest-extended/done.js +1 -2
- package/lib/vitest-extended/each/error.cjs +2 -3
- package/lib/vitest-extended/each/error.js +2 -3
- package/lib/vitest-extended/each/pass.cjs +2 -3
- package/lib/vitest-extended/each/pass.js +2 -3
- package/lib/vitest-extended/fakeWaiter.cjs +1 -2
- package/lib/vitest-extended/fakeWaiter.js +1 -2
- package/lib/vitest-extended/fixtures/coverage.cjs +1 -2
- package/lib/vitest-extended/fixtures/coverage.js +1 -2
- package/lib/vitest-extended/fixtures/partialCall.cjs +1 -2
- package/lib/vitest-extended/fixtures/partialCall.js +1 -2
- package/lib/vitest-extended/fixtures/toUpper.cjs +1 -2
- package/lib/vitest-extended/fixtures/toUpper.js +1 -2
- package/lib/vitest-extended/fixtures/vitest.cjs +1 -2
- package/lib/vitest-extended/fixtures/vitest.js +1 -2
- package/lib/vitest-extended/fixtures/zod.cjs +1 -2
- package/lib/vitest-extended/fixtures/zod.js +1 -2
- package/lib/vitest-extended/identity.cjs +1 -2
- package/lib/vitest-extended/identity.js +1 -2
- package/lib/vitest-extended/index.cjs +2 -2
- package/lib/vitest-extended/index.js +2 -2
- package/lib/vitest-extended/isDefined.cjs +1 -2
- package/lib/vitest-extended/isDefined.js +1 -2
- package/lib/vitest-extended/isFunction.cjs +1 -2
- package/lib/vitest-extended/isFunction.js +1 -2
- package/lib/vitest-extended/project.cjs +9 -7
- package/lib/vitest-extended/project.cjs.map +1 -1
- package/lib/vitest-extended/project.d.ts +2 -2
- package/lib/vitest-extended/project.js +10 -8
- package/lib/vitest-extended/project.js.map +1 -1
- package/lib/vitest-extended/toArray.cjs +1 -2
- package/lib/vitest-extended/toArray.js +1 -2
- package/lib/vitest-extended/toStringFlat.cjs +1 -2
- package/lib/vitest-extended/toStringFlat.js +1 -2
- package/package.json +68 -59
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { toArray } from "../utils/array.js";
|
|
2
|
+
import { getConfig } from "../rolldown-config/plugins/typescript.config.js";
|
|
3
|
+
import { DEFAULT_CIRCULAR_DEPS, DEFAULT_EXCLUDE } from "./constants.js";
|
|
4
|
+
import { buildEntry } from "./input.js";
|
|
5
|
+
import { buildOutput } from "./output.js";
|
|
6
|
+
import { DEFAULT_PLUGINS } from "./plugins/index.js";
|
|
7
|
+
// src/pack/config.ts
|
|
8
|
+
/**
|
|
9
|
+
* Generates a Vite+ Pack configuration using default or customized options.
|
|
10
|
+
*
|
|
11
|
+
* The returned object is meant to be used as the `pack` field of a Vite+
|
|
12
|
+
* configuration:
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { defineConfig } from '@bemedev/dev-utils/pack';
|
|
17
|
+
* import { defineConfig as defineViteConfig } from 'vite-plus';
|
|
18
|
+
*
|
|
19
|
+
* export default defineViteConfig({
|
|
20
|
+
* pack: defineConfig.bemedev(),
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param additionals - Optional build configuration parameters of type {@linkcode Params}.
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
const defineConfig = (additionals) => {
|
|
28
|
+
return defineConfig.default(additionals);
|
|
29
|
+
};
|
|
30
|
+
const producePlugins = ({ circularDeps, plugins, ignoresJS, sourcemap, dir } = {}) => {
|
|
31
|
+
const unordered = {
|
|
32
|
+
circulars: () => DEFAULT_PLUGINS.circulars({ exclude: circularDeps }),
|
|
33
|
+
clean: () => DEFAULT_PLUGINS.clean({
|
|
34
|
+
ignoresJS,
|
|
35
|
+
sourcemap,
|
|
36
|
+
dir
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
return plugins ? plugins.map((p) => {
|
|
40
|
+
if (typeof p === "string") return unordered[p]();
|
|
41
|
+
return p;
|
|
42
|
+
}).filter((p) => !!p) : [unordered.circulars()];
|
|
43
|
+
};
|
|
44
|
+
defineConfig.default = ({ dir, sourcemap: _sourcemap = false, excludesTS, ignoresJS, externals, dts, circularDeps, plugins: _plugins, ...rest } = {}) => {
|
|
45
|
+
const config = getConfig(process.cwd());
|
|
46
|
+
const entry = buildEntry(...toArray(excludesTS));
|
|
47
|
+
const declarationMap = !_sourcemap ? config.options.declarationMap : _sourcemap;
|
|
48
|
+
const sourcemap = !_sourcemap ? config.options.sourceMap : _sourcemap;
|
|
49
|
+
const output = buildOutput(config.options.outDir ?? dir, sourcemap);
|
|
50
|
+
const neverBundle = toArray(externals);
|
|
51
|
+
const _defaultDts = {
|
|
52
|
+
generator: "tsgo",
|
|
53
|
+
sourcemap: declarationMap
|
|
54
|
+
};
|
|
55
|
+
const __dts = !dts ? config.options.declaration === true ? _defaultDts : false : dts === true ? _defaultDts : typeof dts === "string" ? dts : {
|
|
56
|
+
...dts,
|
|
57
|
+
sourcemap: declarationMap
|
|
58
|
+
};
|
|
59
|
+
const plugins = producePlugins({
|
|
60
|
+
circularDeps,
|
|
61
|
+
plugins: _plugins,
|
|
62
|
+
ignoresJS,
|
|
63
|
+
sourcemap,
|
|
64
|
+
dir
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
...rest,
|
|
68
|
+
...output,
|
|
69
|
+
entry,
|
|
70
|
+
platform: "node",
|
|
71
|
+
dts: __dts,
|
|
72
|
+
deps: {
|
|
73
|
+
...rest.deps,
|
|
74
|
+
neverBundle
|
|
75
|
+
},
|
|
76
|
+
plugins
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
defineConfig.fast = (rest) => {
|
|
80
|
+
return defineConfig.default({
|
|
81
|
+
...rest,
|
|
82
|
+
dts: {
|
|
83
|
+
generator: "oxc",
|
|
84
|
+
eager: true
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
defineConfig.bemedev = (additionals) => {
|
|
89
|
+
const circularDeps = DEFAULT_CIRCULAR_DEPS.concat(toArray(additionals?.circularDeps));
|
|
90
|
+
const excludesTS = DEFAULT_EXCLUDE.concat(toArray(additionals?.excludesTS));
|
|
91
|
+
const _sourcemap = additionals?.sourcemap;
|
|
92
|
+
const sourcemap = _sourcemap === void 0 || _sourcemap === true;
|
|
93
|
+
return defineConfig.default({
|
|
94
|
+
...additionals,
|
|
95
|
+
circularDeps,
|
|
96
|
+
excludesTS,
|
|
97
|
+
sourcemap
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
export { defineConfig };
|
|
101
|
+
|
|
102
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","names":[],"sources":["../../src/pack/config.ts"],"sourcesContent":["import { toArray } from '#utils';\n\nimport { getConfig } from '../rolldown-config/plugins/typescript.config';\nimport { DEFAULT_CIRCULAR_DEPS, DEFAULT_EXCLUDE } from './constants';\nimport { buildEntry } from './input';\nimport { buildOutput } from './output';\nimport { DEFAULT_PLUGINS } from './plugins';\nimport type { Config_F, DtsOptions, Params } from './types';\n\n/**\n * Generates a Vite+ Pack configuration using default or customized options.\n *\n * The returned object is meant to be used as the `pack` field of a Vite+\n * configuration:\n *\n * @example\n * ```ts\n * import { defineConfig } from '@bemedev/dev-utils/pack';\n * import { defineConfig as defineViteConfig } from 'vite-plus';\n *\n * export default defineViteConfig({\n * pack: defineConfig.bemedev(),\n * });\n * ```\n *\n * @param additionals - Optional build configuration parameters of type {@linkcode Params}.\n *\n */\nexport const defineConfig: Config_F = additionals => {\n return defineConfig.default(additionals);\n};\n\nconst producePlugins = ({\n circularDeps,\n plugins,\n ignoresJS,\n sourcemap,\n dir,\n}: Params = {}) => {\n const unordered = {\n circulars: () => DEFAULT_PLUGINS.circulars({ exclude: circularDeps }),\n clean: () => DEFAULT_PLUGINS.clean({ ignoresJS, sourcemap, dir }),\n };\n\n return plugins\n ? plugins\n .map(p => {\n if (typeof p === 'string') return unordered[p]();\n return p;\n })\n .filter(p => !!p)\n : [unordered.circulars()];\n};\n\ndefineConfig.default = ({\n dir,\n sourcemap: _sourcemap = false,\n excludesTS,\n ignoresJS,\n externals,\n dts,\n circularDeps,\n plugins: _plugins,\n ...rest\n} = {}) => {\n const config = getConfig(process.cwd());\n const entry = buildEntry(...toArray(excludesTS));\n const declarationMap = !_sourcemap ? config.options.declarationMap : _sourcemap;\n const sourcemap = !_sourcemap ? config.options.sourceMap : _sourcemap;\n const output = buildOutput(config.options.outDir ?? dir, sourcemap);\n const neverBundle = toArray(externals);\n\n const _defaultDts: DtsOptions = { generator: 'tsgo', sourcemap: declarationMap };\n\n const __dts: DtsOptions = !dts\n ? config.options.declaration === true\n ? _defaultDts\n : false\n : dts === true\n ? _defaultDts\n : typeof dts === 'string'\n ? dts\n : { ...dts, sourcemap: declarationMap };\n\n const plugins = producePlugins({\n circularDeps,\n plugins: _plugins,\n ignoresJS,\n sourcemap,\n dir,\n });\n\n return {\n ...rest,\n ...output,\n entry,\n platform: 'node',\n dts: __dts,\n deps: { ...rest.deps, neverBundle },\n plugins,\n };\n};\n\ndefineConfig.fast = rest => {\n return defineConfig.default({ ...rest, dts: { generator: 'oxc', eager: true } });\n};\n\ndefineConfig.bemedev = additionals => {\n // #region constants\n const circularDeps = DEFAULT_CIRCULAR_DEPS.concat(\n toArray(additionals?.circularDeps),\n );\n\n const excludesTS = DEFAULT_EXCLUDE.concat(toArray(additionals?.excludesTS));\n const _sourcemap = additionals?.sourcemap;\n const sourcemap = _sourcemap === undefined || _sourcemap === true;\n // #endregion\n\n return defineConfig.default({\n ...additionals,\n circularDeps,\n excludesTS,\n sourcemap,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,gBAAyB,gBAAe;CACnD,OAAO,aAAa,QAAQ,WAAW;AACzC;AAEA,MAAM,kBAAkB,EACtB,cACA,SACA,WACA,WACA,QACU,CAAC,MAAM;CACjB,MAAM,YAAY;EAChB,iBAAiB,gBAAgB,UAAU,EAAE,SAAS,aAAa,CAAC;EACpE,aAAa,gBAAgB,MAAM;GAAE;GAAW;GAAW;EAAI,CAAC;CAClE;CAEA,OAAO,UACH,QACG,KAAI,MAAK;EACR,IAAI,OAAO,MAAM,UAAU,OAAO,UAAU,EAAE,CAAC;EAC/C,OAAO;CACT,CAAC,CAAC,CACD,QAAO,MAAK,CAAC,CAAC,CAAC,IAClB,CAAC,UAAU,UAAU,CAAC;AAC5B;AAEA,aAAa,WAAW,EACtB,KACA,WAAW,aAAa,OACxB,YACA,WACA,WACA,KACA,cACA,SAAS,UACT,GAAG,SACD,CAAC,MAAM;CACT,MAAM,SAAS,UAAU,QAAQ,IAAI,CAAC;CACtC,MAAM,QAAQ,WAAW,GAAG,QAAQ,UAAU,CAAC;CAC/C,MAAM,iBAAiB,CAAC,aAAa,OAAO,QAAQ,iBAAiB;CACrE,MAAM,YAAY,CAAC,aAAa,OAAO,QAAQ,YAAY;CAC3D,MAAM,SAAS,YAAY,OAAO,QAAQ,UAAU,KAAK,SAAS;CAClE,MAAM,cAAc,QAAQ,SAAS;CAErC,MAAM,cAA0B;EAAE,WAAW;EAAQ,WAAW;CAAe;CAE/E,MAAM,QAAoB,CAAC,MACvB,OAAO,QAAQ,gBAAgB,OAC7B,cACA,QACF,QAAQ,OACN,cACA,OAAO,QAAQ,WACb,MACA;EAAE,GAAG;EAAK,WAAW;CAAe;CAE5C,MAAM,UAAU,eAAe;EAC7B;EACA,SAAS;EACT;EACA;EACA;CACF,CAAC;CAED,OAAO;EACL,GAAG;EACH,GAAG;EACH;EACA,UAAU;EACV,KAAK;EACL,MAAM;GAAE,GAAG,KAAK;GAAM;EAAY;EAClC;CACF;AACF;AAEA,aAAa,QAAO,SAAQ;CAC1B,OAAO,aAAa,QAAQ;EAAE,GAAG;EAAM,KAAK;GAAE,WAAW;GAAO,OAAO;EAAK;CAAE,CAAC;AACjF;AAEA,aAAa,WAAU,gBAAe;CAEpC,MAAM,eAAe,sBAAsB,OACzC,QAAQ,aAAa,YAAY,CACnC;CAEA,MAAM,aAAa,gBAAgB,OAAO,QAAQ,aAAa,UAAU,CAAC;CAC1E,MAAM,aAAa,aAAa;CAChC,MAAM,YAAY,eAAe,KAAA,KAAa,eAAe;CAG7D,OAAO,aAAa,QAAQ;EAC1B,GAAG;EACH;EACA;EACA;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
// src/pack/constants.ts
|
|
3
|
+
/**
|
|
4
|
+
* Default exclude glob patterns for bundling and type generation.
|
|
5
|
+
*/
|
|
6
|
+
const DEFAULT_EXCLUDE = [
|
|
7
|
+
"**/node_modules/**/*",
|
|
8
|
+
"**/__tests__/**/*",
|
|
9
|
+
"**/*.test.ts",
|
|
10
|
+
"**/*.test-d.ts",
|
|
11
|
+
"**/*.fixtures.ts",
|
|
12
|
+
"**/fixtures.ts",
|
|
13
|
+
"src/fixtures/**/*.ts"
|
|
14
|
+
];
|
|
15
|
+
/**
|
|
16
|
+
* Default patterns for type files that may contain circular references.
|
|
17
|
+
*/
|
|
18
|
+
const DEFAULT_CIRCULAR_DEPS = [
|
|
19
|
+
"**/types.ts",
|
|
20
|
+
"**/type.ts",
|
|
21
|
+
"**/*.types.ts",
|
|
22
|
+
"**/*.type.ts"
|
|
23
|
+
];
|
|
24
|
+
/**
|
|
25
|
+
* Combined default exclusions and circular dependency file patterns.
|
|
26
|
+
*/
|
|
27
|
+
const IGNORE = DEFAULT_EXCLUDE.concat(DEFAULT_CIRCULAR_DEPS);
|
|
28
|
+
/**
|
|
29
|
+
* Default output directory name used by Vite+ Pack.
|
|
30
|
+
*/
|
|
31
|
+
const DEFAULT_DIR = "lib";
|
|
32
|
+
/**
|
|
33
|
+
* Rolldown log warning codes.
|
|
34
|
+
*/
|
|
35
|
+
const WARNING_CODES = {
|
|
36
|
+
EMPTY_BUNDLE: "EMPTY_BUNDLE",
|
|
37
|
+
CIRCULAR_DEPENDENCY: "CIRCULAR_DEPENDENCY"
|
|
38
|
+
};
|
|
39
|
+
exports.DEFAULT_CIRCULAR_DEPS = DEFAULT_CIRCULAR_DEPS;
|
|
40
|
+
exports.DEFAULT_DIR = DEFAULT_DIR;
|
|
41
|
+
exports.DEFAULT_EXCLUDE = DEFAULT_EXCLUDE;
|
|
42
|
+
exports.IGNORE = IGNORE;
|
|
43
|
+
exports.WARNING_CODES = WARNING_CODES;
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=constants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.cjs","names":[],"sources":["../../src/pack/constants.ts"],"sourcesContent":["/**\n * Default exclude glob patterns for bundling and type generation.\n */\nexport const DEFAULT_EXCLUDE = [\n '**/node_modules/**/*',\n '**/__tests__/**/*',\n '**/*.test.ts',\n '**/*.test-d.ts',\n '**/*.fixtures.ts',\n '**/fixtures.ts',\n 'src/fixtures/**/*.ts',\n];\n\n/**\n * Default patterns for type files that may contain circular references.\n */\nexport const DEFAULT_CIRCULAR_DEPS = [\n '**/types.ts',\n '**/type.ts',\n '**/*.types.ts',\n '**/*.type.ts',\n];\n\n/**\n * Combined default exclusions and circular dependency file patterns.\n */\nexport const IGNORE = DEFAULT_EXCLUDE.concat(DEFAULT_CIRCULAR_DEPS);\n\n/**\n * Default output directory name used by Vite+ Pack.\n */\nexport const DEFAULT_DIR = 'lib';\n\n/**\n * Rolldown log warning codes.\n */\nexport const WARNING_CODES = {\n EMPTY_BUNDLE: 'EMPTY_BUNDLE',\n CIRCULAR_DEPENDENCY: 'CIRCULAR_DEPENDENCY',\n};\n"],"mappings":";;;;;AAGA,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;AAKA,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;AACF;;;;AAKA,MAAa,SAAS,gBAAgB,OAAO,qBAAqB;;;;AAKlE,MAAa,cAAc;;;;AAK3B,MAAa,gBAAgB;CAC3B,cAAc;CACd,qBAAqB;AACvB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default exclude glob patterns for bundling and type generation.
|
|
3
|
+
*/
|
|
4
|
+
export declare const DEFAULT_EXCLUDE: string[];
|
|
5
|
+
/**
|
|
6
|
+
* Default patterns for type files that may contain circular references.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_CIRCULAR_DEPS: string[];
|
|
9
|
+
/**
|
|
10
|
+
* Combined default exclusions and circular dependency file patterns.
|
|
11
|
+
*/
|
|
12
|
+
export declare const IGNORE: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Default output directory name used by Vite+ Pack.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DEFAULT_DIR = "lib";
|
|
17
|
+
/**
|
|
18
|
+
* Rolldown log warning codes.
|
|
19
|
+
*/
|
|
20
|
+
export declare const WARNING_CODES: {
|
|
21
|
+
EMPTY_BUNDLE: string;
|
|
22
|
+
CIRCULAR_DEPENDENCY: string;
|
|
23
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/pack/constants.ts
|
|
2
|
+
/**
|
|
3
|
+
* Default exclude glob patterns for bundling and type generation.
|
|
4
|
+
*/
|
|
5
|
+
const DEFAULT_EXCLUDE = [
|
|
6
|
+
"**/node_modules/**/*",
|
|
7
|
+
"**/__tests__/**/*",
|
|
8
|
+
"**/*.test.ts",
|
|
9
|
+
"**/*.test-d.ts",
|
|
10
|
+
"**/*.fixtures.ts",
|
|
11
|
+
"**/fixtures.ts",
|
|
12
|
+
"src/fixtures/**/*.ts"
|
|
13
|
+
];
|
|
14
|
+
/**
|
|
15
|
+
* Default patterns for type files that may contain circular references.
|
|
16
|
+
*/
|
|
17
|
+
const DEFAULT_CIRCULAR_DEPS = [
|
|
18
|
+
"**/types.ts",
|
|
19
|
+
"**/type.ts",
|
|
20
|
+
"**/*.types.ts",
|
|
21
|
+
"**/*.type.ts"
|
|
22
|
+
];
|
|
23
|
+
/**
|
|
24
|
+
* Combined default exclusions and circular dependency file patterns.
|
|
25
|
+
*/
|
|
26
|
+
const IGNORE = DEFAULT_EXCLUDE.concat(DEFAULT_CIRCULAR_DEPS);
|
|
27
|
+
/**
|
|
28
|
+
* Default output directory name used by Vite+ Pack.
|
|
29
|
+
*/
|
|
30
|
+
const DEFAULT_DIR = "lib";
|
|
31
|
+
/**
|
|
32
|
+
* Rolldown log warning codes.
|
|
33
|
+
*/
|
|
34
|
+
const WARNING_CODES = {
|
|
35
|
+
EMPTY_BUNDLE: "EMPTY_BUNDLE",
|
|
36
|
+
CIRCULAR_DEPENDENCY: "CIRCULAR_DEPENDENCY"
|
|
37
|
+
};
|
|
38
|
+
export { DEFAULT_CIRCULAR_DEPS, DEFAULT_DIR, DEFAULT_EXCLUDE, IGNORE, WARNING_CODES };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../../src/pack/constants.ts"],"sourcesContent":["/**\n * Default exclude glob patterns for bundling and type generation.\n */\nexport const DEFAULT_EXCLUDE = [\n '**/node_modules/**/*',\n '**/__tests__/**/*',\n '**/*.test.ts',\n '**/*.test-d.ts',\n '**/*.fixtures.ts',\n '**/fixtures.ts',\n 'src/fixtures/**/*.ts',\n];\n\n/**\n * Default patterns for type files that may contain circular references.\n */\nexport const DEFAULT_CIRCULAR_DEPS = [\n '**/types.ts',\n '**/type.ts',\n '**/*.types.ts',\n '**/*.type.ts',\n];\n\n/**\n * Combined default exclusions and circular dependency file patterns.\n */\nexport const IGNORE = DEFAULT_EXCLUDE.concat(DEFAULT_CIRCULAR_DEPS);\n\n/**\n * Default output directory name used by Vite+ Pack.\n */\nexport const DEFAULT_DIR = 'lib';\n\n/**\n * Rolldown log warning codes.\n */\nexport const WARNING_CODES = {\n EMPTY_BUNDLE: 'EMPTY_BUNDLE',\n CIRCULAR_DEPENDENCY: 'CIRCULAR_DEPENDENCY',\n};\n"],"mappings":";;;;AAGA,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;AAKA,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;AACF;;;;AAKA,MAAa,SAAS,gBAAgB,OAAO,qBAAqB;;;;AAKlE,MAAa,cAAc;;;;AAK3B,MAAa,gBAAgB;CAC3B,cAAc;CACd,qBAAqB;AACvB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_pack_config = require("./config.cjs");
|
|
3
|
+
const require_pack_plugins_index = require("./plugins/index.cjs");
|
|
4
|
+
const require_rolldown_config_helpers = require("../rolldown-config/helpers.cjs");
|
|
5
|
+
const require_pack_project = require("./project.cjs");
|
|
6
|
+
const require_pack_constants = require("./constants.cjs");
|
|
7
|
+
exports.DEFAULT_CIRCULAR_DEPS = require_pack_constants.DEFAULT_CIRCULAR_DEPS;
|
|
8
|
+
exports.DEFAULT_DIR = require_pack_constants.DEFAULT_DIR;
|
|
9
|
+
exports.DEFAULT_EXCLUDE = require_pack_constants.DEFAULT_EXCLUDE;
|
|
10
|
+
exports.DEFAULT_PLUGINS = require_pack_plugins_index.DEFAULT_PLUGINS;
|
|
11
|
+
exports.DEFAULT_PLUGINS_ORDER = require_pack_plugins_index.DEFAULT_PLUGINS_ORDER;
|
|
12
|
+
exports.IGNORE = require_pack_constants.IGNORE;
|
|
13
|
+
exports.WARNING_CODES = require_pack_constants.WARNING_CODES;
|
|
14
|
+
exports.cleanupJS = require_rolldown_config_helpers.cleanupJS;
|
|
15
|
+
exports.defineConfig = require_pack_config.defineConfig;
|
|
16
|
+
exports.defineProject = require_pack_project.defineProject;
|
|
17
|
+
exports.withoutExtension = require_rolldown_config_helpers.withoutExtension;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { defineConfig } from "./config.js";
|
|
2
|
+
import { DEFAULT_PLUGINS, DEFAULT_PLUGINS_ORDER } from "./plugins/index.js";
|
|
3
|
+
import { cleanupJS, withoutExtension } from "../rolldown-config/helpers.js";
|
|
4
|
+
import { defineProject } from "./project.js";
|
|
5
|
+
import { DEFAULT_CIRCULAR_DEPS, DEFAULT_DIR, DEFAULT_EXCLUDE, IGNORE, WARNING_CODES } from "./constants.js";
|
|
6
|
+
export { DEFAULT_CIRCULAR_DEPS, DEFAULT_DIR, DEFAULT_EXCLUDE, DEFAULT_PLUGINS, DEFAULT_PLUGINS_ORDER, IGNORE, WARNING_CODES, cleanupJS, defineConfig, defineProject, withoutExtension };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_pack_constants = require("./constants.cjs");
|
|
3
|
+
let path = require("path");
|
|
4
|
+
let glob = require("glob");
|
|
5
|
+
// src/pack/input.ts
|
|
6
|
+
/**
|
|
7
|
+
* Builds the entry points record for Vite+ Pack from all
|
|
8
|
+
* `src/[**]/*.ts` files.
|
|
9
|
+
*
|
|
10
|
+
* @param ignores - Additional glob patterns to exclude from entry points.
|
|
11
|
+
*
|
|
12
|
+
* @returns An object mapping relative module names to absolute source paths.
|
|
13
|
+
*/
|
|
14
|
+
const buildEntry = (...ignores) => Object.fromEntries((0, glob.globSync)("src/**/*.ts", { ignore: require_pack_constants.DEFAULT_EXCLUDE.concat(ignores) }).map((file) => {
|
|
15
|
+
return [(0, path.relative)("src", file.slice(0, file.length - (0, path.extname)(file).length)), `${process.cwd()}/${file}`];
|
|
16
|
+
}));
|
|
17
|
+
exports.buildEntry = buildEntry;
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=input.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.cjs","names":["globSync","DEFAULT_EXCLUDE","relative","extname"],"sources":["../../src/pack/input.ts"],"sourcesContent":["import { extname, relative } from 'node:path';\n\nimport { globSync } from 'glob';\n\nimport { DEFAULT_EXCLUDE } from './constants';\nimport type { BuildEntry_F } from './types';\n\n/**\n * Builds the entry points record for Vite+ Pack from all\n * `src/[**]/*.ts` files.\n *\n * @param ignores - Additional glob patterns to exclude from entry points.\n *\n * @returns An object mapping relative module names to absolute source paths.\n */\nexport const buildEntry: BuildEntry_F = (...ignores) =>\n Object.fromEntries(\n globSync('src/**/*.ts', { ignore: DEFAULT_EXCLUDE.concat(ignores) }).map(\n file => {\n const key = relative(\n 'src',\n file.slice(0, file.length - extname(file).length),\n );\n const value = `${process.cwd()}/${file}`;\n\n return [key, value];\n },\n ),\n );\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAa,cAA4B,GAAG,YAC1C,OAAO,aAAA,GACLA,KAAAA,SAAAA,CAAS,eAAe,EAAE,QAAQC,uBAAAA,gBAAgB,OAAO,OAAO,EAAE,CAAC,CAAC,CAAC,KACnE,SAAQ;CAON,OAAO,EAAA,GANKC,KAAAA,SAAAA,CACV,OACA,KAAK,MAAM,GAAG,KAAK,UAAA,GAASC,KAAAA,QAAAA,CAAQ,IAAI,CAAC,CAAC,MAAM,CAIxC,GAAG,GAFI,QAAQ,IAAI,EAAE,GAAG,MAEhB;AACpB,CACF,CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BuildEntry_F } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the entry points record for Vite+ Pack from all
|
|
4
|
+
* `src/[**]/*.ts` files.
|
|
5
|
+
*
|
|
6
|
+
* @param ignores - Additional glob patterns to exclude from entry points.
|
|
7
|
+
*
|
|
8
|
+
* @returns An object mapping relative module names to absolute source paths.
|
|
9
|
+
*/
|
|
10
|
+
export declare const buildEntry: BuildEntry_F;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DEFAULT_EXCLUDE } from "./constants.js";
|
|
2
|
+
import { extname, relative } from "path";
|
|
3
|
+
import { globSync } from "glob";
|
|
4
|
+
// src/pack/input.ts
|
|
5
|
+
/**
|
|
6
|
+
* Builds the entry points record for Vite+ Pack from all
|
|
7
|
+
* `src/[**]/*.ts` files.
|
|
8
|
+
*
|
|
9
|
+
* @param ignores - Additional glob patterns to exclude from entry points.
|
|
10
|
+
*
|
|
11
|
+
* @returns An object mapping relative module names to absolute source paths.
|
|
12
|
+
*/
|
|
13
|
+
const buildEntry = (...ignores) => Object.fromEntries(globSync("src/**/*.ts", { ignore: DEFAULT_EXCLUDE.concat(ignores) }).map((file) => {
|
|
14
|
+
return [relative("src", file.slice(0, file.length - extname(file).length)), `${process.cwd()}/${file}`];
|
|
15
|
+
}));
|
|
16
|
+
export { buildEntry };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","names":[],"sources":["../../src/pack/input.ts"],"sourcesContent":["import { extname, relative } from 'node:path';\n\nimport { globSync } from 'glob';\n\nimport { DEFAULT_EXCLUDE } from './constants';\nimport type { BuildEntry_F } from './types';\n\n/**\n * Builds the entry points record for Vite+ Pack from all\n * `src/[**]/*.ts` files.\n *\n * @param ignores - Additional glob patterns to exclude from entry points.\n *\n * @returns An object mapping relative module names to absolute source paths.\n */\nexport const buildEntry: BuildEntry_F = (...ignores) =>\n Object.fromEntries(\n globSync('src/**/*.ts', { ignore: DEFAULT_EXCLUDE.concat(ignores) }).map(\n file => {\n const key = relative(\n 'src',\n file.slice(0, file.length - extname(file).length),\n );\n const value = `${process.cwd()}/${file}`;\n\n return [key, value];\n },\n ),\n );\n"],"mappings":";;;;;;;;;;;;AAeA,MAAa,cAA4B,GAAG,YAC1C,OAAO,YACL,SAAS,eAAe,EAAE,QAAQ,gBAAgB,OAAO,OAAO,EAAE,CAAC,CAAC,CAAC,KACnE,SAAQ;CAON,OAAO,CANK,SACV,OACA,KAAK,MAAM,GAAG,KAAK,SAAS,QAAQ,IAAI,CAAC,CAAC,MAAM,CAIxC,GAAG,GAFI,QAAQ,IAAI,EAAE,GAAG,MAEhB;AACpB,CACF,CACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./constants.cjs");
|
|
3
|
+
// src/pack/output.ts
|
|
4
|
+
/**
|
|
5
|
+
* Builds the shared output configuration for Vite+ Pack.
|
|
6
|
+
*
|
|
7
|
+
* The bundle is unbundled (`preserveModules` equivalent) and emitted both as
|
|
8
|
+
* ESM (`.js`) and CJS (`.cjs`) files.
|
|
9
|
+
*
|
|
10
|
+
* @param dir - Target output directory name, defaults to {@linkcode DEFAULT_DIR}.
|
|
11
|
+
* @param sourcemap - Whether to generate source maps.
|
|
12
|
+
*
|
|
13
|
+
* @returns Output options of type {@linkcode PackOutput}.
|
|
14
|
+
*/
|
|
15
|
+
const buildOutput = (outDir = "lib", sourcemap = false) => {
|
|
16
|
+
return {
|
|
17
|
+
outDir,
|
|
18
|
+
format: ["esm"],
|
|
19
|
+
unbundle: true,
|
|
20
|
+
fixedExtension: false,
|
|
21
|
+
sourcemap
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
exports.buildOutput = buildOutput;
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=output.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.cjs","names":[],"sources":["../../src/pack/output.ts"],"sourcesContent":["import { DEFAULT_DIR } from './constants';\nimport type { PackOutput } from './types';\n\n/**\n * Builds the shared output configuration for Vite+ Pack.\n *\n * The bundle is unbundled (`preserveModules` equivalent) and emitted both as\n * ESM (`.js`) and CJS (`.cjs`) files.\n *\n * @param dir - Target output directory name, defaults to {@linkcode DEFAULT_DIR}.\n * @param sourcemap - Whether to generate source maps.\n *\n * @returns Output options of type {@linkcode PackOutput}.\n */\nexport const buildOutput = (outDir = DEFAULT_DIR, sourcemap = false): PackOutput => {\n return {\n outDir,\n format: ['esm'],\n unbundle: true,\n fixedExtension: false,\n sourcemap,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAa,eAAe,SAAA,OAAsB,YAAY,UAAsB;CAClF,OAAO;EACL;EACA,QAAQ,CAAC,KAAK;EACd,UAAU;EACV,gBAAgB;EAChB;CACF;AACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PackOutput } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the shared output configuration for Vite+ Pack.
|
|
4
|
+
*
|
|
5
|
+
* The bundle is unbundled (`preserveModules` equivalent) and emitted both as
|
|
6
|
+
* ESM (`.js`) and CJS (`.cjs`) files.
|
|
7
|
+
*
|
|
8
|
+
* @param dir - Target output directory name, defaults to {@linkcode DEFAULT_DIR}.
|
|
9
|
+
* @param sourcemap - Whether to generate source maps.
|
|
10
|
+
*
|
|
11
|
+
* @returns Output options of type {@linkcode PackOutput}.
|
|
12
|
+
*/
|
|
13
|
+
export declare const buildOutput: (outDir?: string, sourcemap?: boolean) => PackOutput;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import "./constants.js";
|
|
2
|
+
// src/pack/output.ts
|
|
3
|
+
/**
|
|
4
|
+
* Builds the shared output configuration for Vite+ Pack.
|
|
5
|
+
*
|
|
6
|
+
* The bundle is unbundled (`preserveModules` equivalent) and emitted both as
|
|
7
|
+
* ESM (`.js`) and CJS (`.cjs`) files.
|
|
8
|
+
*
|
|
9
|
+
* @param dir - Target output directory name, defaults to {@linkcode DEFAULT_DIR}.
|
|
10
|
+
* @param sourcemap - Whether to generate source maps.
|
|
11
|
+
*
|
|
12
|
+
* @returns Output options of type {@linkcode PackOutput}.
|
|
13
|
+
*/
|
|
14
|
+
const buildOutput = (outDir = "lib", sourcemap = false) => {
|
|
15
|
+
return {
|
|
16
|
+
outDir,
|
|
17
|
+
format: ["esm"],
|
|
18
|
+
unbundle: true,
|
|
19
|
+
fixedExtension: false,
|
|
20
|
+
sourcemap
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export { buildOutput };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","names":[],"sources":["../../src/pack/output.ts"],"sourcesContent":["import { DEFAULT_DIR } from './constants';\nimport type { PackOutput } from './types';\n\n/**\n * Builds the shared output configuration for Vite+ Pack.\n *\n * The bundle is unbundled (`preserveModules` equivalent) and emitted both as\n * ESM (`.js`) and CJS (`.cjs`) files.\n *\n * @param dir - Target output directory name, defaults to {@linkcode DEFAULT_DIR}.\n * @param sourcemap - Whether to generate source maps.\n *\n * @returns Output options of type {@linkcode PackOutput}.\n */\nexport const buildOutput = (outDir = DEFAULT_DIR, sourcemap = false): PackOutput => {\n return {\n outDir,\n format: ['esm'],\n unbundle: true,\n fixedExtension: false,\n sourcemap,\n };\n};\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAa,eAAe,SAAA,OAAsB,YAAY,UAAsB;CAClF,OAAO;EACL;EACA,QAAQ,CAAC,KAAK;EACd,UAAU;EACV,gBAAgB;EAChB;CACF;AACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_utils_array = require("../../utils/array.cjs");
|
|
3
|
+
const require_rolldown_config_helpers = require("../../rolldown-config/helpers.cjs");
|
|
4
|
+
const require_pack_constants = require("../constants.cjs");
|
|
5
|
+
let path = require("path");
|
|
6
|
+
let glob = require("glob");
|
|
7
|
+
let rollup_plugin_circular_dependencies = require("rollup-plugin-circular-dependencies");
|
|
8
|
+
require("vite-plus/pack");
|
|
9
|
+
// src/pack/plugins/circulars.ts
|
|
10
|
+
/**
|
|
11
|
+
* Creates a configured circular dependencies plugin instance with suppression
|
|
12
|
+
* for known patterns.
|
|
13
|
+
*
|
|
14
|
+
* @param options - Configuration options of type {@linkcode CircularDependenciesOptions}.
|
|
15
|
+
*
|
|
16
|
+
* @returns Rolldown plugin option of type {@linkcode TsdownPluginOption}.
|
|
17
|
+
*/
|
|
18
|
+
function circulars(options = {}) {
|
|
19
|
+
const all = (0, rollup_plugin_circular_dependencies.circularDependencies)(options);
|
|
20
|
+
const CIRCULAR_CHUNKS = require_utils_array.toArray(options.exclude).filter(Boolean).map((f) => (0, glob.globSync)(f, { nodir: true })).flat().map(require_rolldown_config_helpers.withoutExtension).map((file) => (0, path.relative)("src", file));
|
|
21
|
+
return {
|
|
22
|
+
...all,
|
|
23
|
+
name: "better circular-dependencies",
|
|
24
|
+
onLog: { handler: (_, { code, names }) => {
|
|
25
|
+
if (code === require_pack_constants.WARNING_CODES.CIRCULAR_DEPENDENCY && names?.every((name) => CIRCULAR_CHUNKS.includes(name))) {
|
|
26
|
+
const STARS = "*".repeat(20);
|
|
27
|
+
console.log(STARS);
|
|
28
|
+
console.log("[bemedev] Skipping circular dependency warnings for:");
|
|
29
|
+
names?.forEach((name) => console.log(` -> 📄 ${name}`));
|
|
30
|
+
console.log(STARS);
|
|
31
|
+
console.log();
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
} }
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
exports.circulars = circulars;
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=circulars.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circulars.cjs","names":["circularDependencies","toArray","globSync","withoutExtension","relative","WARNING_CODES"],"sources":["../../../src/pack/plugins/circulars.ts"],"sourcesContent":["import { relative } from 'node:path';\n\nimport { globSync } from 'glob';\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\nimport type { TsdownPluginOption } from 'vite-plus/pack';\nimport {} from 'vite-plus/pack';\n\nimport { toArray, type SoA } from '#utils';\n\nimport { withoutExtension } from '../../rolldown-config/helpers';\nimport { WARNING_CODES } from '../constants';\n\n/**\n * Options for the circular dependencies plugin.\n */\nexport type CircularDependenciesOptions = Omit<\n Parameters<typeof circularDependencies>[0],\n 'exclude'\n> & { exclude?: SoA<string> };\n\n/**\n * Creates a configured circular dependencies plugin instance with suppression\n * for known patterns.\n *\n * @param options - Configuration options of type {@linkcode CircularDependenciesOptions}.\n *\n * @returns Rolldown plugin option of type {@linkcode TsdownPluginOption}.\n */\nexport function circulars(\n options: CircularDependenciesOptions = {},\n): TsdownPluginOption {\n const all = circularDependencies(options);\n const exclude = toArray(options.exclude);\n\n const CIRCULAR_CHUNKS = exclude\n .filter(Boolean)\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n return {\n ...all,\n name: 'better circular-dependencies',\n onLog: {\n handler: (_, { code, names }) => {\n if (\n code === WARNING_CODES.CIRCULAR_DEPENDENCY &&\n names?.every(name => CIRCULAR_CHUNKS.includes(name))\n ) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log('[bemedev] Skipping circular dependency warnings for:');\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n console.log();\n return false;\n }\n\n return;\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,SAAgB,UACd,UAAuC,CAAC,GACpB;CACpB,MAAM,OAAA,GAAMA,oCAAAA,qBAAAA,CAAqB,OAAO;CAGxC,MAAM,kBAFUC,oBAAAA,QAAQ,QAAQ,OAEF,CAAC,CAC5B,OAAO,OAAO,CAAC,CACf,KAAI,OAAA,GAAKC,KAAAA,SAAAA,CAAS,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAIC,gCAAAA,gBAAgB,CAAC,CACrB,KAAI,UAAA,GAAQC,KAAAA,SAAAA,CAAS,OAAO,IAAI,CAAC;CAEpC,OAAO;EACL,GAAG;EACH,MAAM;EACN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,IACE,SAASC,uBAAAA,cAAc,uBACvB,OAAO,OAAM,SAAQ,gBAAgB,SAAS,IAAI,CAAC,GACnD;IACA,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI,sDAAsD;IAClE,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI;IACZ,OAAO;GACT;EAGF,EACF;CACF;AACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { circularDependencies } from 'rollup-plugin-circular-dependencies';
|
|
2
|
+
import type { TsdownPluginOption } from 'vite-plus/pack';
|
|
3
|
+
import { type SoA } from '../../utils/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Options for the circular dependencies plugin.
|
|
6
|
+
*/
|
|
7
|
+
export type CircularDependenciesOptions = Omit<Parameters<typeof circularDependencies>[0], 'exclude'> & {
|
|
8
|
+
exclude?: SoA<string>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Creates a configured circular dependencies plugin instance with suppression
|
|
12
|
+
* for known patterns.
|
|
13
|
+
*
|
|
14
|
+
* @param options - Configuration options of type {@linkcode CircularDependenciesOptions}.
|
|
15
|
+
*
|
|
16
|
+
* @returns Rolldown plugin option of type {@linkcode TsdownPluginOption}.
|
|
17
|
+
*/
|
|
18
|
+
export declare function circulars(options?: CircularDependenciesOptions): TsdownPluginOption;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { toArray } from "../../utils/array.js";
|
|
2
|
+
import { withoutExtension } from "../../rolldown-config/helpers.js";
|
|
3
|
+
import { WARNING_CODES } from "../constants.js";
|
|
4
|
+
import { relative } from "path";
|
|
5
|
+
import { globSync } from "glob";
|
|
6
|
+
import { circularDependencies } from "rollup-plugin-circular-dependencies";
|
|
7
|
+
import "vite-plus/pack";
|
|
8
|
+
// src/pack/plugins/circulars.ts
|
|
9
|
+
/**
|
|
10
|
+
* Creates a configured circular dependencies plugin instance with suppression
|
|
11
|
+
* for known patterns.
|
|
12
|
+
*
|
|
13
|
+
* @param options - Configuration options of type {@linkcode CircularDependenciesOptions}.
|
|
14
|
+
*
|
|
15
|
+
* @returns Rolldown plugin option of type {@linkcode TsdownPluginOption}.
|
|
16
|
+
*/
|
|
17
|
+
function circulars(options = {}) {
|
|
18
|
+
const all = circularDependencies(options);
|
|
19
|
+
const CIRCULAR_CHUNKS = toArray(options.exclude).filter(Boolean).map((f) => globSync(f, { nodir: true })).flat().map(withoutExtension).map((file) => relative("src", file));
|
|
20
|
+
return {
|
|
21
|
+
...all,
|
|
22
|
+
name: "better circular-dependencies",
|
|
23
|
+
onLog: { handler: (_, { code, names }) => {
|
|
24
|
+
if (code === WARNING_CODES.CIRCULAR_DEPENDENCY && names?.every((name) => CIRCULAR_CHUNKS.includes(name))) {
|
|
25
|
+
const STARS = "*".repeat(20);
|
|
26
|
+
console.log(STARS);
|
|
27
|
+
console.log("[bemedev] Skipping circular dependency warnings for:");
|
|
28
|
+
names?.forEach((name) => console.log(` -> 📄 ${name}`));
|
|
29
|
+
console.log(STARS);
|
|
30
|
+
console.log();
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
} }
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export { circulars };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=circulars.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circulars.js","names":[],"sources":["../../../src/pack/plugins/circulars.ts"],"sourcesContent":["import { relative } from 'node:path';\n\nimport { globSync } from 'glob';\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\nimport type { TsdownPluginOption } from 'vite-plus/pack';\nimport {} from 'vite-plus/pack';\n\nimport { toArray, type SoA } from '#utils';\n\nimport { withoutExtension } from '../../rolldown-config/helpers';\nimport { WARNING_CODES } from '../constants';\n\n/**\n * Options for the circular dependencies plugin.\n */\nexport type CircularDependenciesOptions = Omit<\n Parameters<typeof circularDependencies>[0],\n 'exclude'\n> & { exclude?: SoA<string> };\n\n/**\n * Creates a configured circular dependencies plugin instance with suppression\n * for known patterns.\n *\n * @param options - Configuration options of type {@linkcode CircularDependenciesOptions}.\n *\n * @returns Rolldown plugin option of type {@linkcode TsdownPluginOption}.\n */\nexport function circulars(\n options: CircularDependenciesOptions = {},\n): TsdownPluginOption {\n const all = circularDependencies(options);\n const exclude = toArray(options.exclude);\n\n const CIRCULAR_CHUNKS = exclude\n .filter(Boolean)\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n return {\n ...all,\n name: 'better circular-dependencies',\n onLog: {\n handler: (_, { code, names }) => {\n if (\n code === WARNING_CODES.CIRCULAR_DEPENDENCY &&\n names?.every(name => CIRCULAR_CHUNKS.includes(name))\n ) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log('[bemedev] Skipping circular dependency warnings for:');\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n console.log();\n return false;\n }\n\n return;\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA4BA,SAAgB,UACd,UAAuC,CAAC,GACpB;CACpB,MAAM,MAAM,qBAAqB,OAAO;CAGxC,MAAM,kBAFU,QAAQ,QAAQ,OAEF,CAAC,CAC5B,OAAO,OAAO,CAAC,CACf,KAAI,MAAK,SAAS,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAI,gBAAgB,CAAC,CACrB,KAAI,SAAQ,SAAS,OAAO,IAAI,CAAC;CAEpC,OAAO;EACL,GAAG;EACH,MAAM;EACN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,IACE,SAAS,cAAc,uBACvB,OAAO,OAAM,SAAQ,gBAAgB,SAAS,IAAI,CAAC,GACnD;IACA,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI,sDAAsD;IAClE,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI;IACZ,OAAO;GACT;EAGF,EACF;CACF;AACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_rolldown_config_plugins_clean = require("../../rolldown-config/plugins/clean.cjs");
|
|
3
|
+
// src/pack/plugins/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* Registry mapping plugin keys to their factory functions.
|
|
6
|
+
*
|
|
7
|
+
* Vite+ Pack natively handles declaration generation (`dts`), output
|
|
8
|
+
* cleaning (`clean`) and dependency externals (`external`), so only the
|
|
9
|
+
* circular dependencies plugin is exposed here.
|
|
10
|
+
*/
|
|
11
|
+
const DEFAULT_PLUGINS = {
|
|
12
|
+
circulars: require("./circulars.cjs").circulars,
|
|
13
|
+
clean: require_rolldown_config_plugins_clean.clean
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Default ordering sequence for Vite+ Pack plugins.
|
|
17
|
+
*/
|
|
18
|
+
const DEFAULT_PLUGINS_ORDER = Object.keys(DEFAULT_PLUGINS);
|
|
19
|
+
exports.DEFAULT_PLUGINS = DEFAULT_PLUGINS;
|
|
20
|
+
exports.DEFAULT_PLUGINS_ORDER = DEFAULT_PLUGINS_ORDER;
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../src/pack/plugins/index.ts"],"sourcesContent":["import { clean } from '../../rolldown-config/plugins/clean';\nimport { circulars } from './circulars';\n\n/**\n * Registry mapping plugin keys to their factory functions.\n *\n * Vite+ Pack natively handles declaration generation (`dts`), output\n * cleaning (`clean`) and dependency externals (`external`), so only the\n * circular dependencies plugin is exposed here.\n */\nexport const DEFAULT_PLUGINS = { circulars, clean } as const;\n\n/**\n * Default ordering sequence for Vite+ Pack plugins.\n */\nexport const DEFAULT_PLUGINS_ORDER = Object.keys(\n DEFAULT_PLUGINS,\n) as (keyof typeof DEFAULT_PLUGINS)[];\n"],"mappings":";;;;;;;;;;AAUA,MAAa,kBAAkB;CAAE,W,yBAAA,CAAA,CAAA;CAAW,OAAA,sCAAA;AAAM;;;;AAKlD,MAAa,wBAAwB,OAAO,KAC1C,eACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { circulars } from './circulars';
|
|
2
|
+
/**
|
|
3
|
+
* Registry mapping plugin keys to their factory functions.
|
|
4
|
+
*
|
|
5
|
+
* Vite+ Pack natively handles declaration generation (`dts`), output
|
|
6
|
+
* cleaning (`clean`) and dependency externals (`external`), so only the
|
|
7
|
+
* circular dependencies plugin is exposed here.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_PLUGINS: {
|
|
10
|
+
readonly circulars: typeof circulars;
|
|
11
|
+
readonly clean: (options: import("../../rolldown-config/plugins/clean").EndPluginOptions) => {
|
|
12
|
+
name: string;
|
|
13
|
+
onLog: {
|
|
14
|
+
handler: (this: import("rolldown").MinimalPluginContext, _: import("rolldown").LogLevel, { code, names }: import("rolldown").RolldownLog) => false | undefined;
|
|
15
|
+
};
|
|
16
|
+
closeBundle: {
|
|
17
|
+
order: "post";
|
|
18
|
+
handler: () => void;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Default ordering sequence for Vite+ Pack plugins.
|
|
24
|
+
*/
|
|
25
|
+
export declare const DEFAULT_PLUGINS_ORDER: (keyof typeof DEFAULT_PLUGINS)[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { clean } from "../../rolldown-config/plugins/clean.js";
|
|
2
|
+
import { circulars } from "./circulars.js";
|
|
3
|
+
// src/pack/plugins/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* Registry mapping plugin keys to their factory functions.
|
|
6
|
+
*
|
|
7
|
+
* Vite+ Pack natively handles declaration generation (`dts`), output
|
|
8
|
+
* cleaning (`clean`) and dependency externals (`external`), so only the
|
|
9
|
+
* circular dependencies plugin is exposed here.
|
|
10
|
+
*/
|
|
11
|
+
const DEFAULT_PLUGINS = {
|
|
12
|
+
circulars,
|
|
13
|
+
clean
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Default ordering sequence for Vite+ Pack plugins.
|
|
17
|
+
*/
|
|
18
|
+
const DEFAULT_PLUGINS_ORDER = Object.keys(DEFAULT_PLUGINS);
|
|
19
|
+
export { DEFAULT_PLUGINS, DEFAULT_PLUGINS_ORDER };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/pack/plugins/index.ts"],"sourcesContent":["import { clean } from '../../rolldown-config/plugins/clean';\nimport { circulars } from './circulars';\n\n/**\n * Registry mapping plugin keys to their factory functions.\n *\n * Vite+ Pack natively handles declaration generation (`dts`), output\n * cleaning (`clean`) and dependency externals (`external`), so only the\n * circular dependencies plugin is exposed here.\n */\nexport const DEFAULT_PLUGINS = { circulars, clean } as const;\n\n/**\n * Default ordering sequence for Vite+ Pack plugins.\n */\nexport const DEFAULT_PLUGINS_ORDER = Object.keys(\n DEFAULT_PLUGINS,\n) as (keyof typeof DEFAULT_PLUGINS)[];\n"],"mappings":";;;;;;;;;;AAUA,MAAa,kBAAkB;CAAE;CAAW;AAAM;;;;AAKlD,MAAa,wBAAwB,OAAO,KAC1C,eACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let vite_plus = require("vite-plus");
|
|
3
|
+
// src/pack/project.ts
|
|
4
|
+
/**
|
|
5
|
+
* Helper function to define a Vitest project configuration with defaults.
|
|
6
|
+
*
|
|
7
|
+
* @param conf - Vitest user workspace configuration of type {@linkcode UserWorkspaceConfig}.
|
|
8
|
+
*
|
|
9
|
+
* @returns Configured Vitest project configuration.
|
|
10
|
+
*/
|
|
11
|
+
const defineProject = (conf) => {
|
|
12
|
+
const _env = conf.test?.env ?? {};
|
|
13
|
+
return (0, vite_plus.defineProject)({
|
|
14
|
+
...conf,
|
|
15
|
+
resolve: {
|
|
16
|
+
...conf.resolve,
|
|
17
|
+
tsconfigPaths: true
|
|
18
|
+
},
|
|
19
|
+
test: {
|
|
20
|
+
...conf.test,
|
|
21
|
+
globals: true,
|
|
22
|
+
logHeapUsage: false,
|
|
23
|
+
env: {
|
|
24
|
+
NODE_ENV: "test",
|
|
25
|
+
..._env
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
exports.defineProject = defineProject;
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=project.cjs.map
|