@rzl-zone/build-tools 0.0.5
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/LICENSE +21 -0
- package/dist/.references/index.d.cts +18 -0
- package/dist/.references/index.d.ts +18 -0
- package/dist/bundler/rolldown.cjs +32 -0
- package/dist/bundler/rolldown.cjs.map +1 -0
- package/dist/bundler/rolldown.d.cts +162 -0
- package/dist/bundler/rolldown.d.ts +162 -0
- package/dist/bundler/rolldown.js +25 -0
- package/dist/bundler/rolldown.js.map +1 -0
- package/dist/bundler/tsdown.cjs +132 -0
- package/dist/bundler/tsdown.cjs.map +1 -0
- package/dist/bundler/tsdown.d.cts +1165 -0
- package/dist/bundler/tsdown.d.ts +1165 -0
- package/dist/bundler/tsdown.js +124 -0
- package/dist/bundler/tsdown.js.map +1 -0
- package/dist/bundler/utils.cjs +24 -0
- package/dist/bundler/utils.cjs.map +1 -0
- package/dist/bundler/utils.d.cts +40 -0
- package/dist/bundler/utils.d.ts +40 -0
- package/dist/bundler/utils.js +21 -0
- package/dist/bundler/utils.js.map +1 -0
- package/dist/client-XhkdKJ4d.js +160 -0
- package/dist/client-XhkdKJ4d.js.map +1 -0
- package/dist/client-u8yLSxEI.cjs +221 -0
- package/dist/client-u8yLSxEI.cjs.map +1 -0
- package/dist/commander-kit/index.cjs +569 -0
- package/dist/commander-kit/index.cjs.map +1 -0
- package/dist/commander-kit/index.d.cts +1383 -0
- package/dist/commander-kit/index.d.ts +1383 -0
- package/dist/commander-kit/index.js +550 -0
- package/dist/commander-kit/index.js.map +1 -0
- package/dist/extra-CVuXMpEw.d.ts +994 -0
- package/dist/extra-CxDwtQEy.d.cts +994 -0
- package/dist/fast-globe-options-6r2aj6UC.d.ts +126 -0
- package/dist/fast-globe-options-BFt__e__.d.cts +126 -0
- package/dist/helper-BdjaR8Yv.js +215 -0
- package/dist/helper-BdjaR8Yv.js.map +1 -0
- package/dist/helper-DorgNsB9.cjs +377 -0
- package/dist/helper-DorgNsB9.cjs.map +1 -0
- package/dist/identity-BJ0QX7AJ.js +88 -0
- package/dist/identity-BJ0QX7AJ.js.map +1 -0
- package/dist/identity-CxR9DRMh.cjs +100 -0
- package/dist/identity-CxR9DRMh.cjs.map +1 -0
- package/dist/index-B-NeF7PU.d.cts +670 -0
- package/dist/index-CzxZta4Z.d.ts +356 -0
- package/dist/index-Idak1iwg.d.cts +356 -0
- package/dist/index-PXsb85LI.d.ts +670 -0
- package/dist/index.cjs +1689 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2193 -0
- package/dist/index.d.ts +2193 -0
- package/dist/index.js +1641 -0
- package/dist/index.js.map +1 -0
- package/dist/package-banner-6RzEf-mV.cjs +54 -0
- package/dist/package-banner-6RzEf-mV.cjs.map +1 -0
- package/dist/package-banner-BzheZbxy.js +41 -0
- package/dist/package-banner-BzheZbxy.js.map +1 -0
- package/dist/server-B2hBoGDR.cjs +181 -0
- package/dist/server-B2hBoGDR.cjs.map +1 -0
- package/dist/server-CWrDd29Y.js +142 -0
- package/dist/server-CWrDd29Y.js.map +1 -0
- package/dist/utils/client.cjs +23 -0
- package/dist/utils/client.d.cts +887 -0
- package/dist/utils/client.d.ts +887 -0
- package/dist/utils/client.js +12 -0
- package/dist/utils/server.cjs +17 -0
- package/dist/utils/server.d.cts +124 -0
- package/dist/utils/server.d.ts +124 -0
- package/dist/utils/server.js +12 -0
- package/package.json +151 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rizalvin Dwiky.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the “Software”), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/build-tools
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `0.0.5`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
//! References Paths:
|
|
12
|
+
/// <reference path="../bundler/rolldown.d.cts" />
|
|
13
|
+
/// <reference path="../bundler/tsdown.d.cts" />
|
|
14
|
+
/// <reference path="../bundler/utils.d.cts" />
|
|
15
|
+
/// <reference path="../commander-kit/index.d.cts" />
|
|
16
|
+
/// <reference path="../index.d.cts" />
|
|
17
|
+
/// <reference path="../utils/client.d.cts" />
|
|
18
|
+
/// <reference path="../utils/server.d.cts" />
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/build-tools
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `0.0.5`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
//! References Paths:
|
|
12
|
+
/// <reference path="../bundler/rolldown.d.ts" />
|
|
13
|
+
/// <reference path="../bundler/tsdown.d.ts" />
|
|
14
|
+
/// <reference path="../bundler/utils.d.ts" />
|
|
15
|
+
/// <reference path="../commander-kit/index.d.ts" />
|
|
16
|
+
/// <reference path="../index.d.ts" />
|
|
17
|
+
/// <reference path="../utils/client.d.ts" />
|
|
18
|
+
/// <reference path="../utils/server.d.ts" />
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/build-tools
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `0.0.5`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
"use strict";
|
|
12
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
13
|
+
const require_helper = require('../helper-DorgNsB9.cjs');
|
|
14
|
+
const require_bundler_utils = require('./utils.cjs');
|
|
15
|
+
require("@rzl-zone/node-only");
|
|
16
|
+
let rolldown = require("rolldown");
|
|
17
|
+
rolldown = require_helper.__toESM(rolldown, 1);
|
|
18
|
+
let rolldown_plugins = require("rolldown/plugins");
|
|
19
|
+
rolldown_plugins = require_helper.__toESM(rolldown_plugins, 1);
|
|
20
|
+
const externalEsmRequirePlugin = (options) => {
|
|
21
|
+
const { external = require_bundler_utils.nodeExternalPatterns, skipDuplicateCheck = true } = options || {};
|
|
22
|
+
return rolldown_plugins.esmExternalRequirePlugin({
|
|
23
|
+
skipDuplicateCheck,
|
|
24
|
+
external
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const rolldownPlugin = rolldown_plugins;
|
|
28
|
+
const rolldown$1 = rolldown;
|
|
29
|
+
exports.externalEsmRequirePlugin = externalEsmRequirePlugin;
|
|
30
|
+
exports.rolldown = rolldown$1;
|
|
31
|
+
exports.rolldownPlugin = rolldownPlugin;
|
|
32
|
+
//# sourceMappingURL=rolldown.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rolldown.cjs","names":["nodeExternalPatterns","_rolldownPlugin","rolldown","_rolldown"],"sources":["../../src/bundler/rolldown.ts"],"sourcesContent":["import \"@rzl-zone/node-only\";\n\nimport type { NonUndefined } from \"@/_internal/types/extra\";\n\nimport * as _rolldown from \"rolldown\";\nimport * as _rolldownPlugin from \"rolldown/plugins\";\n\nimport { nodeExternalPatterns } from \"./utils\";\n\ntype Rolldown = typeof _rolldown;\ntype RolldownPlugin = typeof _rolldownPlugin;\n\ntype RolldownEsmExternalRequirePlugin =\n RolldownPlugin[\"esmExternalRequirePlugin\"];\n\ntype BuiltinPlugin = ReturnType<RolldownEsmExternalRequirePlugin>;\n\ntype EsmExternalRequirePluginOptions = NonUndefined<\n Parameters<RolldownEsmExternalRequirePlugin>[0]\n>;\n\n/** ----------------------------------------------------------------\n * * ***Esm external require plugin wrapper.***\n * ----------------------------------------------------------------\n *\n * Creates an `esmExternalRequirePlugin` instance with predefined\n * Node.js-related externals.\n *\n * This ensures that Node built-in modules are not bundled and\n * remain as runtime `require()` calls when targeting CJS/ESM hybrids.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/rolldown | **`rolldown`**} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this export\n * to resolve correctly.\n *\n * ❌ **If {@link https://github.com/rolldown/rolldown | **`rolldown`**} is not installed**, importing this module will\n * result in a **runtime module resolution error** (e.g. `Cannot find module \"rolldown\"`).\n *\n * @see {@link https://rolldown.rs/guide/getting-started#installation | **`rolldown installation guide`**.}\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Node.js only.***\n *\n * **DO NOT import this module in browser or client-side code.**\n *\n * - {@link https://github.com/rolldown/rolldown | `rolldown`} relies on Node.js–specific features such as:\n * - filesystem access.\n * - process environment variables.\n * - native module resolution.\n * ----------------------------------------------------------------\n *\n * @returns A configured `esmExternalRequirePlugin` instance.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * ```ts\n * import { defineConfig } from \"tsdown\";\n * import { externalEsmRequirePlugin } from \"@rzl-zone/build-tools/bundler-rolldown\";\n *\n * export default defineConfig({\n * plugins: [externalEsmRequirePlugin()]\n * });\n *\n * // Or\n * export default defineConfig({\n * plugins: [externalEsmRequirePlugin({\n * external: [\"react\", \"react-node\"]\n * })]\n * });\n * ```\n * @environment `node`.\n */\nexport const externalEsmRequirePlugin = (\n options?: EsmExternalRequirePluginOptions\n): BuiltinPlugin => {\n const { external = nodeExternalPatterns, skipDuplicateCheck = true } =\n options || {};\n\n return _rolldownPlugin.esmExternalRequirePlugin({\n skipDuplicateCheck,\n external\n });\n};\n\n/** ----------------------------------------------------------------\n * * ***Rolldown plugin collection (Node.js only).***\n * ----------------------------------------------------------------\n * Namespace re-export of **`rolldown/plugins`**.\n *\n * - This export acts as a **pass-through facade** and does not bundle.\n * or ship the actual plugin implementations.\n * - ***Typical use cases:***\n * - Externalization of Node built-ins.\n * - Hybrid CJS / ESM builds.\n * - Advanced bundler customization.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/rolldown | **`rolldown`**} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this export\n * to resolve correctly.\n *\n * ❌ **If {@link https://github.com/rolldown/rolldown | **`rolldown`**} is not installed**, importing this module will\n * result in a **runtime module resolution error** (e.g. `Cannot find module \"rolldown\"`).\n *\n * @see {@link https://rolldown.rs/guide/getting-started#installation | **`rolldown installation guide`**.}\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Node.js only.***\n *\n * **DO NOT import this module in browser or client-side code.**\n *\n * - {@link https://github.com/rolldown/rolldown | `rolldown`} relies on Node.js–specific features such as:\n * - filesystem access.\n * - process environment variables.\n * - native module resolution.\n * ----------------------------------------------------------------\n *\n * @see {@link https://rolldown.rs | **`https://rolldown.rs`**.}\n * @environment `node`.\n */\nexport const rolldownPlugin: RolldownPlugin = _rolldownPlugin;\n\n/** ----------------------------------------------------------------\n * * ***Rolldown bundler API (Node.js only).***\n * ----------------------------------------------------------------\n * Namespace re-export of **`rolldown`**.\n *\n * - This export acts as a **pass-through facade** and does not bundle\n * or ship the actual bundler implementation.\n * - ***Typical use cases:***\n * - Programmatic bundler configuration.\n * - Custom build pipelines.\n * - Internal tooling and CLI integrations.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/rolldown | **`rolldown`**} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this export\n * to resolve correctly.\n *\n * ❌ **If {@link https://github.com/rolldown/rolldown | **`rolldown`**} is not installed**, importing this module will\n * result in a **runtime module resolution error**\n * (e.g. `Cannot find module \"rolldown\"`).\n *\n * @see {@link https://rolldown.rs/guide/getting-started#installation | **`rolldown installation guide`**.}\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Node.js only.***\n *\n * **DO NOT import this module in browser or client-side code.**\n *\n * - {@link https://github.com/rolldown/rolldown | `rolldown`} relies on Node.js–specific features such as:\n * - filesystem access.\n * - process environment variables.\n * - native module resolution.\n * ----------------------------------------------------------------\n *\n * @see {@link https://rolldown.rs | **`https://rolldown.rs`**.}\n * @environment `node`.\n */\nexport const rolldown: Rolldown = _rolldown;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,MAAa,4BACX,YACkB;CAClB,MAAM,EAAE,WAAWA,4CAAsB,qBAAqB,SAC5D,WAAW,EAAE;AAEf,QAAOC,iBAAgB,yBAAyB;EAC9C;EACA;EACD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CJ,MAAa,iBAAiCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2C9C,MAAaC,aAAqBC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/build-tools
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `0.0.5`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { i as NonUndefined } from "../extra-CxDwtQEy.cjs";
|
|
12
|
+
import * as _rolldown from "rolldown";
|
|
13
|
+
import * as _rolldownPlugin from "rolldown/plugins";
|
|
14
|
+
|
|
15
|
+
type Rolldown = typeof _rolldown;
|
|
16
|
+
type RolldownPlugin = typeof _rolldownPlugin;
|
|
17
|
+
type RolldownEsmExternalRequirePlugin = RolldownPlugin["esmExternalRequirePlugin"];
|
|
18
|
+
type BuiltinPlugin = ReturnType<RolldownEsmExternalRequirePlugin>;
|
|
19
|
+
type EsmExternalRequirePluginOptions = NonUndefined<Parameters<RolldownEsmExternalRequirePlugin>[0]>;
|
|
20
|
+
/** ----------------------------------------------------------------
|
|
21
|
+
* * ***Esm external require plugin wrapper.***
|
|
22
|
+
* ----------------------------------------------------------------
|
|
23
|
+
*
|
|
24
|
+
* Creates an `esmExternalRequirePlugin` instance with predefined
|
|
25
|
+
* Node.js-related externals.
|
|
26
|
+
*
|
|
27
|
+
* This ensures that Node built-in modules are not bundled and
|
|
28
|
+
* remain as runtime `require()` calls when targeting CJS/ESM hybrids.
|
|
29
|
+
*
|
|
30
|
+
* ----------------------------------------------------------------
|
|
31
|
+
* ⚠️ ***Peer dependency required.***
|
|
32
|
+
*
|
|
33
|
+
* {@link https://github.com/rolldown/rolldown | **`rolldown`**} is declared as a
|
|
34
|
+
* **peer dependency** of this package.
|
|
35
|
+
*
|
|
36
|
+
* You **MUST install it explicitly** in your project for this export
|
|
37
|
+
* to resolve correctly.
|
|
38
|
+
*
|
|
39
|
+
* ❌ **If {@link https://github.com/rolldown/rolldown | **`rolldown`**} is not installed**, importing this module will
|
|
40
|
+
* result in a **runtime module resolution error** (e.g. `Cannot find module "rolldown"`).
|
|
41
|
+
*
|
|
42
|
+
* @see {@link https://rolldown.rs/guide/getting-started#installation | **`rolldown installation guide`**.}
|
|
43
|
+
*
|
|
44
|
+
* ----------------------------------------------------------------
|
|
45
|
+
* ⚠️ ***Node.js only.***
|
|
46
|
+
*
|
|
47
|
+
* **DO NOT import this module in browser or client-side code.**
|
|
48
|
+
*
|
|
49
|
+
* - {@link https://github.com/rolldown/rolldown | `rolldown`} relies on Node.js–specific features such as:
|
|
50
|
+
* - filesystem access.
|
|
51
|
+
* - process environment variables.
|
|
52
|
+
* - native module resolution.
|
|
53
|
+
* ----------------------------------------------------------------
|
|
54
|
+
*
|
|
55
|
+
* @returns A configured `esmExternalRequirePlugin` instance.
|
|
56
|
+
*
|
|
57
|
+
* ----------------------------------------------------------------
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* import { defineConfig } from "tsdown";
|
|
62
|
+
* import { externalEsmRequirePlugin } from "@rzl-zone/build-tools/bundler-rolldown";
|
|
63
|
+
*
|
|
64
|
+
* export default defineConfig({
|
|
65
|
+
* plugins: [externalEsmRequirePlugin()]
|
|
66
|
+
* });
|
|
67
|
+
*
|
|
68
|
+
* // Or
|
|
69
|
+
* export default defineConfig({
|
|
70
|
+
* plugins: [externalEsmRequirePlugin({
|
|
71
|
+
* external: ["react", "react-node"]
|
|
72
|
+
* })]
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
* @environment `node`.
|
|
76
|
+
*/
|
|
77
|
+
declare const externalEsmRequirePlugin: (options?: EsmExternalRequirePluginOptions) => BuiltinPlugin;
|
|
78
|
+
/** ----------------------------------------------------------------
|
|
79
|
+
* * ***Rolldown plugin collection (Node.js only).***
|
|
80
|
+
* ----------------------------------------------------------------
|
|
81
|
+
* Namespace re-export of **`rolldown/plugins`**.
|
|
82
|
+
*
|
|
83
|
+
* - This export acts as a **pass-through facade** and does not bundle.
|
|
84
|
+
* or ship the actual plugin implementations.
|
|
85
|
+
* - ***Typical use cases:***
|
|
86
|
+
* - Externalization of Node built-ins.
|
|
87
|
+
* - Hybrid CJS / ESM builds.
|
|
88
|
+
* - Advanced bundler customization.
|
|
89
|
+
*
|
|
90
|
+
* ----------------------------------------------------------------
|
|
91
|
+
* ⚠️ ***Peer dependency required.***
|
|
92
|
+
*
|
|
93
|
+
* {@link https://github.com/rolldown/rolldown | **`rolldown`**} is declared as a
|
|
94
|
+
* **peer dependency** of this package.
|
|
95
|
+
*
|
|
96
|
+
* You **MUST install it explicitly** in your project for this export
|
|
97
|
+
* to resolve correctly.
|
|
98
|
+
*
|
|
99
|
+
* ❌ **If {@link https://github.com/rolldown/rolldown | **`rolldown`**} is not installed**, importing this module will
|
|
100
|
+
* result in a **runtime module resolution error** (e.g. `Cannot find module "rolldown"`).
|
|
101
|
+
*
|
|
102
|
+
* @see {@link https://rolldown.rs/guide/getting-started#installation | **`rolldown installation guide`**.}
|
|
103
|
+
*
|
|
104
|
+
* ----------------------------------------------------------------
|
|
105
|
+
* ⚠️ ***Node.js only.***
|
|
106
|
+
*
|
|
107
|
+
* **DO NOT import this module in browser or client-side code.**
|
|
108
|
+
*
|
|
109
|
+
* - {@link https://github.com/rolldown/rolldown | `rolldown`} relies on Node.js–specific features such as:
|
|
110
|
+
* - filesystem access.
|
|
111
|
+
* - process environment variables.
|
|
112
|
+
* - native module resolution.
|
|
113
|
+
* ----------------------------------------------------------------
|
|
114
|
+
*
|
|
115
|
+
* @see {@link https://rolldown.rs | **`https://rolldown.rs`**.}
|
|
116
|
+
* @environment `node`.
|
|
117
|
+
*/
|
|
118
|
+
declare const rolldownPlugin: RolldownPlugin;
|
|
119
|
+
/** ----------------------------------------------------------------
|
|
120
|
+
* * ***Rolldown bundler API (Node.js only).***
|
|
121
|
+
* ----------------------------------------------------------------
|
|
122
|
+
* Namespace re-export of **`rolldown`**.
|
|
123
|
+
*
|
|
124
|
+
* - This export acts as a **pass-through facade** and does not bundle
|
|
125
|
+
* or ship the actual bundler implementation.
|
|
126
|
+
* - ***Typical use cases:***
|
|
127
|
+
* - Programmatic bundler configuration.
|
|
128
|
+
* - Custom build pipelines.
|
|
129
|
+
* - Internal tooling and CLI integrations.
|
|
130
|
+
*
|
|
131
|
+
* ----------------------------------------------------------------
|
|
132
|
+
* ⚠️ ***Peer dependency required.***
|
|
133
|
+
*
|
|
134
|
+
* {@link https://github.com/rolldown/rolldown | **`rolldown`**} is declared as a
|
|
135
|
+
* **peer dependency** of this package.
|
|
136
|
+
*
|
|
137
|
+
* You **MUST install it explicitly** in your project for this export
|
|
138
|
+
* to resolve correctly.
|
|
139
|
+
*
|
|
140
|
+
* ❌ **If {@link https://github.com/rolldown/rolldown | **`rolldown`**} is not installed**, importing this module will
|
|
141
|
+
* result in a **runtime module resolution error**
|
|
142
|
+
* (e.g. `Cannot find module "rolldown"`).
|
|
143
|
+
*
|
|
144
|
+
* @see {@link https://rolldown.rs/guide/getting-started#installation | **`rolldown installation guide`**.}
|
|
145
|
+
*
|
|
146
|
+
* ----------------------------------------------------------------
|
|
147
|
+
* ⚠️ ***Node.js only.***
|
|
148
|
+
*
|
|
149
|
+
* **DO NOT import this module in browser or client-side code.**
|
|
150
|
+
*
|
|
151
|
+
* - {@link https://github.com/rolldown/rolldown | `rolldown`} relies on Node.js–specific features such as:
|
|
152
|
+
* - filesystem access.
|
|
153
|
+
* - process environment variables.
|
|
154
|
+
* - native module resolution.
|
|
155
|
+
* ----------------------------------------------------------------
|
|
156
|
+
*
|
|
157
|
+
* @see {@link https://rolldown.rs | **`https://rolldown.rs`**.}
|
|
158
|
+
* @environment `node`.
|
|
159
|
+
*/
|
|
160
|
+
declare const rolldown: Rolldown;
|
|
161
|
+
export { externalEsmRequirePlugin, rolldown, rolldownPlugin };
|
|
162
|
+
//# sourceMappingURL=rolldown.d.cts.map
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/build-tools
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `0.0.5`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { i as NonUndefined } from "../extra-CVuXMpEw.js";
|
|
12
|
+
import * as _rolldown from "rolldown";
|
|
13
|
+
import * as _rolldownPlugin from "rolldown/plugins";
|
|
14
|
+
|
|
15
|
+
type Rolldown = typeof _rolldown;
|
|
16
|
+
type RolldownPlugin = typeof _rolldownPlugin;
|
|
17
|
+
type RolldownEsmExternalRequirePlugin = RolldownPlugin["esmExternalRequirePlugin"];
|
|
18
|
+
type BuiltinPlugin = ReturnType<RolldownEsmExternalRequirePlugin>;
|
|
19
|
+
type EsmExternalRequirePluginOptions = NonUndefined<Parameters<RolldownEsmExternalRequirePlugin>[0]>;
|
|
20
|
+
/** ----------------------------------------------------------------
|
|
21
|
+
* * ***Esm external require plugin wrapper.***
|
|
22
|
+
* ----------------------------------------------------------------
|
|
23
|
+
*
|
|
24
|
+
* Creates an `esmExternalRequirePlugin` instance with predefined
|
|
25
|
+
* Node.js-related externals.
|
|
26
|
+
*
|
|
27
|
+
* This ensures that Node built-in modules are not bundled and
|
|
28
|
+
* remain as runtime `require()` calls when targeting CJS/ESM hybrids.
|
|
29
|
+
*
|
|
30
|
+
* ----------------------------------------------------------------
|
|
31
|
+
* ⚠️ ***Peer dependency required.***
|
|
32
|
+
*
|
|
33
|
+
* {@link https://github.com/rolldown/rolldown | **`rolldown`**} is declared as a
|
|
34
|
+
* **peer dependency** of this package.
|
|
35
|
+
*
|
|
36
|
+
* You **MUST install it explicitly** in your project for this export
|
|
37
|
+
* to resolve correctly.
|
|
38
|
+
*
|
|
39
|
+
* ❌ **If {@link https://github.com/rolldown/rolldown | **`rolldown`**} is not installed**, importing this module will
|
|
40
|
+
* result in a **runtime module resolution error** (e.g. `Cannot find module "rolldown"`).
|
|
41
|
+
*
|
|
42
|
+
* @see {@link https://rolldown.rs/guide/getting-started#installation | **`rolldown installation guide`**.}
|
|
43
|
+
*
|
|
44
|
+
* ----------------------------------------------------------------
|
|
45
|
+
* ⚠️ ***Node.js only.***
|
|
46
|
+
*
|
|
47
|
+
* **DO NOT import this module in browser or client-side code.**
|
|
48
|
+
*
|
|
49
|
+
* - {@link https://github.com/rolldown/rolldown | `rolldown`} relies on Node.js–specific features such as:
|
|
50
|
+
* - filesystem access.
|
|
51
|
+
* - process environment variables.
|
|
52
|
+
* - native module resolution.
|
|
53
|
+
* ----------------------------------------------------------------
|
|
54
|
+
*
|
|
55
|
+
* @returns A configured `esmExternalRequirePlugin` instance.
|
|
56
|
+
*
|
|
57
|
+
* ----------------------------------------------------------------
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* import { defineConfig } from "tsdown";
|
|
62
|
+
* import { externalEsmRequirePlugin } from "@rzl-zone/build-tools/bundler-rolldown";
|
|
63
|
+
*
|
|
64
|
+
* export default defineConfig({
|
|
65
|
+
* plugins: [externalEsmRequirePlugin()]
|
|
66
|
+
* });
|
|
67
|
+
*
|
|
68
|
+
* // Or
|
|
69
|
+
* export default defineConfig({
|
|
70
|
+
* plugins: [externalEsmRequirePlugin({
|
|
71
|
+
* external: ["react", "react-node"]
|
|
72
|
+
* })]
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
* @environment `node`.
|
|
76
|
+
*/
|
|
77
|
+
declare const externalEsmRequirePlugin: (options?: EsmExternalRequirePluginOptions) => BuiltinPlugin;
|
|
78
|
+
/** ----------------------------------------------------------------
|
|
79
|
+
* * ***Rolldown plugin collection (Node.js only).***
|
|
80
|
+
* ----------------------------------------------------------------
|
|
81
|
+
* Namespace re-export of **`rolldown/plugins`**.
|
|
82
|
+
*
|
|
83
|
+
* - This export acts as a **pass-through facade** and does not bundle.
|
|
84
|
+
* or ship the actual plugin implementations.
|
|
85
|
+
* - ***Typical use cases:***
|
|
86
|
+
* - Externalization of Node built-ins.
|
|
87
|
+
* - Hybrid CJS / ESM builds.
|
|
88
|
+
* - Advanced bundler customization.
|
|
89
|
+
*
|
|
90
|
+
* ----------------------------------------------------------------
|
|
91
|
+
* ⚠️ ***Peer dependency required.***
|
|
92
|
+
*
|
|
93
|
+
* {@link https://github.com/rolldown/rolldown | **`rolldown`**} is declared as a
|
|
94
|
+
* **peer dependency** of this package.
|
|
95
|
+
*
|
|
96
|
+
* You **MUST install it explicitly** in your project for this export
|
|
97
|
+
* to resolve correctly.
|
|
98
|
+
*
|
|
99
|
+
* ❌ **If {@link https://github.com/rolldown/rolldown | **`rolldown`**} is not installed**, importing this module will
|
|
100
|
+
* result in a **runtime module resolution error** (e.g. `Cannot find module "rolldown"`).
|
|
101
|
+
*
|
|
102
|
+
* @see {@link https://rolldown.rs/guide/getting-started#installation | **`rolldown installation guide`**.}
|
|
103
|
+
*
|
|
104
|
+
* ----------------------------------------------------------------
|
|
105
|
+
* ⚠️ ***Node.js only.***
|
|
106
|
+
*
|
|
107
|
+
* **DO NOT import this module in browser or client-side code.**
|
|
108
|
+
*
|
|
109
|
+
* - {@link https://github.com/rolldown/rolldown | `rolldown`} relies on Node.js–specific features such as:
|
|
110
|
+
* - filesystem access.
|
|
111
|
+
* - process environment variables.
|
|
112
|
+
* - native module resolution.
|
|
113
|
+
* ----------------------------------------------------------------
|
|
114
|
+
*
|
|
115
|
+
* @see {@link https://rolldown.rs | **`https://rolldown.rs`**.}
|
|
116
|
+
* @environment `node`.
|
|
117
|
+
*/
|
|
118
|
+
declare const rolldownPlugin: RolldownPlugin;
|
|
119
|
+
/** ----------------------------------------------------------------
|
|
120
|
+
* * ***Rolldown bundler API (Node.js only).***
|
|
121
|
+
* ----------------------------------------------------------------
|
|
122
|
+
* Namespace re-export of **`rolldown`**.
|
|
123
|
+
*
|
|
124
|
+
* - This export acts as a **pass-through facade** and does not bundle
|
|
125
|
+
* or ship the actual bundler implementation.
|
|
126
|
+
* - ***Typical use cases:***
|
|
127
|
+
* - Programmatic bundler configuration.
|
|
128
|
+
* - Custom build pipelines.
|
|
129
|
+
* - Internal tooling and CLI integrations.
|
|
130
|
+
*
|
|
131
|
+
* ----------------------------------------------------------------
|
|
132
|
+
* ⚠️ ***Peer dependency required.***
|
|
133
|
+
*
|
|
134
|
+
* {@link https://github.com/rolldown/rolldown | **`rolldown`**} is declared as a
|
|
135
|
+
* **peer dependency** of this package.
|
|
136
|
+
*
|
|
137
|
+
* You **MUST install it explicitly** in your project for this export
|
|
138
|
+
* to resolve correctly.
|
|
139
|
+
*
|
|
140
|
+
* ❌ **If {@link https://github.com/rolldown/rolldown | **`rolldown`**} is not installed**, importing this module will
|
|
141
|
+
* result in a **runtime module resolution error**
|
|
142
|
+
* (e.g. `Cannot find module "rolldown"`).
|
|
143
|
+
*
|
|
144
|
+
* @see {@link https://rolldown.rs/guide/getting-started#installation | **`rolldown installation guide`**.}
|
|
145
|
+
*
|
|
146
|
+
* ----------------------------------------------------------------
|
|
147
|
+
* ⚠️ ***Node.js only.***
|
|
148
|
+
*
|
|
149
|
+
* **DO NOT import this module in browser or client-side code.**
|
|
150
|
+
*
|
|
151
|
+
* - {@link https://github.com/rolldown/rolldown | `rolldown`} relies on Node.js–specific features such as:
|
|
152
|
+
* - filesystem access.
|
|
153
|
+
* - process environment variables.
|
|
154
|
+
* - native module resolution.
|
|
155
|
+
* ----------------------------------------------------------------
|
|
156
|
+
*
|
|
157
|
+
* @see {@link https://rolldown.rs | **`https://rolldown.rs`**.}
|
|
158
|
+
* @environment `node`.
|
|
159
|
+
*/
|
|
160
|
+
declare const rolldown: Rolldown;
|
|
161
|
+
export { externalEsmRequirePlugin, rolldown, rolldownPlugin };
|
|
162
|
+
//# sourceMappingURL=rolldown.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/build-tools
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `0.0.5`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { nodeExternalPatterns } from "./utils.js";
|
|
12
|
+
import "@rzl-zone/node-only";
|
|
13
|
+
import * as _rolldown from "rolldown";
|
|
14
|
+
import * as _rolldownPlugin from "rolldown/plugins";
|
|
15
|
+
const externalEsmRequirePlugin = (options) => {
|
|
16
|
+
const { external = nodeExternalPatterns, skipDuplicateCheck = true } = options || {};
|
|
17
|
+
return _rolldownPlugin.esmExternalRequirePlugin({
|
|
18
|
+
skipDuplicateCheck,
|
|
19
|
+
external
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
const rolldownPlugin = _rolldownPlugin;
|
|
23
|
+
const rolldown = _rolldown;
|
|
24
|
+
export { externalEsmRequirePlugin, rolldown, rolldownPlugin };
|
|
25
|
+
//# sourceMappingURL=rolldown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rolldown.js","names":[],"sources":["../../src/bundler/rolldown.ts"],"sourcesContent":["import \"@rzl-zone/node-only\";\n\nimport type { NonUndefined } from \"@/_internal/types/extra\";\n\nimport * as _rolldown from \"rolldown\";\nimport * as _rolldownPlugin from \"rolldown/plugins\";\n\nimport { nodeExternalPatterns } from \"./utils\";\n\ntype Rolldown = typeof _rolldown;\ntype RolldownPlugin = typeof _rolldownPlugin;\n\ntype RolldownEsmExternalRequirePlugin =\n RolldownPlugin[\"esmExternalRequirePlugin\"];\n\ntype BuiltinPlugin = ReturnType<RolldownEsmExternalRequirePlugin>;\n\ntype EsmExternalRequirePluginOptions = NonUndefined<\n Parameters<RolldownEsmExternalRequirePlugin>[0]\n>;\n\n/** ----------------------------------------------------------------\n * * ***Esm external require plugin wrapper.***\n * ----------------------------------------------------------------\n *\n * Creates an `esmExternalRequirePlugin` instance with predefined\n * Node.js-related externals.\n *\n * This ensures that Node built-in modules are not bundled and\n * remain as runtime `require()` calls when targeting CJS/ESM hybrids.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/rolldown | **`rolldown`**} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this export\n * to resolve correctly.\n *\n * ❌ **If {@link https://github.com/rolldown/rolldown | **`rolldown`**} is not installed**, importing this module will\n * result in a **runtime module resolution error** (e.g. `Cannot find module \"rolldown\"`).\n *\n * @see {@link https://rolldown.rs/guide/getting-started#installation | **`rolldown installation guide`**.}\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Node.js only.***\n *\n * **DO NOT import this module in browser or client-side code.**\n *\n * - {@link https://github.com/rolldown/rolldown | `rolldown`} relies on Node.js–specific features such as:\n * - filesystem access.\n * - process environment variables.\n * - native module resolution.\n * ----------------------------------------------------------------\n *\n * @returns A configured `esmExternalRequirePlugin` instance.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * ```ts\n * import { defineConfig } from \"tsdown\";\n * import { externalEsmRequirePlugin } from \"@rzl-zone/build-tools/bundler-rolldown\";\n *\n * export default defineConfig({\n * plugins: [externalEsmRequirePlugin()]\n * });\n *\n * // Or\n * export default defineConfig({\n * plugins: [externalEsmRequirePlugin({\n * external: [\"react\", \"react-node\"]\n * })]\n * });\n * ```\n * @environment `node`.\n */\nexport const externalEsmRequirePlugin = (\n options?: EsmExternalRequirePluginOptions\n): BuiltinPlugin => {\n const { external = nodeExternalPatterns, skipDuplicateCheck = true } =\n options || {};\n\n return _rolldownPlugin.esmExternalRequirePlugin({\n skipDuplicateCheck,\n external\n });\n};\n\n/** ----------------------------------------------------------------\n * * ***Rolldown plugin collection (Node.js only).***\n * ----------------------------------------------------------------\n * Namespace re-export of **`rolldown/plugins`**.\n *\n * - This export acts as a **pass-through facade** and does not bundle.\n * or ship the actual plugin implementations.\n * - ***Typical use cases:***\n * - Externalization of Node built-ins.\n * - Hybrid CJS / ESM builds.\n * - Advanced bundler customization.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/rolldown | **`rolldown`**} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this export\n * to resolve correctly.\n *\n * ❌ **If {@link https://github.com/rolldown/rolldown | **`rolldown`**} is not installed**, importing this module will\n * result in a **runtime module resolution error** (e.g. `Cannot find module \"rolldown\"`).\n *\n * @see {@link https://rolldown.rs/guide/getting-started#installation | **`rolldown installation guide`**.}\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Node.js only.***\n *\n * **DO NOT import this module in browser or client-side code.**\n *\n * - {@link https://github.com/rolldown/rolldown | `rolldown`} relies on Node.js–specific features such as:\n * - filesystem access.\n * - process environment variables.\n * - native module resolution.\n * ----------------------------------------------------------------\n *\n * @see {@link https://rolldown.rs | **`https://rolldown.rs`**.}\n * @environment `node`.\n */\nexport const rolldownPlugin: RolldownPlugin = _rolldownPlugin;\n\n/** ----------------------------------------------------------------\n * * ***Rolldown bundler API (Node.js only).***\n * ----------------------------------------------------------------\n * Namespace re-export of **`rolldown`**.\n *\n * - This export acts as a **pass-through facade** and does not bundle\n * or ship the actual bundler implementation.\n * - ***Typical use cases:***\n * - Programmatic bundler configuration.\n * - Custom build pipelines.\n * - Internal tooling and CLI integrations.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/rolldown | **`rolldown`**} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this export\n * to resolve correctly.\n *\n * ❌ **If {@link https://github.com/rolldown/rolldown | **`rolldown`**} is not installed**, importing this module will\n * result in a **runtime module resolution error**\n * (e.g. `Cannot find module \"rolldown\"`).\n *\n * @see {@link https://rolldown.rs/guide/getting-started#installation | **`rolldown installation guide`**.}\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Node.js only.***\n *\n * **DO NOT import this module in browser or client-side code.**\n *\n * - {@link https://github.com/rolldown/rolldown | `rolldown`} relies on Node.js–specific features such as:\n * - filesystem access.\n * - process environment variables.\n * - native module resolution.\n * ----------------------------------------------------------------\n *\n * @see {@link https://rolldown.rs | **`https://rolldown.rs`**.}\n * @environment `node`.\n */\nexport const rolldown: Rolldown = _rolldown;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,MAAa,4BACX,YACkB;CAClB,MAAM,EAAE,WAAW,sBAAsB,qBAAqB,SAC5D,WAAW,EAAE;AAEf,QAAO,gBAAgB,yBAAyB;EAC9C;EACA;EACD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CJ,MAAa,iBAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2C9C,MAAa,WAAqB"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/build-tools
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `0.0.5`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
"use strict";
|
|
12
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
13
|
+
const require_helper = require('../helper-DorgNsB9.cjs');
|
|
14
|
+
const require_package_banner = require('../package-banner-6RzEf-mV.cjs');
|
|
15
|
+
require("@rzl-zone/node-only");
|
|
16
|
+
let semver = require("semver");
|
|
17
|
+
semver = require_helper.__toESM(semver, 1);
|
|
18
|
+
let tsdown = require("tsdown");
|
|
19
|
+
tsdown = require_helper.__toESM(tsdown, 1);
|
|
20
|
+
function resolveTsdownCompat(version) {
|
|
21
|
+
if (typeof version !== "string") return {
|
|
22
|
+
useOnlyBundle: true,
|
|
23
|
+
useOnlyAllowBundle: false,
|
|
24
|
+
allowInlineOnly: false
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
useOnlyBundle: semver.default.gte(version, "0.21.2"),
|
|
28
|
+
useOnlyAllowBundle: semver.default.lt(version, "0.21.2"),
|
|
29
|
+
allowInlineOnly: semver.default.lt(version, "0.21.0")
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const BASE_DEFAULT_CONFIG = {
|
|
33
|
+
dts: true,
|
|
34
|
+
minify: false,
|
|
35
|
+
clean: ["dist/*"],
|
|
36
|
+
sourcemap: true,
|
|
37
|
+
format: ["cjs", "esm"],
|
|
38
|
+
banner: void 0,
|
|
39
|
+
fixedExtension: false
|
|
40
|
+
};
|
|
41
|
+
let _cachedCompat = null;
|
|
42
|
+
async function getTsdownCompat() {
|
|
43
|
+
if (_cachedCompat) return _cachedCompat;
|
|
44
|
+
const pkg = await require_package_banner.getPackageJson();
|
|
45
|
+
const raw = pkg.dependencies?.tsdown || pkg.devDependencies?.tsdown || pkg.peerDependencies?.tsdown;
|
|
46
|
+
_cachedCompat = resolveTsdownCompat(raw ? semver.default.coerce(raw)?.version : void 0);
|
|
47
|
+
return _cachedCompat;
|
|
48
|
+
}
|
|
49
|
+
async function createInternalDefaultConfig() {
|
|
50
|
+
const defaultBanner = await require_package_banner.generatePackageBanner();
|
|
51
|
+
const compat = await getTsdownCompat();
|
|
52
|
+
return {
|
|
53
|
+
...BASE_DEFAULT_CONFIG,
|
|
54
|
+
...compat.allowInlineOnly && { inlineOnly: false },
|
|
55
|
+
deps: {
|
|
56
|
+
...compat.useOnlyBundle && { onlyBundle: false },
|
|
57
|
+
...compat.useOnlyAllowBundle && { onlyAllowBundle: false }
|
|
58
|
+
},
|
|
59
|
+
banner: defaultBanner
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const isDisableBanner = (banner) => {
|
|
63
|
+
return banner === false;
|
|
64
|
+
};
|
|
65
|
+
async function resolveDefaultConfig(options) {
|
|
66
|
+
const resolved = await Promise.resolve(options);
|
|
67
|
+
const _BASE_DEFAULT_CONFIG = await createInternalDefaultConfig();
|
|
68
|
+
async function mergeDefaultConfig(input) {
|
|
69
|
+
const resolvedList = await Promise.all(require_helper.toArray(input));
|
|
70
|
+
const data = [];
|
|
71
|
+
for (const opts of resolvedList) {
|
|
72
|
+
if (!opts || typeof opts !== "object") continue;
|
|
73
|
+
data.push({
|
|
74
|
+
..._BASE_DEFAULT_CONFIG,
|
|
75
|
+
...opts,
|
|
76
|
+
banner: isDisableBanner(opts.banner) ? void 0 : opts.banner ?? _BASE_DEFAULT_CONFIG.banner
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return data;
|
|
80
|
+
}
|
|
81
|
+
if (require_helper.isFunction(resolved)) return async (inline, ctx) => {
|
|
82
|
+
const next = await resolved(inline, ctx);
|
|
83
|
+
if (require_helper.isFunction(next)) throw new Error("resolveDefaultConfig(): Nested resolver functions are not supported.");
|
|
84
|
+
return await mergeDefaultConfig(next);
|
|
85
|
+
};
|
|
86
|
+
if (require_helper.isArray(resolved)) {
|
|
87
|
+
if (resolved.length === 0) return [_BASE_DEFAULT_CONFIG];
|
|
88
|
+
return mergeDefaultConfig(resolved);
|
|
89
|
+
}
|
|
90
|
+
if (resolved) return {
|
|
91
|
+
..._BASE_DEFAULT_CONFIG,
|
|
92
|
+
...resolved,
|
|
93
|
+
banner: isDisableBanner(resolved.banner) ? void 0 : resolved.banner ?? _BASE_DEFAULT_CONFIG.banner
|
|
94
|
+
};
|
|
95
|
+
return _BASE_DEFAULT_CONFIG;
|
|
96
|
+
}
|
|
97
|
+
const createDefaultConfig = async (options) => {
|
|
98
|
+
const base = await createInternalDefaultConfig();
|
|
99
|
+
const finalBanner = isDisableBanner(options.banner) ? void 0 : options.banner ?? base.banner;
|
|
100
|
+
return {
|
|
101
|
+
...base,
|
|
102
|
+
...options,
|
|
103
|
+
deps: {
|
|
104
|
+
...base.deps,
|
|
105
|
+
...options.deps
|
|
106
|
+
},
|
|
107
|
+
banner: finalBanner
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
const tsdown$1 = tsdown;
|
|
111
|
+
function applyWarningFilter(patterns, options) {
|
|
112
|
+
const DEFAULT_PATTERNS = [];
|
|
113
|
+
if (options?.includeMissingExportWarning ?? true) DEFAULT_PATTERNS.push("[MISSING_EXPORT] Warning");
|
|
114
|
+
if (options?.includePluginTimingsWarning ?? true) DEFAULT_PATTERNS.push("[PLUGIN_TIMINGS] Warning");
|
|
115
|
+
const safePatterns = (patterns ?? []).filter((p) => typeof p === "string").map((p) => p.trim()).filter((p) => p.length > 0);
|
|
116
|
+
const finalPatterns = Array.from(new Set([...DEFAULT_PATTERNS, ...safePatterns]));
|
|
117
|
+
const orig = process.stderr.write.bind(process.stderr);
|
|
118
|
+
process.stderr.write = ((...args) => {
|
|
119
|
+
const [chunk] = args;
|
|
120
|
+
let text = "";
|
|
121
|
+
if (typeof chunk === "string") text = chunk;
|
|
122
|
+
else if (Buffer.isBuffer(chunk)) text = chunk.toString("utf8");
|
|
123
|
+
if (finalPatterns.some((p) => text.includes(p))) return true;
|
|
124
|
+
return orig(...args);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
exports.BASE_DEFAULT_CONFIG = BASE_DEFAULT_CONFIG;
|
|
128
|
+
exports.applyWarningFilter = applyWarningFilter;
|
|
129
|
+
exports.createDefaultConfig = createDefaultConfig;
|
|
130
|
+
exports.resolveDefaultConfig = resolveDefaultConfig;
|
|
131
|
+
exports.tsdown = tsdown$1;
|
|
132
|
+
//# sourceMappingURL=tsdown.cjs.map
|