@powerlines/unplugin 0.0.76 → 0.0.78
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/dist/astro.cjs +0 -19
- package/dist/astro.d.mts +0 -2
- package/dist/astro.d.mts.map +1 -1
- package/dist/astro.mjs +1 -14
- package/dist/astro.mjs.map +1 -1
- package/dist/{_virtual/_rolldown/runtime.mjs → chunk-BUUfjzRC.mjs} +1 -9
- package/dist/esbuild.cjs +2 -11
- package/dist/esbuild.d.cts +2 -2
- package/dist/esbuild.d.cts.map +1 -1
- package/dist/esbuild.d.mts +1 -3
- package/dist/esbuild.d.mts.map +1 -1
- package/dist/esbuild.mjs +0 -8
- package/dist/esbuild.mjs.map +1 -1
- package/dist/farm.cjs +2 -21
- package/dist/farm.d.cts +2 -2
- package/dist/farm.d.cts.map +1 -1
- package/dist/farm.d.mts +1 -3
- package/dist/farm.d.mts.map +1 -1
- package/dist/farm.mjs +1 -14
- package/dist/farm.mjs.map +1 -1
- package/dist/index.cjs +4 -14
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +0 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -12
- package/dist/index.mjs.map +1 -1
- package/dist/next.cjs +1 -20
- package/dist/next.d.mts +0 -2
- package/dist/next.d.mts.map +1 -1
- package/dist/next.mjs +1 -14
- package/dist/next.mjs.map +1 -1
- package/dist/nuxt-DkXJSxfm.mjs +48 -0
- package/dist/nuxt-DkXJSxfm.mjs.map +1 -0
- package/dist/nuxt-m9vkfvXK.cjs +52 -0
- package/dist/nuxt.cjs +3 -59
- package/dist/nuxt.d.mts +0 -2
- package/dist/nuxt.d.mts.map +1 -1
- package/dist/nuxt.mjs +3 -53
- package/dist/rolldown.cjs +6 -27
- package/dist/rolldown.d.cts +2 -2
- package/dist/rolldown.d.cts.map +1 -1
- package/dist/rolldown.d.mts +1 -3
- package/dist/rolldown.d.mts.map +1 -1
- package/dist/rolldown.mjs +1 -16
- package/dist/rolldown.mjs.map +1 -1
- package/dist/rollup.cjs +7 -29
- package/dist/rollup.d.cts +2 -2
- package/dist/rollup.d.cts.map +1 -1
- package/dist/rollup.d.mts +1 -3
- package/dist/rollup.d.mts.map +1 -1
- package/dist/rollup.mjs +1 -17
- package/dist/rollup.mjs.map +1 -1
- package/dist/rspack.cjs +3 -24
- package/dist/rspack.d.cts +2 -2
- package/dist/rspack.d.cts.map +1 -1
- package/dist/rspack.d.mts +1 -3
- package/dist/rspack.d.mts.map +1 -1
- package/dist/rspack.mjs +1 -16
- package/dist/rspack.mjs.map +1 -1
- package/dist/tsdown.cjs +3 -26
- package/dist/tsdown.d.mts +0 -2
- package/dist/tsdown.d.mts.map +1 -1
- package/dist/tsdown.mjs +1 -19
- package/dist/tsdown.mjs.map +1 -1
- package/dist/tsup.cjs +3 -24
- package/dist/tsup.d.mts +0 -2
- package/dist/tsup.d.mts.map +1 -1
- package/dist/tsup.mjs +1 -17
- package/dist/tsup.mjs.map +1 -1
- package/dist/types-CEaXoKbk.d.cts +13 -0
- package/dist/types-CEaXoKbk.d.cts.map +1 -0
- package/dist/types.cjs +0 -21
- package/dist/types.d.cts +2 -11
- package/dist/types.d.mts +0 -2
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +1 -16
- package/dist/unloader.cjs +2 -22
- package/dist/unloader.d.cts +2 -2
- package/dist/unloader.d.cts.map +1 -1
- package/dist/unloader.d.mts +1 -3
- package/dist/unloader.d.mts.map +1 -1
- package/dist/unloader.mjs +1 -15
- package/dist/unloader.mjs.map +1 -1
- package/dist/unplugin-WjPT9ECw.cjs +296 -0
- package/dist/unplugin.cjs +2 -248
- package/dist/unplugin.d.cts +1 -1
- package/dist/unplugin.d.cts.map +1 -1
- package/dist/unplugin.d.mts +0 -2
- package/dist/unplugin.d.mts.map +1 -1
- package/dist/unplugin.mjs +2 -13
- package/dist/unplugin.mjs.map +1 -1
- package/dist/vite.cjs +2 -11
- package/dist/vite.d.cts +2 -2
- package/dist/vite.d.cts.map +1 -1
- package/dist/vite.d.mts +1 -3
- package/dist/vite.d.mts.map +1 -1
- package/dist/vite.mjs +0 -8
- package/dist/vite.mjs.map +1 -1
- package/dist/webpack.cjs +3 -24
- package/dist/webpack.d.cts +2 -2
- package/dist/webpack.d.cts.map +1 -1
- package/dist/webpack.d.mts +1 -3
- package/dist/webpack.d.mts.map +1 -1
- package/dist/webpack.mjs +1 -16
- package/dist/webpack.mjs.map +1 -1
- package/package.json +12 -76
- package/dist/_virtual/_rolldown/runtime.cjs +0 -53
- package/dist/astro.test.cjs +0 -23
- package/dist/astro.test.d.cts +0 -1
- package/dist/astro.test.d.mts +0 -2
- package/dist/astro.test.mjs +0 -25
- package/dist/astro.test.mjs.map +0 -1
- package/dist/esbuild.test.cjs +0 -32
- package/dist/esbuild.test.d.cts +0 -1
- package/dist/esbuild.test.d.mts +0 -2
- package/dist/esbuild.test.mjs +0 -34
- package/dist/esbuild.test.mjs.map +0 -1
- package/dist/farm.test.cjs +0 -23
- package/dist/farm.test.d.cts +0 -1
- package/dist/farm.test.d.mts +0 -2
- package/dist/farm.test.mjs +0 -25
- package/dist/farm.test.mjs.map +0 -1
- package/dist/index.test.cjs +0 -35
- package/dist/index.test.d.cts +0 -1
- package/dist/index.test.d.mts +0 -2
- package/dist/index.test.mjs +0 -37
- package/dist/index.test.mjs.map +0 -1
- package/dist/next.test.cjs +0 -23
- package/dist/next.test.d.cts +0 -1
- package/dist/next.test.d.mts +0 -2
- package/dist/next.test.mjs +0 -25
- package/dist/next.test.mjs.map +0 -1
- package/dist/nuxt.mjs.map +0 -1
- package/dist/nuxt.test.cjs +0 -23
- package/dist/nuxt.test.d.cts +0 -1
- package/dist/nuxt.test.d.mts +0 -2
- package/dist/nuxt.test.mjs +0 -25
- package/dist/nuxt.test.mjs.map +0 -1
- package/dist/package.cjs +0 -26
- package/dist/package.mjs +0 -15
- package/dist/package.mjs.map +0 -1
- package/dist/rolldown.test.cjs +0 -23
- package/dist/rolldown.test.d.cts +0 -1
- package/dist/rolldown.test.d.mts +0 -2
- package/dist/rolldown.test.mjs +0 -25
- package/dist/rolldown.test.mjs.map +0 -1
- package/dist/rollup.test.cjs +0 -23
- package/dist/rollup.test.d.cts +0 -1
- package/dist/rollup.test.d.mts +0 -2
- package/dist/rollup.test.mjs +0 -25
- package/dist/rollup.test.mjs.map +0 -1
- package/dist/rspack.test.cjs +0 -23
- package/dist/rspack.test.d.cts +0 -1
- package/dist/rspack.test.d.mts +0 -2
- package/dist/rspack.test.mjs +0 -25
- package/dist/rspack.test.mjs.map +0 -1
- package/dist/tsdown.test.cjs +0 -23
- package/dist/tsdown.test.d.cts +0 -1
- package/dist/tsdown.test.d.mts +0 -2
- package/dist/tsdown.test.mjs +0 -25
- package/dist/tsdown.test.mjs.map +0 -1
- package/dist/tsup.test.cjs +0 -23
- package/dist/tsup.test.d.cts +0 -1
- package/dist/tsup.test.d.mts +0 -2
- package/dist/tsup.test.mjs +0 -25
- package/dist/tsup.test.mjs.map +0 -1
- package/dist/types.d.cts.map +0 -1
- package/dist/types.mjs.map +0 -1
- package/dist/types.test.cjs +0 -23
- package/dist/types.test.d.cts +0 -1
- package/dist/types.test.d.mts +0 -2
- package/dist/types.test.mjs +0 -25
- package/dist/types.test.mjs.map +0 -1
- package/dist/unloader.test.cjs +0 -23
- package/dist/unloader.test.d.cts +0 -1
- package/dist/unloader.test.d.mts +0 -2
- package/dist/unloader.test.mjs +0 -25
- package/dist/unloader.test.mjs.map +0 -1
- package/dist/unplugin.test.cjs +0 -23
- package/dist/unplugin.test.d.cts +0 -1
- package/dist/unplugin.test.d.mts +0 -2
- package/dist/unplugin.test.mjs +0 -25
- package/dist/unplugin.test.mjs.map +0 -1
- package/dist/vite.test.cjs +0 -26
- package/dist/vite.test.d.cts +0 -1
- package/dist/vite.test.d.mts +0 -2
- package/dist/vite.test.mjs +0 -28
- package/dist/vite.test.mjs.map +0 -1
- package/dist/webpack.test.cjs +0 -23
- package/dist/webpack.test.d.cts +0 -1
- package/dist/webpack.test.d.mts +0 -2
- package/dist/webpack.test.mjs +0 -25
- package/dist/webpack.test.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nuxt-DkXJSxfm.mjs","names":["vite","webpack"],"sources":["../package.json","../src/nuxt.ts"],"sourcesContent":["","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { addVitePlugin, addWebpackPlugin, defineNuxtModule } from \"@nuxt/kit\";\nimport type { UserConfig } from \"@powerlines/core\";\nimport { name, version } from \"../package.json\";\nimport vite from \"./vite\";\nimport webpack from \"./webpack\";\n\n/**\n * A Nuxt plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://nuxt.com/docs/guide/directory-structure/modules\n *\n * @example\n * ```ts\n * // nuxt.config.ts\n * import { defineNuxtConfig } from \"@nuxt/kit\";\n *\n * export default defineNuxtConfig({\n * modules: [\n * [\n * \"@powerlines/unplugin/nuxt\",\n * { name: \"example-app\", ... }\n * ],\n * ],\n * });\n *\n * ```\n */\nconst plugin = defineNuxtModule<UserConfig>({\n meta: {\n name,\n version,\n configKey: \"powerlines\",\n compatibility: {\n builder: {\n vite: \"^8.0.0\"\n }\n }\n },\n defaults: {},\n setup(options) {\n addVitePlugin(() => vite(options));\n addWebpackPlugin(() => webpack(options));\n }\n});\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC6CA,MAAM,SAAS,iBAA6B;CAC1C,MAAM;EACJ;EACA;EACA,WAAW;EACX,eAAe,EACb,SAAS,EACP,MAAM,SACR,EACF;CACF;CACA,UAAU,CAAC;CACX,MAAM,SAAS;EACb,oBAAoBA,SAAK,OAAO,CAAC;EACjC,uBAAuBC,SAAQ,OAAO,CAAC;CACzC;AACF,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const require_vite = require('./vite.cjs');
|
|
2
|
+
const require_webpack = require('./webpack.cjs');
|
|
3
|
+
let _nuxt_kit = require("@nuxt/kit");
|
|
4
|
+
|
|
5
|
+
//#region package.json
|
|
6
|
+
var name = "@powerlines/unplugin";
|
|
7
|
+
var version = "0.0.77";
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/nuxt.ts
|
|
11
|
+
/**
|
|
12
|
+
* A Nuxt plugin that will invoke the Powerlines API hooks during the build process.
|
|
13
|
+
*
|
|
14
|
+
* @see https://nuxt.com/docs/guide/directory-structure/modules
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* // nuxt.config.ts
|
|
19
|
+
* import { defineNuxtConfig } from "@nuxt/kit";
|
|
20
|
+
*
|
|
21
|
+
* export default defineNuxtConfig({
|
|
22
|
+
* modules: [
|
|
23
|
+
* [
|
|
24
|
+
* "@powerlines/unplugin/nuxt",
|
|
25
|
+
* { name: "example-app", ... }
|
|
26
|
+
* ],
|
|
27
|
+
* ],
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
const plugin = (0, _nuxt_kit.defineNuxtModule)({
|
|
33
|
+
meta: {
|
|
34
|
+
name,
|
|
35
|
+
version,
|
|
36
|
+
configKey: "powerlines",
|
|
37
|
+
compatibility: { builder: { vite: "^8.0.0" } }
|
|
38
|
+
},
|
|
39
|
+
defaults: {},
|
|
40
|
+
setup(options) {
|
|
41
|
+
(0, _nuxt_kit.addVitePlugin)(() => require_vite.default(options));
|
|
42
|
+
(0, _nuxt_kit.addWebpackPlugin)(() => require_webpack.default(options));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
Object.defineProperty(exports, 'plugin', {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () {
|
|
50
|
+
return plugin;
|
|
51
|
+
}
|
|
52
|
+
});
|
package/dist/nuxt.cjs
CHANGED
|
@@ -1,60 +1,4 @@
|
|
|
1
|
+
require('./vite.cjs');
|
|
2
|
+
const require_nuxt = require('./nuxt-m9vkfvXK.cjs');
|
|
1
3
|
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
|
-
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
11
|
-
const require_vite = require('./vite.cjs');
|
|
12
|
-
const require_webpack = require('./webpack.cjs');
|
|
13
|
-
const require_package = require('./package.cjs');
|
|
14
|
-
let _nuxt_kit = require("@nuxt/kit");
|
|
15
|
-
|
|
16
|
-
//#region src/nuxt.ts
|
|
17
|
-
var nuxt_exports = /* @__PURE__ */ require_runtime.__exportAll({ default: () => plugin });
|
|
18
|
-
/**
|
|
19
|
-
* A Nuxt plugin that will invoke the Powerlines API hooks during the build process.
|
|
20
|
-
*
|
|
21
|
-
* @see https://nuxt.com/docs/guide/directory-structure/modules
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```ts
|
|
25
|
-
* // nuxt.config.ts
|
|
26
|
-
* import { defineNuxtConfig } from "@nuxt/kit";
|
|
27
|
-
*
|
|
28
|
-
* export default defineNuxtConfig({
|
|
29
|
-
* modules: [
|
|
30
|
-
* [
|
|
31
|
-
* "@powerlines/unplugin/nuxt",
|
|
32
|
-
* { name: "example-app", ... }
|
|
33
|
-
* ],
|
|
34
|
-
* ],
|
|
35
|
-
* });
|
|
36
|
-
*
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
const plugin = (0, _nuxt_kit.defineNuxtModule)({
|
|
40
|
-
meta: {
|
|
41
|
-
name: require_package.name,
|
|
42
|
-
version: require_package.version,
|
|
43
|
-
configKey: "powerlines",
|
|
44
|
-
compatibility: { builder: { vite: "^8.0.0" } }
|
|
45
|
-
},
|
|
46
|
-
defaults: {},
|
|
47
|
-
setup(options) {
|
|
48
|
-
(0, _nuxt_kit.addVitePlugin)(() => require_vite.default(options));
|
|
49
|
-
(0, _nuxt_kit.addWebpackPlugin)(() => require_webpack.default(options));
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
//#endregion
|
|
54
|
-
exports.default = plugin;
|
|
55
|
-
Object.defineProperty(exports, 'nuxt_exports', {
|
|
56
|
-
enumerable: true,
|
|
57
|
-
get: function () {
|
|
58
|
-
return nuxt_exports;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
4
|
+
module.exports = require_nuxt.plugin;
|
package/dist/nuxt.d.mts
CHANGED
package/dist/nuxt.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt.d.mts","names":[],"sources":["../src/nuxt.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"nuxt.d.mts","names":[],"sources":["../src/nuxt.ts"],"mappings":";;;;;AAmBmD;;;;;;;;AA0BvC;;;;;;;;;;;cAAN,MAAA,yBAAM,UAAA,CAAA,UAAA,EAAA,UAAA"}
|
package/dist/nuxt.mjs
CHANGED
|
@@ -1,54 +1,4 @@
|
|
|
1
|
+
import "./vite.mjs";
|
|
2
|
+
import { t as plugin } from "./nuxt-DkXJSxfm.mjs";
|
|
1
3
|
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
|
-
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
10
|
-
import plugin$1 from "./vite.mjs";
|
|
11
|
-
import plugin$2 from "./webpack.mjs";
|
|
12
|
-
import { name, version } from "./package.mjs";
|
|
13
|
-
import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
|
|
14
|
-
|
|
15
|
-
//#region src/nuxt.ts
|
|
16
|
-
var nuxt_exports = /* @__PURE__ */ __exportAll({ default: () => plugin });
|
|
17
|
-
/**
|
|
18
|
-
* A Nuxt plugin that will invoke the Powerlines API hooks during the build process.
|
|
19
|
-
*
|
|
20
|
-
* @see https://nuxt.com/docs/guide/directory-structure/modules
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* // nuxt.config.ts
|
|
25
|
-
* import { defineNuxtConfig } from "@nuxt/kit";
|
|
26
|
-
*
|
|
27
|
-
* export default defineNuxtConfig({
|
|
28
|
-
* modules: [
|
|
29
|
-
* [
|
|
30
|
-
* "@powerlines/unplugin/nuxt",
|
|
31
|
-
* { name: "example-app", ... }
|
|
32
|
-
* ],
|
|
33
|
-
* ],
|
|
34
|
-
* });
|
|
35
|
-
*
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
const plugin = defineNuxtModule({
|
|
39
|
-
meta: {
|
|
40
|
-
name,
|
|
41
|
-
version,
|
|
42
|
-
configKey: "powerlines",
|
|
43
|
-
compatibility: { builder: { vite: "^8.0.0" } }
|
|
44
|
-
},
|
|
45
|
-
defaults: {},
|
|
46
|
-
setup(options) {
|
|
47
|
-
addVitePlugin(() => plugin$1(options));
|
|
48
|
-
addWebpackPlugin(() => plugin$2(options));
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
//#endregion
|
|
53
|
-
export { plugin as default, nuxt_exports };
|
|
54
|
-
//# sourceMappingURL=nuxt.mjs.map
|
|
4
|
+
export { plugin as default };
|
package/dist/rolldown.cjs
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
|
-
const
|
|
11
|
-
const require_unplugin = require('./unplugin.cjs');
|
|
2
|
+
const require_unplugin = require('./unplugin-WjPT9ECw.cjs');
|
|
12
3
|
let _stryke_path_append = require("@stryke/path/append");
|
|
13
4
|
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
14
5
|
let defu = require("defu");
|
|
@@ -16,25 +7,19 @@ let unplugin = require("unplugin");
|
|
|
16
7
|
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
17
8
|
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
18
9
|
let _rollup_plugin_inject = require("@rollup/plugin-inject");
|
|
19
|
-
_rollup_plugin_inject =
|
|
10
|
+
_rollup_plugin_inject = require_unplugin.__toESM(_rollup_plugin_inject, 1);
|
|
20
11
|
let _rollup_plugin_node_resolve = require("@rollup/plugin-node-resolve");
|
|
21
|
-
_rollup_plugin_node_resolve =
|
|
12
|
+
_rollup_plugin_node_resolve = require_unplugin.__toESM(_rollup_plugin_node_resolve, 1);
|
|
22
13
|
let _rollup_plugin_replace = require("@rollup/plugin-replace");
|
|
23
|
-
_rollup_plugin_replace =
|
|
14
|
+
_rollup_plugin_replace = require_unplugin.__toESM(_rollup_plugin_replace, 1);
|
|
24
15
|
let glob = require("glob");
|
|
25
16
|
let node_module = require("node:module");
|
|
26
17
|
let rolldown_plugin_dts = require("rolldown-plugin-dts");
|
|
27
18
|
let rolldown_experimental = require("rolldown/experimental");
|
|
28
19
|
let rollup_plugin_typescript2 = require("rollup-plugin-typescript2");
|
|
29
|
-
rollup_plugin_typescript2 =
|
|
20
|
+
rollup_plugin_typescript2 = require_unplugin.__toESM(rollup_plugin_typescript2, 1);
|
|
30
21
|
|
|
31
22
|
//#region src/rolldown.ts
|
|
32
|
-
var rolldown_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
33
|
-
DEFAULT_OPTIONS: () => DEFAULT_OPTIONS,
|
|
34
|
-
createRolldownFactory: () => createRolldownFactory,
|
|
35
|
-
default: () => plugin,
|
|
36
|
-
resolveOptions: () => resolveOptions
|
|
37
|
-
});
|
|
38
23
|
const DEFAULT_OPTIONS = {
|
|
39
24
|
keepNames: true,
|
|
40
25
|
treeshake: true,
|
|
@@ -217,10 +202,4 @@ const plugin = (0, unplugin.createRolldownPlugin)(createRolldownFactory());
|
|
|
217
202
|
exports.DEFAULT_OPTIONS = DEFAULT_OPTIONS;
|
|
218
203
|
exports.createRolldownFactory = createRolldownFactory;
|
|
219
204
|
exports.default = plugin;
|
|
220
|
-
exports.resolveOptions = resolveOptions;
|
|
221
|
-
Object.defineProperty(exports, 'rolldown_exports', {
|
|
222
|
-
enumerable: true,
|
|
223
|
-
get: function () {
|
|
224
|
-
return rolldown_exports;
|
|
225
|
-
}
|
|
226
|
-
});
|
|
205
|
+
exports.resolveOptions = resolveOptions;
|
package/dist/rolldown.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as UnpluginFactory, t as UnpluginExecutionOptions } from "./types-CEaXoKbk.cjs";
|
|
2
2
|
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.cjs";
|
|
3
3
|
import { ExecutionContext, UnresolvedContext } from "@powerlines/core";
|
|
4
4
|
import { Plugin, RolldownOptions } from "rolldown";
|
|
@@ -41,7 +41,7 @@ declare function resolveOptions<TContext extends UnresolvedContext>(context: TCo
|
|
|
41
41
|
* @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.
|
|
42
42
|
* @returns A function that generates a Rolldown plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rolldown build.
|
|
43
43
|
*/
|
|
44
|
-
declare function createRolldownFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
|
|
44
|
+
declare function createRolldownFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig<import("@powerlines/core").UserConfig, import("@powerlines/core").ExecutionOptions>, any>>;
|
|
45
45
|
/**
|
|
46
46
|
* A Rolldown plugin that will invoke the Powerlines API hooks during the build process.
|
|
47
47
|
*
|
package/dist/rolldown.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rolldown.d.cts","names":[],"sources":["../src/rolldown.ts"],"mappings":";;;;;;cA6Ca,eAAA;;;;;;;;;;;;;AAeb;iBAAgB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,eAAA;;;;;;;;;;;;;AAAe;AA4PlB;;;;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,EACrD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA
|
|
1
|
+
{"version":3,"file":"rolldown.d.cts","names":[],"sources":["../src/rolldown.ts"],"mappings":";;;;;;cA6Ca,eAAA;;;;;;;;;;;;;AAeb;iBAAgB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,eAAA;;;;;;;;;;;;;AAAe;AA4PlB;;;;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,EACrD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA,4BAAA,UAAA,6BAAA,gBAAA;;;;;;;;;;;;;;;;cAuC7D,MAAA,GAAM,OAAA,GAAgD,wBAAA,iBAAhD,MAAA,QAAA,MAAA"}
|
package/dist/rolldown.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import __tsdown_shims_path from 'node:path';
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
1
|
import { UnpluginExecutionOptions, UnpluginFactory } from "./types.mjs";
|
|
4
2
|
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.mjs";
|
|
5
3
|
import { ExecutionContext, UnresolvedContext } from "@powerlines/core";
|
|
@@ -43,7 +41,7 @@ declare function resolveOptions<TContext extends UnresolvedContext>(context: TCo
|
|
|
43
41
|
* @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.
|
|
44
42
|
* @returns A function that generates a Rolldown plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rolldown build.
|
|
45
43
|
*/
|
|
46
|
-
declare function createRolldownFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
|
|
44
|
+
declare function createRolldownFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig<import("@powerlines/core").UserConfig, import("@powerlines/core").ExecutionOptions>, any>>;
|
|
47
45
|
/**
|
|
48
46
|
* A Rolldown plugin that will invoke the Powerlines API hooks during the build process.
|
|
49
47
|
*
|
package/dist/rolldown.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rolldown.d.mts","names":[],"sources":["../src/rolldown.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"rolldown.d.mts","names":[],"sources":["../src/rolldown.ts"],"mappings":";;;;;;cA6Ca,eAAA;;;;;;;;;;;;;AAeb;iBAAgB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,eAAA;;;;;;;;;;;;;AAAe;AA4PlB;;;;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,EACrD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA,4BAAA,UAAA,6BAAA,gBAAA;;;;;;;;;;;;;;;;cAuC7D,MAAA,GAAM,OAAA,GAAgD,wBAAA,iBAAhD,MAAA,QAAA,MAAA"}
|
package/dist/rolldown.mjs
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
|
-
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
10
1
|
import { createUnpluginFactory } from "./unplugin.mjs";
|
|
11
2
|
import { builtinModules } from "node:module";
|
|
12
3
|
import { appendPath } from "@stryke/path/append";
|
|
@@ -24,12 +15,6 @@ import { viteAliasPlugin } from "rolldown/experimental";
|
|
|
24
15
|
import typescriptPlugin from "rollup-plugin-typescript2";
|
|
25
16
|
|
|
26
17
|
//#region src/rolldown.ts
|
|
27
|
-
var rolldown_exports = /* @__PURE__ */ __exportAll({
|
|
28
|
-
DEFAULT_OPTIONS: () => DEFAULT_OPTIONS,
|
|
29
|
-
createRolldownFactory: () => createRolldownFactory,
|
|
30
|
-
default: () => plugin,
|
|
31
|
-
resolveOptions: () => resolveOptions
|
|
32
|
-
});
|
|
33
18
|
const DEFAULT_OPTIONS = {
|
|
34
19
|
keepNames: true,
|
|
35
20
|
treeshake: true,
|
|
@@ -209,5 +194,5 @@ function createRolldownFactory(options = {}, decorate = (options) => options) {
|
|
|
209
194
|
const plugin = createRolldownPlugin(createRolldownFactory());
|
|
210
195
|
|
|
211
196
|
//#endregion
|
|
212
|
-
export { DEFAULT_OPTIONS, createRolldownFactory, plugin as default, resolveOptions
|
|
197
|
+
export { DEFAULT_OPTIONS, createRolldownFactory, plugin as default, resolveOptions };
|
|
213
198
|
//# sourceMappingURL=rolldown.mjs.map
|
package/dist/rolldown.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rolldown.mjs","names":["defu","alias","dtsBundlePlugin"],"sources":["../src/rolldown.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n ExecutionContext,\n UnpluginOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport inject from \"@rollup/plugin-inject\";\nimport resolve from \"@rollup/plugin-node-resolve\";\nimport replace from \"@rollup/plugin-replace\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { defu } from \"defu\";\nimport { globSync } from \"glob\";\nimport { builtinModules } from \"node:module\";\nimport type { InputOptions, Plugin } from \"rolldown\";\nimport { RolldownOptions, RollupLog } from \"rolldown\";\nimport { dts as dtsBundlePlugin } from \"rolldown-plugin-dts\";\nimport { viteAliasPlugin as alias } from \"rolldown/experimental\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { createRolldownPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\nexport const DEFAULT_OPTIONS = {\n keepNames: true,\n treeshake: true,\n shimMissingExports: true,\n transform: {\n target: \"esnext\"\n }\n};\n\n/**\n * Resolves the options for [rolldown](https://rolldown.rs).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): RolldownOptions {\n return defu<RolldownOptions, any>(\n {\n input: globSync(\n toArray(context.entry).map(entry =>\n isString(entry) ? entry : entry.file\n )\n ).flat(),\n external: (source: string) => {\n if (\n context.config.resolve.external &&\n toArray(context.config.resolve.external).includes(source)\n ) {\n return true;\n }\n\n if (\n context.config.resolve.noExternal &&\n toArray(context.config.resolve.noExternal).includes(source)\n ) {\n return false;\n }\n\n if (context.builtins.includes(source)) {\n return context.config.projectType !== \"application\";\n }\n\n return !context.config.resolve.skipNodeModulesBundle;\n },\n plugins: [\n typescriptPlugin({\n check: false,\n tsconfig: context.tsconfig.tsconfigFilePath\n }),\n context.config.define &&\n Object.keys(context.config.define).length > 0 &&\n replace({\n sourceMap: context.config.mode === \"development\",\n preventAssignment: true,\n ...(context.config.define ?? {})\n }),\n context.config.inject &&\n Object.keys(context.config.inject).length > 0 &&\n inject({\n sourceMap: context.config.mode === \"development\",\n ...context.config.inject\n }),\n alias({\n entries: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n )\n }),\n resolve({\n moduleDirectories: [\"node_modules\"],\n preferBuiltins: true\n }),\n context.config.output.dts &&\n toArray(context.config.output.format).includes(\"esm\")\n ? dtsBundlePlugin({\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n )\n })\n : undefined,\n context.config.output.dts &&\n toArray(context.config.output.format).includes(\"cjs\")\n ? dtsBundlePlugin({\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n ),\n emitDtsOnly: true,\n cjsDefault: true\n })\n : undefined,\n {\n name: `powerlines:node-protocol`,\n resolveId: {\n order: \"pre\",\n filter: {\n id:\n context.config.output.nodeProtocol === \"strip\"\n ? new RegExp(\n `^node:(${builtinModules\n .filter(mod => !mod.startsWith(\"node:\"))\n .join(\"|\")})$`\n )\n : new RegExp(\n `^(${builtinModules\n .filter(mod => !mod.startsWith(\"node:\"))\n .join(\"|\")})$`\n )\n },\n handler:\n context.config.output.nodeProtocol === \"strip\"\n ? async (id: string, ...args: any[]) => {\n const resolved = await context.resolve(\n id.slice(5),\n ...args\n );\n if (resolved && !resolved.external) {\n return resolved;\n }\n\n return {\n id: id.slice(5), // \"node:\".length\n external: true,\n moduleSideEffects: false\n };\n }\n : id => {\n return {\n id: `node:${id}`,\n external: true,\n moduleSideEffects: false\n };\n }\n }\n } as Plugin\n ].filter(Boolean) as Plugin[],\n resolve: {\n alias: context.alias,\n mainFields: context.config.resolve.mainFields,\n define: context.config.define,\n extensions: context.config.resolve.extensions\n },\n transform: {\n target: context.tsconfig.tsconfigJson?.compilerOptions?.target,\n define: context.config.define,\n inject: context.config.inject\n },\n platform: context.config.platform,\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n ),\n cache: !context.config.skipCache\n ? joinPaths(context.cachePath, \"rolldown\")\n : false,\n logLevel:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general === \"debug\"\n ? \"warn\"\n : \"error\",\n onLog(level: \"info\" | \"debug\" | \"warn\", log: RollupLog) {\n if (\n context.config.logLevel.general !== \"trace\" &&\n level === \"warn\" &&\n log.code === \"PLUGIN_TIMINGS\"\n ) {\n return;\n }\n\n if (log.message?.trim()) {\n if (level === \"info\") {\n context.logger.debug(log.message?.trim() ?? \"\");\n } else {\n context.logger.log(level, log.message?.trim() ?? \"\");\n }\n }\n },\n output: [\n toArray(context.config.output.format).includes(\"esm\")\n ? {\n dir: context.config.output.path,\n format: \"es\",\n sourcemap: context.config.output.sourceMap,\n codeSplitting: true,\n exports: \"named\",\n minify: context.config.output.minify\n ? {\n compress: {\n dropDebugger:\n context.config.mode === \"production\" ? true : undefined,\n unused:\n context.config.mode === \"production\" ? true : undefined,\n treeshake: true\n },\n mangle: true\n }\n : context.config.mode === \"production\"\n ? \"dce-only\"\n : undefined\n }\n : undefined,\n toArray(context.config.output.format).includes(\"cjs\")\n ? {\n dir: context.config.output.path,\n format: \"cjs\",\n sourcemap: context.config.output.sourceMap,\n codeSplitting: true,\n exports: \"auto\",\n minify: context.config.output.minify\n ? {\n compress: {\n dropDebugger:\n context.config.mode === \"production\" ? true : undefined,\n unused:\n context.config.mode === \"production\" ? true : undefined,\n treeshake: true\n },\n mangle: true\n }\n : context.config.mode === \"production\"\n ? \"dce-only\"\n : undefined\n }\n : undefined\n ].filter(Boolean) as RolldownOptions[\"output\"]\n },\n DEFAULT_OPTIONS\n );\n}\n\n/**\n * Creates a Rolldown plugin factory that generates a plugin instance.\n *\n * @see https://rolldown.rs/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rolldown.config.ts\n * import { createRolldownFactory } from \"@powerlines/unplugin/rolldown\";\n *\n * const powerlinesPlugin = createRolldownFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates a Rolldown plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rolldown build.\n */\nexport function createRolldownFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rolldown\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rolldown: {\n async options(options: InputOptions) {\n const environment = await unplugin.context.getEnvironment();\n\n return defu(\n resolveOptions(environment),\n options,\n (await unplugin.context.callHook(\n \"rolldown:options\",\n { environment },\n options\n )) ?? {}\n );\n }\n }\n })\n );\n}\n\n/**\n * A Rolldown plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rolldown.rs/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rolldown.config.ts\n * import powerlines from \"@powerlines/unplugin/rolldown\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * })\n * ```\n */\nconst plugin = createRolldownPlugin(createRolldownFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,kBAAkB;CAC7B,WAAW;CACX,WAAW;CACX,oBAAoB;CACpB,WAAW,EACT,QAAQ,SACV;AACF;;;;;;;AAQA,SAAgB,eACd,SACiB;CACjB,OAAOA,OACL;EACE,OAAO,SACL,QAAQ,QAAQ,KAAK,EAAE,KAAI,UACzB,SAAS,KAAK,IAAI,QAAQ,MAAM,IAClC,CACF,EAAE,KAAK;EACP,WAAW,WAAmB;GAC5B,IACE,QAAQ,OAAO,QAAQ,YACvB,QAAQ,QAAQ,OAAO,QAAQ,QAAQ,EAAE,SAAS,MAAM,GAExD,OAAO;GAGT,IACE,QAAQ,OAAO,QAAQ,cACvB,QAAQ,QAAQ,OAAO,QAAQ,UAAU,EAAE,SAAS,MAAM,GAE1D,OAAO;GAGT,IAAI,QAAQ,SAAS,SAAS,MAAM,GAClC,OAAO,QAAQ,OAAO,gBAAgB;GAGxC,OAAO,CAAC,QAAQ,OAAO,QAAQ;EACjC;EACA,SAAS;GACP,iBAAiB;IACf,OAAO;IACP,UAAU,QAAQ,SAAS;GAC7B,CAAC;GACD,QAAQ,OAAO,UACb,OAAO,KAAK,QAAQ,OAAO,MAAM,EAAE,SAAS,KAC5C,QAAQ;IACN,WAAW,QAAQ,OAAO,SAAS;IACnC,mBAAmB;IACnB,GAAI,QAAQ,OAAO,UAAU,CAAC;GAChC,CAAC;GACH,QAAQ,OAAO,UACb,OAAO,KAAK,QAAQ,OAAO,MAAM,EAAE,SAAS,KAC5C,OAAO;IACL,WAAW,QAAQ,OAAO,SAAS;IACnC,GAAG,QAAQ,OAAO;GACpB,CAAC;GACHC,gBAAM,EACJ,SAAS,OAAO,QAAQ,QAAQ,KAAK,EAAE,QACpC,KAAK,CAAC,IAAI,UAAU;IACnB,IA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;GAC3B,QAAQ;GACR,WAAW,QAAQ,OAAO,OAAO;GACjC,eAAe;GACf,SAAS;GACT,QAAQ,QAAQ,OAAO,OAAO,SAC1B;IACE,UAAU;KACR,cACE,QAAQ,OAAO,SAAS,eAAe,OAAO;KAChD,QACE,QAAQ,OAAO,SAAS,eAAe,OAAO;KAChD,WAAW;IACb;IACA,QAAQ;GACV,IACA,QAAQ,OAAO,SAAS,eACtB,aACA;EACR,IACA,MACN,EAAE,OAAO,OAAO;CAClB,GACA,eACF;AACF;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,sBACd,UAAmD,CAAC,GACpD,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;CAAW,IAAG,aAChE,SAAS;EACP,GAAI;EACJ,UAAU,EACR,MAAM,QAAQ,SAAuB;GACnC,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe;GAE1D,OAAOF,OACL,eAAe,WAAW,GAC1B,SACC,MAAM,SAAS,QAAQ,SACtB,oBACA,EAAE,YAAY,GACd,OACF,KAAM,CAAC,CACT;EACF,EACF;CACF,CAAC,CACH;AACF;;;;;;;;;;;;;;;;AAiBA,MAAM,SAAS,qBAAqB,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"rolldown.mjs","names":["defu","alias","dtsBundlePlugin"],"sources":["../src/rolldown.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n ExecutionContext,\n UnpluginOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport inject from \"@rollup/plugin-inject\";\nimport resolve from \"@rollup/plugin-node-resolve\";\nimport replace from \"@rollup/plugin-replace\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { defu } from \"defu\";\nimport { globSync } from \"glob\";\nimport { builtinModules } from \"node:module\";\nimport type { InputOptions, Plugin } from \"rolldown\";\nimport { RolldownOptions, RollupLog } from \"rolldown\";\nimport { dts as dtsBundlePlugin } from \"rolldown-plugin-dts\";\nimport { viteAliasPlugin as alias } from \"rolldown/experimental\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { createRolldownPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\nexport const DEFAULT_OPTIONS = {\n keepNames: true,\n treeshake: true,\n shimMissingExports: true,\n transform: {\n target: \"esnext\"\n }\n};\n\n/**\n * Resolves the options for [rolldown](https://rolldown.rs).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): RolldownOptions {\n return defu<RolldownOptions, any>(\n {\n input: globSync(\n toArray(context.entry).map(entry =>\n isString(entry) ? entry : entry.file\n )\n ).flat(),\n external: (source: string) => {\n if (\n context.config.resolve.external &&\n toArray(context.config.resolve.external).includes(source)\n ) {\n return true;\n }\n\n if (\n context.config.resolve.noExternal &&\n toArray(context.config.resolve.noExternal).includes(source)\n ) {\n return false;\n }\n\n if (context.builtins.includes(source)) {\n return context.config.projectType !== \"application\";\n }\n\n return !context.config.resolve.skipNodeModulesBundle;\n },\n plugins: [\n typescriptPlugin({\n check: false,\n tsconfig: context.tsconfig.tsconfigFilePath\n }),\n context.config.define &&\n Object.keys(context.config.define).length > 0 &&\n replace({\n sourceMap: context.config.mode === \"development\",\n preventAssignment: true,\n ...(context.config.define ?? {})\n }),\n context.config.inject &&\n Object.keys(context.config.inject).length > 0 &&\n inject({\n sourceMap: context.config.mode === \"development\",\n ...context.config.inject\n }),\n alias({\n entries: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n )\n }),\n resolve({\n moduleDirectories: [\"node_modules\"],\n preferBuiltins: true\n }),\n context.config.output.dts &&\n toArray(context.config.output.format).includes(\"esm\")\n ? dtsBundlePlugin({\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n )\n })\n : undefined,\n context.config.output.dts &&\n toArray(context.config.output.format).includes(\"cjs\")\n ? dtsBundlePlugin({\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n ),\n emitDtsOnly: true,\n cjsDefault: true\n })\n : undefined,\n {\n name: `powerlines:node-protocol`,\n resolveId: {\n order: \"pre\",\n filter: {\n id:\n context.config.output.nodeProtocol === \"strip\"\n ? new RegExp(\n `^node:(${builtinModules\n .filter(mod => !mod.startsWith(\"node:\"))\n .join(\"|\")})$`\n )\n : new RegExp(\n `^(${builtinModules\n .filter(mod => !mod.startsWith(\"node:\"))\n .join(\"|\")})$`\n )\n },\n handler:\n context.config.output.nodeProtocol === \"strip\"\n ? async (id: string, ...args: any[]) => {\n const resolved = await context.resolve(\n id.slice(5),\n ...args\n );\n if (resolved && !resolved.external) {\n return resolved;\n }\n\n return {\n id: id.slice(5), // \"node:\".length\n external: true,\n moduleSideEffects: false\n };\n }\n : id => {\n return {\n id: `node:${id}`,\n external: true,\n moduleSideEffects: false\n };\n }\n }\n } as Plugin\n ].filter(Boolean) as Plugin[],\n resolve: {\n alias: context.alias,\n mainFields: context.config.resolve.mainFields,\n define: context.config.define,\n extensions: context.config.resolve.extensions\n },\n transform: {\n target: context.tsconfig.tsconfigJson?.compilerOptions?.target,\n define: context.config.define,\n inject: context.config.inject\n },\n platform: context.config.platform,\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n ),\n cache: !context.config.skipCache\n ? joinPaths(context.cachePath, \"rolldown\")\n : false,\n logLevel:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general === \"debug\"\n ? \"warn\"\n : \"error\",\n onLog(level: \"info\" | \"debug\" | \"warn\", log: RollupLog) {\n if (\n context.config.logLevel.general !== \"trace\" &&\n level === \"warn\" &&\n log.code === \"PLUGIN_TIMINGS\"\n ) {\n return;\n }\n\n if (log.message?.trim()) {\n if (level === \"info\") {\n context.logger.debug(log.message?.trim() ?? \"\");\n } else {\n context.logger.log(level, log.message?.trim() ?? \"\");\n }\n }\n },\n output: [\n toArray(context.config.output.format).includes(\"esm\")\n ? {\n dir: context.config.output.path,\n format: \"es\",\n sourcemap: context.config.output.sourceMap,\n codeSplitting: true,\n exports: \"named\",\n minify: context.config.output.minify\n ? {\n compress: {\n dropDebugger:\n context.config.mode === \"production\" ? true : undefined,\n unused:\n context.config.mode === \"production\" ? true : undefined,\n treeshake: true\n },\n mangle: true\n }\n : context.config.mode === \"production\"\n ? \"dce-only\"\n : undefined\n }\n : undefined,\n toArray(context.config.output.format).includes(\"cjs\")\n ? {\n dir: context.config.output.path,\n format: \"cjs\",\n sourcemap: context.config.output.sourceMap,\n codeSplitting: true,\n exports: \"auto\",\n minify: context.config.output.minify\n ? {\n compress: {\n dropDebugger:\n context.config.mode === \"production\" ? true : undefined,\n unused:\n context.config.mode === \"production\" ? true : undefined,\n treeshake: true\n },\n mangle: true\n }\n : context.config.mode === \"production\"\n ? \"dce-only\"\n : undefined\n }\n : undefined\n ].filter(Boolean) as RolldownOptions[\"output\"]\n },\n DEFAULT_OPTIONS\n );\n}\n\n/**\n * Creates a Rolldown plugin factory that generates a plugin instance.\n *\n * @see https://rolldown.rs/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rolldown.config.ts\n * import { createRolldownFactory } from \"@powerlines/unplugin/rolldown\";\n *\n * const powerlinesPlugin = createRolldownFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates a Rolldown plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rolldown build.\n */\nexport function createRolldownFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rolldown\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rolldown: {\n async options(options: InputOptions) {\n const environment = await unplugin.context.getEnvironment();\n\n return defu(\n resolveOptions(environment),\n options,\n (await unplugin.context.callHook(\n \"rolldown:options\",\n { environment },\n options\n )) ?? {}\n );\n }\n }\n })\n );\n}\n\n/**\n * A Rolldown plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rolldown.rs/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rolldown.config.ts\n * import powerlines from \"@powerlines/unplugin/rolldown\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * })\n * ```\n */\nconst plugin = createRolldownPlugin(createRolldownFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;AA6CA,MAAa,kBAAkB;CAC7B,WAAW;CACX,WAAW;CACX,oBAAoB;CACpB,WAAW,EACT,QAAQ,SACV;AACF;;;;;;;AAQA,SAAgB,eACd,SACiB;CACjB,OAAOA,OACL;EACE,OAAO,SACL,QAAQ,Q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AACF;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,sBACd,UAAmD,CAAC,GACpD,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;CAAW,IAAG,aAChE,SAAS;EACP,GAAI;EACJ,UAAU,EACR,MAAM,QAAQ,SAAuB;GACnC,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe;GAE1D,OAAOF,OACL,eAAe,WAAW,GAC1B,SACC,MAAM,SAAS,QAAQ,SACtB,oBACA,EAAE,YAAY,GACd,OACF,KAAM,CAAC,CACT;EACF,EACF;CACF,CAAC,CACH;AACF;;;;;;;;;;;;;;;;AAiBA,MAAM,SAAS,qBAAqB,sBAAsB,CAAC"}
|
package/dist/rollup.cjs
CHANGED
|
@@ -1,38 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
|
-
const
|
|
11
|
-
const require_unplugin = require('./unplugin.cjs');
|
|
2
|
+
const require_unplugin = require('./unplugin-WjPT9ECw.cjs');
|
|
12
3
|
let defu = require("defu");
|
|
13
4
|
let unplugin = require("unplugin");
|
|
14
5
|
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
15
6
|
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
16
7
|
let _rollup_plugin_inject = require("@rollup/plugin-inject");
|
|
17
|
-
_rollup_plugin_inject =
|
|
8
|
+
_rollup_plugin_inject = require_unplugin.__toESM(_rollup_plugin_inject, 1);
|
|
18
9
|
let _rollup_plugin_node_resolve = require("@rollup/plugin-node-resolve");
|
|
19
|
-
_rollup_plugin_node_resolve =
|
|
10
|
+
_rollup_plugin_node_resolve = require_unplugin.__toESM(_rollup_plugin_node_resolve, 1);
|
|
20
11
|
let _rollup_plugin_replace = require("@rollup/plugin-replace");
|
|
21
|
-
_rollup_plugin_replace =
|
|
12
|
+
_rollup_plugin_replace = require_unplugin.__toESM(_rollup_plugin_replace, 1);
|
|
22
13
|
let rollup_plugin_typescript2 = require("rollup-plugin-typescript2");
|
|
23
|
-
rollup_plugin_typescript2 =
|
|
14
|
+
rollup_plugin_typescript2 = require_unplugin.__toESM(rollup_plugin_typescript2, 1);
|
|
24
15
|
let _rollup_plugin_alias = require("@rollup/plugin-alias");
|
|
25
|
-
_rollup_plugin_alias =
|
|
16
|
+
_rollup_plugin_alias = require_unplugin.__toESM(_rollup_plugin_alias, 1);
|
|
26
17
|
let node_fs = require("node:fs");
|
|
27
18
|
|
|
28
19
|
//#region src/rollup.ts
|
|
29
|
-
var rollup_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
30
|
-
createRollupFactory: () => createRollupFactory,
|
|
31
|
-
default: () => plugin,
|
|
32
|
-
dtsBundlePlugin: () => dtsBundlePlugin,
|
|
33
|
-
plugin: () => plugin,
|
|
34
|
-
resolveOptions: () => resolveOptions
|
|
35
|
-
});
|
|
36
20
|
/**
|
|
37
21
|
* A Rollup plugin to bundle TypeScript declaration files (.d.ts) alongside the JavaScript output files.
|
|
38
22
|
*
|
|
@@ -171,10 +155,4 @@ exports.createRollupFactory = createRollupFactory;
|
|
|
171
155
|
exports.default = plugin;
|
|
172
156
|
exports.plugin = plugin;
|
|
173
157
|
exports.dtsBundlePlugin = dtsBundlePlugin;
|
|
174
|
-
exports.resolveOptions = resolveOptions;
|
|
175
|
-
Object.defineProperty(exports, 'rollup_exports', {
|
|
176
|
-
enumerable: true,
|
|
177
|
-
get: function () {
|
|
178
|
-
return rollup_exports;
|
|
179
|
-
}
|
|
180
|
-
});
|
|
158
|
+
exports.resolveOptions = resolveOptions;
|
package/dist/rollup.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as UnpluginFactory, t as UnpluginExecutionOptions } from "./types-CEaXoKbk.cjs";
|
|
2
2
|
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.cjs";
|
|
3
3
|
import { ExecutionContext, UnresolvedContext } from "@powerlines/core";
|
|
4
4
|
import { Plugin, RollupOptions } from "rollup";
|
|
@@ -40,7 +40,7 @@ declare function resolveOptions<TContext extends UnresolvedContext>(context: TCo
|
|
|
40
40
|
* @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.
|
|
41
41
|
* @returns A function that generates a Rollup plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rollup build.
|
|
42
42
|
*/
|
|
43
|
-
declare function createRollupFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
|
|
43
|
+
declare function createRollupFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig<import("@powerlines/core").UserConfig, import("@powerlines/core").ExecutionOptions>, any>>;
|
|
44
44
|
/**
|
|
45
45
|
* A Rollup plugin that will invoke the Powerlines API hooks during the build process.
|
|
46
46
|
*
|
package/dist/rollup.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.d.cts","names":[],"sources":["../src/rollup.ts"],"mappings":";;;;;;;;AA+CA;;;;cAAa,eAAA,EAAiB,MA+B7B;AAQD;;;;;;AAAA,iBAAgB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,aAAA;;;;;;;;AAAa;AAuHhB;;;;;;;;;;;;;;iBAAgB,mBAAA,kBAAqC,gBAAA,EACnD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA
|
|
1
|
+
{"version":3,"file":"rollup.d.cts","names":[],"sources":["../src/rollup.ts"],"mappings":";;;;;;;;AA+CA;;;;cAAa,eAAA,EAAiB,MA+B7B;AAQD;;;;;;AAAA,iBAAgB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,aAAA;;;;;;;;AAAa;AAuHhB;;;;;;;;;;;;;;iBAAgB,mBAAA,kBAAqC,gBAAA,EACnD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA,4BAAA,UAAA,6BAAA,gBAAA;;;;;;;;;;;;AAAA;AAwCnE;;;;cAAa,MAAA,GAAM,OAAA,GAA4C,wBAAA,iBAA5C,MAAA,QAAA,MAAA"}
|
package/dist/rollup.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import __tsdown_shims_path from 'node:path';
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
1
|
import { UnpluginExecutionOptions, UnpluginFactory } from "./types.mjs";
|
|
4
2
|
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.mjs";
|
|
5
3
|
import { ExecutionContext, UnresolvedContext } from "@powerlines/core";
|
|
@@ -42,7 +40,7 @@ declare function resolveOptions<TContext extends UnresolvedContext>(context: TCo
|
|
|
42
40
|
* @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.
|
|
43
41
|
* @returns A function that generates a Rollup plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rollup build.
|
|
44
42
|
*/
|
|
45
|
-
declare function createRollupFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
|
|
43
|
+
declare function createRollupFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig<import("@powerlines/core").UserConfig, import("@powerlines/core").ExecutionOptions>, any>>;
|
|
46
44
|
/**
|
|
47
45
|
* A Rollup plugin that will invoke the Powerlines API hooks during the build process.
|
|
48
46
|
*
|
package/dist/rollup.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.d.mts","names":[],"sources":["../src/rollup.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"rollup.d.mts","names":[],"sources":["../src/rollup.ts"],"mappings":";;;;;;;;AA+CA;;;;cAAa,eAAA,EAAiB,MA+B7B;AAQD;;;;;;AAAA,iBAAgB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,aAAA;;;;;;;;AAAa;AAuHhB;;;;;;;;;;;;;;iBAAgB,mBAAA,kBAAqC,gBAAA,EACnD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA,4BAAA,UAAA,6BAAA,gBAAA;;;;;;;;;;;;AAAA;AAwCnE;;;;cAAa,MAAA,GAAM,OAAA,GAA4C,wBAAA,iBAA5C,MAAA,QAAA,MAAA"}
|
package/dist/rollup.mjs
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
|
-
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
10
1
|
import { createUnpluginFactory } from "./unplugin.mjs";
|
|
11
2
|
import { defu as defu$1 } from "defu";
|
|
12
3
|
import { createRollupPlugin } from "unplugin";
|
|
@@ -20,13 +11,6 @@ import alias from "@rollup/plugin-alias";
|
|
|
20
11
|
import { globSync } from "node:fs";
|
|
21
12
|
|
|
22
13
|
//#region src/rollup.ts
|
|
23
|
-
var rollup_exports = /* @__PURE__ */ __exportAll({
|
|
24
|
-
createRollupFactory: () => createRollupFactory,
|
|
25
|
-
default: () => plugin,
|
|
26
|
-
dtsBundlePlugin: () => dtsBundlePlugin,
|
|
27
|
-
plugin: () => plugin,
|
|
28
|
-
resolveOptions: () => resolveOptions
|
|
29
|
-
});
|
|
30
14
|
/**
|
|
31
15
|
* A Rollup plugin to bundle TypeScript declaration files (.d.ts) alongside the JavaScript output files.
|
|
32
16
|
*
|
|
@@ -161,5 +145,5 @@ function createRollupFactory(options = {}, decorate = (options) => options) {
|
|
|
161
145
|
const plugin = createRollupPlugin(createRollupFactory());
|
|
162
146
|
|
|
163
147
|
//#endregion
|
|
164
|
-
export { createRollupFactory, plugin as default, plugin, dtsBundlePlugin, resolveOptions
|
|
148
|
+
export { createRollupFactory, plugin as default, plugin, dtsBundlePlugin, resolveOptions };
|
|
165
149
|
//# sourceMappingURL=rollup.mjs.map
|
package/dist/rollup.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.mjs","names":["defu"],"sources":["../src/rollup.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n ExecutionContext,\n UnpluginOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport alias from \"@rollup/plugin-alias\";\nimport inject from \"@rollup/plugin-inject\";\nimport resolve from \"@rollup/plugin-node-resolve\";\nimport replace from \"@rollup/plugin-replace\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { defu } from \"defu\";\nimport { globSync } from \"node:fs\";\nimport type { InputOptions, RollupOptions } from \"rollup\";\nimport { Plugin } from \"rollup\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { createRollupPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * A Rollup plugin to bundle TypeScript declaration files (.d.ts) alongside the JavaScript output files.\n *\n * @remarks\n * This plugin generates .d.ts files for each entry point in the bundle, ensuring that type definitions are available for consumers of the library.\n */\nexport const dtsBundlePlugin: Plugin = {\n name: \"powerlines:dts-bundle\",\n async generateBundle(_opts, bundle) {\n for (const [, file] of Object.entries(bundle)) {\n if (\n file.type === \"asset\" ||\n !file.isEntry ||\n file.facadeModuleId == null\n ) {\n continue;\n }\n\n // Replace various JavaScript file extensions (e.g., .js, .cjs, .mjs, .cjs.js, .mjs.js) with .d.ts for generating type definition file names.\n const dtsFileName = file.fileName.replace(\n /(?:\\.cjs|\\.mjs|\\.esm\\.js|\\.cjs\\.js|\\.mjs\\.js|\\.js)$/,\n \".d.ts\"\n );\n\n const relativeSourceDtsName = JSON.stringify(\n `./${file.facadeModuleId.replace(/\\.[cm]?[jt]sx?$/, \"\")}`\n );\n\n this.emitFile({\n type: \"asset\",\n fileName: dtsFileName,\n source: file.exports.includes(\"default\")\n ? `export * from ${relativeSourceDtsName};\\nexport { default } from ${relativeSourceDtsName};\\n`\n : `export * from ${relativeSourceDtsName};\\n`\n });\n }\n }\n};\n\n/**\n * Resolves the options for [rollup](https://rollupjs.org).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): RollupOptions {\n return {\n input: globSync(\n toArray(context.entry).map(entry =>\n isString(entry) ? entry : entry.file\n )\n ).flat(),\n external: (source: string) => {\n if (\n context.config.resolve.external &&\n toArray(context.config.resolve.external).includes(source)\n ) {\n return true;\n }\n\n if (\n context.config.resolve.noExternal &&\n toArray(context.config.resolve.noExternal).includes(source)\n ) {\n return false;\n }\n\n if (context.builtins.includes(source)) {\n return context.config.projectType !== \"application\";\n }\n\n return !context.config.resolve.skipNodeModulesBundle;\n },\n plugins: [\n typescriptPlugin({\n check: false,\n tsconfig: context.tsconfig.tsconfigFilePath\n }),\n context.config.define &&\n Object.keys(context.config.define).length > 0 &&\n replace({\n sourceMap: context.config.mode === \"development\",\n preventAssignment: true,\n ...(context.config.define ?? {})\n }),\n context.config.inject &&\n Object.keys(context.config.inject).length > 0 &&\n inject({\n sourceMap: context.config.mode === \"development\",\n ...context.config.inject\n }),\n alias({\n entries: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n )\n }),\n resolve({\n moduleDirectories: [\"node_modules\"],\n preferBuiltins: true\n }),\n dtsBundlePlugin\n ].filter(Boolean) as Plugin[],\n cache: !context.config.skipCache ? undefined : false,\n logLevel:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general === \"debug\"\n ? \"warn\"\n : \"silent\",\n output: [\n {\n dir: context.config.output.path,\n format: \"es\",\n entryFileNames: \"[name].js\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n },\n {\n dir: context.config.output.path,\n format: \"cjs\",\n entryFileNames: \"[name].cjs\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n }\n ]\n };\n}\n\n/**\n * Creates a Rollup plugin factory that generates a plugin instance.\n *\n * @see https://rollupjs.org/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rollup.config.ts\n * import { createRollupFactory } from \"@powerlines/unplugin/rollup\";\n *\n * const powerlinesPlugin = createRollupFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates a Rollup plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rollup build.\n */\nexport function createRollupFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rollup\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rollup: {\n async options(opts: InputOptions) {\n const environment = await unplugin.context.getEnvironment();\n\n return defu(\n resolveOptions(environment),\n opts,\n unplugin.context.callHook(\n \"rollup:options\",\n { environment },\n opts\n ) ?? {}\n );\n }\n }\n })\n );\n}\n\n/**\n * A Rollup plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rollupjs.org/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rollup.config.ts\n *\n * import powerlines from \"@powerlines/unplugin/rollup\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * })\n * ```\n */\nexport const plugin = createRollupPlugin(createRollupFactory());\n\nexport { plugin as default };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAa,kBAA0B;CACrC,MAAM;CACN,MAAM,eAAe,OAAO,QAAQ;EAClC,KAAK,MAAM,GAAG,SAAS,OAAO,QAAQ,MAAM,GAAG;GAC7C,IACE,KAAK,SAAS,WACd,CAAC,KAAK,WACN,KAAK,kBAAkB,MAEvB;GAIF,MAAM,cAAc,KAAK,SAAS,QAChC,uDACA,OACF;GAEA,MAAM,wBAAwB,KAAK,UACjC,KAAK,KAAK,eAAe,QAAQ,mBAAmB,EAAE,GACxD;GAEA,KAAK,SAAS;IACZ,MAAM;IACN,UAAU;IACV,QAAQ,KAAK,QAAQ,SAAS,SAAS,IACnC,iBAAiB,sBAAsB,6BAA6B,sBAAsB,OAC1F,iBAAiB,sBAAsB;GAC7C,CAAC;EACH;CACF;AACF;;;;;;;AAQA,SAAgB,eACd,SACe;CACf,OAAO;EACL,OAAO,SACL,QAAQ,QAAQ,KAAK,EAAE,KAAI,UACzB,SAAS,KAAK,IAAI,QAAQ,MAAM,IAClC,CACF,EAAE,KAAK;EACP,WAAW,WAAmB;GAC5B,IACE,QAAQ,OAAO,QAAQ,YACvB,QAAQ,QAAQ,OAAO,QAAQ,QAAQ,EAAE,SAAS,MAAM,GAExD,OAAO;GAGT,IACE,QAAQ,OAAO,QAAQ,cACvB,QAAQ,QAAQ,OAAO,QAAQ,UAAU,EAAE,SAAS,MAAM,GAE1D,OAAO;GAGT,IAAI,QAAQ,SAAS,SAAS,MAAM,GAClC,OAAO,QAAQ,OAAO,gBAAgB;GAGxC,OAAO,CAAC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D,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;CAAS,IAAG,aAC9D,SAAS;EACP,GAAI;EACJ,QAAQ,EACN,MAAM,QAAQ,MAAoB;GAChC,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe;GAE1D,OAAOA,OACL,eAAe,WAAW,GAC1B,MACA,SAAS,QAAQ,SACf,kBACA,EAAE,YAAY,GACd,IACF,KAAK,CAAC,CACR;EACF,EACF;CACF,CAAC,CACH;AACF;;;;;;;;;;;;;;;;;AAkBA,MAAa,SAAS,mBAAmB,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"rollup.mjs","names":["defu"],"sources":["../src/rollup.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n ExecutionContext,\n UnpluginOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport alias from \"@rollup/plugin-alias\";\nimport inject from \"@rollup/plugin-inject\";\nimport resolve from \"@rollup/plugin-node-resolve\";\nimport replace from \"@rollup/plugin-replace\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { defu } from \"defu\";\nimport { globSync } from \"node:fs\";\nimport type { InputOptions, RollupOptions } from \"rollup\";\nimport { Plugin } from \"rollup\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { createRollupPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * A Rollup plugin to bundle TypeScript declaration files (.d.ts) alongside the JavaScript output files.\n *\n * @remarks\n * This plugin generates .d.ts files for each entry point in the bundle, ensuring that type definitions are available for consumers of the library.\n */\nexport const dtsBundlePlugin: Plugin = {\n name: \"powerlines:dts-bundle\",\n async generateBundle(_opts, bundle) {\n for (const [, file] of Object.entries(bundle)) {\n if (\n file.type === \"asset\" ||\n !file.isEntry ||\n file.facadeModuleId == null\n ) {\n continue;\n }\n\n // Replace various JavaScript file extensions (e.g., .js, .cjs, .mjs, .cjs.js, .mjs.js) with .d.ts for generating type definition file names.\n const dtsFileName = file.fileName.replace(\n /(?:\\.cjs|\\.mjs|\\.esm\\.js|\\.cjs\\.js|\\.mjs\\.js|\\.js)$/,\n \".d.ts\"\n );\n\n const relativeSourceDtsName = JSON.stringify(\n `./${file.facadeModuleId.replace(/\\.[cm]?[jt]sx?$/, \"\")}`\n );\n\n this.emitFile({\n type: \"asset\",\n fileName: dtsFileName,\n source: file.exports.includes(\"default\")\n ? `export * from ${relativeSourceDtsName};\\nexport { default } from ${relativeSourceDtsName};\\n`\n : `export * from ${relativeSourceDtsName};\\n`\n });\n }\n }\n};\n\n/**\n * Resolves the options for [rollup](https://rollupjs.org).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): RollupOptions {\n return {\n input: globSync(\n toArray(context.entry).map(entry =>\n isString(entry) ? entry : entry.file\n )\n ).flat(),\n external: (source: string) => {\n if (\n context.config.resolve.external &&\n toArray(context.config.resolve.external).includes(source)\n ) {\n return true;\n }\n\n if (\n context.config.resolve.noExternal &&\n toArray(context.config.resolve.noExternal).includes(source)\n ) {\n return false;\n }\n\n if (context.builtins.includes(source)) {\n return context.config.projectType !== \"application\";\n }\n\n return !context.config.resolve.skipNodeModulesBundle;\n },\n plugins: [\n typescriptPlugin({\n check: false,\n tsconfig: context.tsconfig.tsconfigFilePath\n }),\n context.config.define &&\n Object.keys(context.config.define).length > 0 &&\n replace({\n sourceMap: context.config.mode === \"development\",\n preventAssignment: true,\n ...(context.config.define ?? {})\n }),\n context.config.inject &&\n Object.keys(context.config.inject).length > 0 &&\n inject({\n sourceMap: context.config.mode === \"development\",\n ...context.config.inject\n }),\n alias({\n entries: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n )\n }),\n resolve({\n moduleDirectories: [\"node_modules\"],\n preferBuiltins: true\n }),\n dtsBundlePlugin\n ].filter(Boolean) as Plugin[],\n cache: !context.config.skipCache ? undefined : false,\n logLevel:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general === \"debug\"\n ? \"warn\"\n : \"silent\",\n output: [\n {\n dir: context.config.output.path,\n format: \"es\",\n entryFileNames: \"[name].js\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n },\n {\n dir: context.config.output.path,\n format: \"cjs\",\n entryFileNames: \"[name].cjs\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n }\n ]\n };\n}\n\n/**\n * Creates a Rollup plugin factory that generates a plugin instance.\n *\n * @see https://rollupjs.org/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rollup.config.ts\n * import { createRollupFactory } from \"@powerlines/unplugin/rollup\";\n *\n * const powerlinesPlugin = createRollupFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates a Rollup plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rollup build.\n */\nexport function createRollupFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rollup\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rollup: {\n async options(opts: InputOptions) {\n const environment = await unplugin.context.getEnvironment();\n\n return defu(\n resolveOptions(environment),\n opts,\n unplugin.context.callHook(\n \"rollup:options\",\n { environment },\n opts\n ) ?? {}\n );\n }\n }\n })\n );\n}\n\n/**\n * A Rollup plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rollupjs.org/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rollup.config.ts\n *\n * import powerlines from \"@powerlines/unplugin/rollup\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * })\n * ```\n */\nexport const plugin = createRollupPlugin(createRollupFactory());\n\nexport { plugin as default };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+CA,MAAa,kBAA0B;CACrC,MAAM;CACN,MAAM,eAAe,OAAO,QAAQ;EAClC,KAAK,MAAM,GAAG,SAAS,OAAO,QAAQ,MAAM,GAAG;GAC7C,IACE,KAAK,SAAS,WACd,CAAC,KAAK,WACN,KAAK,kBAAkB,MAEvB;GAIF,MAAM,cAAc,KAAK,SAAS,QAChC,uDACA,OACF;GAEA,MAAM,wBAAwB,KAAK,UACjC,KAAK,KAAK,eAAe,QAAQ,mBAAmB,EAAE,GACxD;GAEA,KAAK,SAAS;IACZ,MAAM;IACN,UAAU;IACV,QAAQ,KAAK,QAAQ,SAAS,SAAS,IACnC,iBAAiB,sBAAsB,6BAA6B,sBAAsB,OAC1F,iBAAiB,sBAAsB;GAC7C,CAAC;EACH;CACF;AACF;;;;;;;AAQA,SAAgB,eACd,SACe;CACf,OAAO;EACL,OAAO,SACL,QAAQ,QAAQ,KAAK,EAAE,KAAI,UACz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