@powerlines/unplugin 0.0.75 → 0.0.76
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 +11 -0
- package/dist/astro.mjs +6 -1
- package/dist/astro.mjs.map +1 -1
- package/dist/astro.test.cjs +23 -0
- package/dist/astro.test.d.cts +1 -0
- package/dist/astro.test.d.mts +2 -0
- package/dist/astro.test.mjs +25 -0
- package/dist/astro.test.mjs.map +1 -0
- package/dist/esbuild.d.cts.map +1 -1
- package/dist/esbuild.d.mts.map +1 -1
- package/dist/esbuild.test.cjs +32 -0
- package/dist/esbuild.test.d.cts +1 -0
- package/dist/esbuild.test.d.mts +2 -0
- package/dist/esbuild.test.mjs +34 -0
- package/dist/esbuild.test.mjs.map +1 -0
- package/dist/farm.cjs +12 -1
- package/dist/farm.d.cts.map +1 -1
- package/dist/farm.d.mts.map +1 -1
- package/dist/farm.mjs +6 -1
- package/dist/farm.mjs.map +1 -1
- package/dist/farm.test.cjs +23 -0
- package/dist/farm.test.d.cts +1 -0
- package/dist/farm.test.d.mts +2 -0
- package/dist/farm.test.mjs +25 -0
- package/dist/farm.test.mjs.map +1 -0
- package/dist/index.cjs +2 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/dist/index.test.cjs +35 -0
- package/dist/index.test.d.cts +1 -0
- package/dist/index.test.d.mts +2 -0
- package/dist/index.test.mjs +37 -0
- package/dist/index.test.mjs.map +1 -0
- package/dist/next.cjs +12 -1
- package/dist/next.mjs +6 -1
- package/dist/next.mjs.map +1 -1
- package/dist/next.test.cjs +23 -0
- package/dist/next.test.d.cts +1 -0
- package/dist/next.test.d.mts +2 -0
- package/dist/next.test.mjs +25 -0
- package/dist/next.test.mjs.map +1 -0
- package/dist/nuxt.cjs +10 -1
- package/dist/nuxt.mjs +3 -1
- package/dist/nuxt.mjs.map +1 -1
- package/dist/nuxt.test.cjs +23 -0
- package/dist/nuxt.test.d.cts +1 -0
- package/dist/nuxt.test.d.mts +2 -0
- package/dist/nuxt.test.mjs +25 -0
- package/dist/nuxt.test.mjs.map +1 -0
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/rolldown.cjs +13 -1
- package/dist/rolldown.d.cts.map +1 -1
- package/dist/rolldown.d.mts.map +1 -1
- package/dist/rolldown.mjs +8 -1
- package/dist/rolldown.mjs.map +1 -1
- package/dist/rolldown.test.cjs +23 -0
- package/dist/rolldown.test.d.cts +1 -0
- package/dist/rolldown.test.d.mts +2 -0
- package/dist/rolldown.test.mjs +25 -0
- package/dist/rolldown.test.mjs.map +1 -0
- package/dist/rollup.cjs +14 -1
- package/dist/rollup.d.cts.map +1 -1
- package/dist/rollup.d.mts.map +1 -1
- package/dist/rollup.mjs +9 -1
- package/dist/rollup.mjs.map +1 -1
- package/dist/rollup.test.cjs +23 -0
- package/dist/rollup.test.d.cts +1 -0
- package/dist/rollup.test.d.mts +2 -0
- package/dist/rollup.test.mjs +25 -0
- package/dist/rollup.test.mjs.map +1 -0
- package/dist/rspack.cjs +13 -1
- package/dist/rspack.d.cts.map +1 -1
- package/dist/rspack.d.mts.map +1 -1
- package/dist/rspack.mjs +8 -1
- package/dist/rspack.mjs.map +1 -1
- package/dist/rspack.test.cjs +23 -0
- package/dist/rspack.test.d.cts +1 -0
- package/dist/rspack.test.d.mts +2 -0
- package/dist/rspack.test.mjs +25 -0
- package/dist/rspack.test.mjs.map +1 -0
- package/dist/tsdown.cjs +16 -1
- package/dist/tsdown.d.cts.map +1 -1
- package/dist/tsdown.d.mts.map +1 -1
- package/dist/tsdown.mjs +11 -1
- package/dist/tsdown.mjs.map +1 -1
- package/dist/tsdown.test.cjs +23 -0
- package/dist/tsdown.test.d.cts +1 -0
- package/dist/tsdown.test.d.mts +2 -0
- package/dist/tsdown.test.mjs +25 -0
- package/dist/tsdown.test.mjs.map +1 -0
- package/dist/tsup.cjs +14 -1
- package/dist/tsup.d.cts.map +1 -1
- package/dist/tsup.d.mts.map +1 -1
- package/dist/tsup.mjs +9 -1
- package/dist/tsup.mjs.map +1 -1
- package/dist/tsup.test.cjs +23 -0
- package/dist/tsup.test.d.cts +1 -0
- package/dist/tsup.test.d.mts +2 -0
- package/dist/tsup.test.mjs +25 -0
- package/dist/tsup.test.mjs.map +1 -0
- package/dist/types.cjs +13 -0
- package/dist/types.mjs +8 -1
- package/dist/types.mjs.map +1 -0
- package/dist/types.test.cjs +23 -0
- package/dist/types.test.d.cts +1 -0
- package/dist/types.test.d.mts +2 -0
- package/dist/types.test.mjs +25 -0
- package/dist/types.test.mjs.map +1 -0
- package/dist/unloader.cjs +13 -1
- package/dist/unloader.d.cts.map +1 -1
- package/dist/unloader.d.mts.map +1 -1
- package/dist/unloader.mjs +7 -1
- package/dist/unloader.mjs.map +1 -1
- package/dist/unloader.test.cjs +23 -0
- package/dist/unloader.test.d.cts +1 -0
- package/dist/unloader.test.d.mts +2 -0
- package/dist/unloader.test.mjs +25 -0
- package/dist/unloader.test.mjs.map +1 -0
- package/dist/unplugin.cjs +8 -0
- package/dist/unplugin.d.cts.map +1 -1
- package/dist/unplugin.d.mts.map +1 -1
- package/dist/unplugin.mjs +4 -1
- package/dist/unplugin.mjs.map +1 -1
- package/dist/unplugin.test.cjs +23 -0
- package/dist/unplugin.test.d.cts +1 -0
- package/dist/unplugin.test.d.mts +2 -0
- package/dist/unplugin.test.mjs +25 -0
- package/dist/unplugin.test.mjs.map +1 -0
- package/dist/vite.d.cts.map +1 -1
- package/dist/vite.d.mts.map +1 -1
- package/dist/vite.test.cjs +26 -0
- package/dist/vite.test.d.cts +1 -0
- package/dist/vite.test.d.mts +2 -0
- package/dist/vite.test.mjs +28 -0
- package/dist/vite.test.mjs.map +1 -0
- package/dist/webpack.cjs +13 -1
- package/dist/webpack.d.cts.map +1 -1
- package/dist/webpack.d.mts.map +1 -1
- package/dist/webpack.mjs +8 -1
- package/dist/webpack.mjs.map +1 -1
- package/dist/webpack.test.cjs +23 -0
- package/dist/webpack.test.d.cts +1 -0
- package/dist/webpack.test.d.mts +2 -0
- package/dist/webpack.test.mjs +25 -0
- package/dist/webpack.test.mjs.map +1 -0
- package/package.json +77 -13
package/dist/unloader.cjs
CHANGED
|
@@ -7,10 +7,16 @@ const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPat
|
|
|
7
7
|
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
8
|
|
|
9
9
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
10
11
|
const require_unplugin = require('./unplugin.cjs');
|
|
11
12
|
let unplugin = require("unplugin");
|
|
12
13
|
|
|
13
14
|
//#region src/unloader.ts
|
|
15
|
+
var unloader_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
16
|
+
createUnloaderFactory: () => createUnloaderFactory,
|
|
17
|
+
default: () => plugin,
|
|
18
|
+
plugin: () => plugin
|
|
19
|
+
});
|
|
14
20
|
/**
|
|
15
21
|
* Creates a Unloader plugin factory that generates a plugin instance.
|
|
16
22
|
*
|
|
@@ -56,4 +62,10 @@ const plugin = (0, unplugin.createUnloaderPlugin)(createUnloaderFactory());
|
|
|
56
62
|
//#endregion
|
|
57
63
|
exports.createUnloaderFactory = createUnloaderFactory;
|
|
58
64
|
exports.default = plugin;
|
|
59
|
-
exports.plugin = plugin;
|
|
65
|
+
exports.plugin = plugin;
|
|
66
|
+
Object.defineProperty(exports, 'unloader_exports', {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return unloader_exports;
|
|
70
|
+
}
|
|
71
|
+
});
|
package/dist/unloader.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unloader.d.cts","names":[],"sources":["../src/unloader.ts"],"mappings":";;;;;;;;AA8CA;;;;;;;;;;;;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,
|
|
1
|
+
{"version":3,"file":"unloader.d.cts","names":[],"sources":["../src/unloader.ts"],"mappings":";;;;;;;;AA8CA;;;;;;;;;;;;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,EACrD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;;;;;;;AAAA;AAqBnE;;;;;;;cAAa,MAAA,GAAM,OAAA,GAAgD,wBAAhD,oCAAA,MAAA,sBAAA,MAAA"}
|
package/dist/unloader.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unloader.d.mts","names":[],"sources":["../src/unloader.ts"],"mappings":";;;;;;;;;;;;;;;;;;AA8CA;;;;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,
|
|
1
|
+
{"version":3,"file":"unloader.d.mts","names":[],"sources":["../src/unloader.ts"],"mappings":";;;;;;;;;;;;;;;;;;AA8CA;;;;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,EACrD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;;;;;;;;;;;;;;;cAqBtD,MAAA,GAAM,OAAA,GAAgD,wBAAhD,oCAAA,MAAA,sBAAA,MAAA"}
|
package/dist/unloader.mjs
CHANGED
|
@@ -6,10 +6,16 @@ import __tsdown_shims_url from 'node:url'
|
|
|
6
6
|
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
7
|
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
8
|
|
|
9
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
9
10
|
import { createUnpluginFactory } from "./unplugin.mjs";
|
|
10
11
|
import { createUnloaderPlugin } from "unplugin";
|
|
11
12
|
|
|
12
13
|
//#region src/unloader.ts
|
|
14
|
+
var unloader_exports = /* @__PURE__ */ __exportAll({
|
|
15
|
+
createUnloaderFactory: () => createUnloaderFactory,
|
|
16
|
+
default: () => plugin,
|
|
17
|
+
plugin: () => plugin
|
|
18
|
+
});
|
|
13
19
|
/**
|
|
14
20
|
* Creates a Unloader plugin factory that generates a plugin instance.
|
|
15
21
|
*
|
|
@@ -53,5 +59,5 @@ function createUnloaderFactory(options = {}, decorate = (options) => options) {
|
|
|
53
59
|
const plugin = createUnloaderPlugin(createUnloaderFactory());
|
|
54
60
|
|
|
55
61
|
//#endregion
|
|
56
|
-
export { createUnloaderFactory, plugin as default, plugin };
|
|
62
|
+
export { createUnloaderFactory, plugin as default, plugin, unloader_exports };
|
|
57
63
|
//# sourceMappingURL=unloader.mjs.map
|
package/dist/unloader.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unloader.mjs","names":[],"sources":["../src/unloader.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 { ExecutionContext, UnpluginOptions } from \"@powerlines/core\";\nimport { createUnloaderPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Creates a Unloader plugin factory that generates a plugin instance.\n *\n * @example\n * ```js\n * // unloader.config.js\n * import { createUnloaderFactory } from \"@powerlines/unplugin/unloader\";\n *\n * const powerlinesPlugin = createUnloaderFactory({ 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 Unloader plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Unloader build.\n */\nexport function createUnloaderFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"unloader\" }, unplugin =>\n decorate(unplugin as UnpluginOptions<TContext>)\n );\n}\n\n/**\n * An Unloader plugin that will invoke the Powerlines API hooks during processing.\n *\n * @example\n * ```js\n * // unloader.config.js\n * import powerlines from \"@powerlines/unplugin/unloader\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\nexport const plugin = createUnloaderPlugin(createUnloaderFactory());\n\nexport default plugin;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"unloader.mjs","names":[],"sources":["../src/unloader.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 { ExecutionContext, UnpluginOptions } from \"@powerlines/core\";\nimport { createUnloaderPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Creates a Unloader plugin factory that generates a plugin instance.\n *\n * @example\n * ```js\n * // unloader.config.js\n * import { createUnloaderFactory } from \"@powerlines/unplugin/unloader\";\n *\n * const powerlinesPlugin = createUnloaderFactory({ 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 Unloader plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Unloader build.\n */\nexport function createUnloaderFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"unloader\" }, unplugin =>\n decorate(unplugin as UnpluginOptions<TContext>)\n );\n}\n\n/**\n * An Unloader plugin that will invoke the Powerlines API hooks during processing.\n *\n * @example\n * ```js\n * // unloader.config.js\n * import powerlines from \"@powerlines/unplugin/unloader\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\nexport const plugin = createUnloaderPlugin(createUnloaderFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,SAAgB,sBACd,UAAmD,CAAC,GACpD,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;CAAW,IAAG,aAChE,SAAS,QAAqC,CAChD;AACF;;;;;;;;;;;;;;;AAgBA,MAAa,SAAS,qBAAqB,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
const require_unloader = require('./unloader.cjs');
|
|
10
|
+
let vitest = require("vitest");
|
|
11
|
+
|
|
12
|
+
//#region src/unloader.test.ts
|
|
13
|
+
(0, vitest.describe)("devkit/unplugin/src/unloader.ts", () => {
|
|
14
|
+
(0, vitest.it)("loads module exports", () => {
|
|
15
|
+
(0, vitest.expect)(require_unloader.unloader_exports).toBeDefined();
|
|
16
|
+
(0, vitest.expect)(typeof require_unloader.unloader_exports).toBe("object");
|
|
17
|
+
});
|
|
18
|
+
(0, vitest.it)("has at least one runtime export", () => {
|
|
19
|
+
(0, vitest.expect)(Object.keys(require_unloader.unloader_exports).length).toBeGreaterThan(0);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { unloader_exports } from "./unloader.mjs";
|
|
10
|
+
import { describe, expect, it } from "vitest";
|
|
11
|
+
|
|
12
|
+
//#region src/unloader.test.ts
|
|
13
|
+
describe("devkit/unplugin/src/unloader.ts", () => {
|
|
14
|
+
it("loads module exports", () => {
|
|
15
|
+
expect(unloader_exports).toBeDefined();
|
|
16
|
+
expect(typeof unloader_exports).toBe("object");
|
|
17
|
+
});
|
|
18
|
+
it("has at least one runtime export", () => {
|
|
19
|
+
expect(Object.keys(unloader_exports).length).toBeGreaterThan(0);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { };
|
|
25
|
+
//# sourceMappingURL=unloader.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unloader.test.mjs","names":["moduleExports"],"sources":["../src/unloader.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./unloader\";\n\ndescribe(\"devkit/unplugin/src/unloader.ts\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n\n it(\"has at least one runtime export\", () => {\n expect(Object.keys(moduleExports).length).toBeGreaterThan(0);\n });\n});\n"],"mappings":";;;;;;;;;;;;AAGA,SAAS,yCAAyC;CAChD,GAAG,8BAA8B;EAC/B,OAAOA,gBAAa,EAAE,YAAY;EAClC,OAAO,OAAOA,gBAAa,EAAE,KAAK,QAAQ;CAC5C,CAAC;CAED,GAAG,yCAAyC;EAC1C,OAAO,OAAO,KAAKA,gBAAa,EAAE,MAAM,EAAE,gBAAgB,CAAC;CAC7D,CAAC;AACH,CAAC"}
|
package/dist/unplugin.cjs
CHANGED
|
@@ -27,6 +27,8 @@ let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-obje
|
|
|
27
27
|
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
28
28
|
|
|
29
29
|
//#region src/unplugin.ts
|
|
30
|
+
var unplugin_exports = /* @__PURE__ */ require_runtime.__exportAll({ createUnpluginFactory: () => createUnpluginFactory });
|
|
31
|
+
require_runtime.__reExport(unplugin_exports, require("@powerlines/core/lib/unplugin"));
|
|
30
32
|
/**
|
|
31
33
|
* Creates a Powerlines unplugin factory that generates a plugin instance.
|
|
32
34
|
*
|
|
@@ -240,6 +242,12 @@ function createUnpluginFactory(options, decorate = (options) => options) {
|
|
|
240
242
|
|
|
241
243
|
//#endregion
|
|
242
244
|
exports.createUnpluginFactory = createUnpluginFactory;
|
|
245
|
+
Object.defineProperty(exports, 'unplugin_exports', {
|
|
246
|
+
enumerable: true,
|
|
247
|
+
get: function () {
|
|
248
|
+
return unplugin_exports;
|
|
249
|
+
}
|
|
250
|
+
});
|
|
243
251
|
var _powerlines_core_lib_unplugin = require("@powerlines/core/lib/unplugin");
|
|
244
252
|
Object.keys(_powerlines_core_lib_unplugin).forEach(function (k) {
|
|
245
253
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
package/dist/unplugin.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unplugin.d.cts","names":[],"sources":["../src/unplugin.ts"],"mappings":";;;;;;;;UAuEiB,sBAAA,SAA+B,OAAA;EAA/B;;;;;;EAOf,OAAA,EAAS,sBAAA;EAP4C;;;;;EAcrD,mBAAA;EAQe;;AAAY;AAG7B;;;EAHE,YAAA,GAAe,YAAA;AAAA;AAAA,KAGL,wBAAA,kBAA0C,gBAAA,KACpD,OAAA,EAAS,eAAA,CAAgB,QAAA,MACtB,OAAA,CAAQ,eAAA,CAAgB,QAAA;;;;;;;;;;;;;;;AAAQ;AA2BrC;;;;;;;;;;iBAAgB,qBAAA,kBACG,gBAAA,GAAmB,gBAAA,
|
|
1
|
+
{"version":3,"file":"unplugin.d.cts","names":[],"sources":["../src/unplugin.ts"],"mappings":";;;;;;;;UAuEiB,sBAAA,SAA+B,OAAA;EAA/B;;;;;;EAOf,OAAA,EAAS,sBAAA;EAP4C;;;;;EAcrD,mBAAA;EAQe;;AAAY;AAG7B;;;EAHE,YAAA,GAAe,YAAA;AAAA;AAAA,KAGL,wBAAA,kBAA0C,gBAAA,KACpD,OAAA,EAAS,eAAA,CAAgB,QAAA,MACtB,OAAA,CAAQ,eAAA,CAAgB,QAAA;;;;;;;;;;;;;;;AAAQ;AA2BrC;;;;;;;;;;iBAAgB,qBAAA,kBACG,gBAAA,GAAmB,gBAAA,EAEpC,OAAA,EAAS,sBAAA,EACT,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAClC,eAAA,CAAgB,QAAA"}
|
package/dist/unplugin.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unplugin.d.mts","names":[],"sources":["../src/unplugin.ts"],"mappings":";;;;;;;;;;UAuEiB,sBAAA,SAA+B,OAAA;;;;;;;EAO9C,OAAA,EAAS,sBAAA;;AAPX;;;;EAcE,mBAAA;EAd8C;;;;;;EAsB9C,YAAA,GAAe,YAAA;AAAA;AAAA,KAGL,wBAAA,kBAA0C,gBAAA,KACpD,OAAA,EAAS,eAAA,CAAgB,QAAA,MACtB,OAAA,CAAQ,eAAA,CAAgB,QAAA;;AALA;AAG7B;;;;;;;;;;;;;;;;;;;;AAEqC;AA2BrC;;iBAAgB,qBAAA,kBACG,gBAAA,GAAmB,gBAAA,
|
|
1
|
+
{"version":3,"file":"unplugin.d.mts","names":[],"sources":["../src/unplugin.ts"],"mappings":";;;;;;;;;;UAuEiB,sBAAA,SAA+B,OAAA;;;;;;;EAO9C,OAAA,EAAS,sBAAA;;AAPX;;;;EAcE,mBAAA;EAd8C;;;;;;EAsB9C,YAAA,GAAe,YAAA;AAAA;AAAA,KAGL,wBAAA,kBAA0C,gBAAA,KACpD,OAAA,EAAS,eAAA,CAAgB,QAAA,MACtB,OAAA,CAAQ,eAAA,CAAgB,QAAA;;AALA;AAG7B;;;;;;;;;;;;;;;;;;;;AAEqC;AA2BrC;;iBAAgB,qBAAA,kBACG,gBAAA,GAAmB,gBAAA,EAEpC,OAAA,EAAS,sBAAA,EACT,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAClC,eAAA,CAAgB,QAAA"}
|
package/dist/unplugin.mjs
CHANGED
|
@@ -28,6 +28,9 @@ import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
|
28
28
|
export * from "@powerlines/core/lib/unplugin"
|
|
29
29
|
|
|
30
30
|
//#region src/unplugin.ts
|
|
31
|
+
var unplugin_exports = /* @__PURE__ */ __exportAll({ createUnpluginFactory: () => createUnpluginFactory });
|
|
32
|
+
import * as import__powerlines_core_lib_unplugin from "@powerlines/core/lib/unplugin";
|
|
33
|
+
__reExport(unplugin_exports, import__powerlines_core_lib_unplugin);
|
|
31
34
|
/**
|
|
32
35
|
* Creates a Powerlines unplugin factory that generates a plugin instance.
|
|
33
36
|
*
|
|
@@ -240,5 +243,5 @@ function createUnpluginFactory(options, decorate = (options) => options) {
|
|
|
240
243
|
}
|
|
241
244
|
|
|
242
245
|
//#endregion
|
|
243
|
-
export { createUnpluginFactory };
|
|
246
|
+
export { createUnpluginFactory, unplugin_exports };
|
|
244
247
|
//# sourceMappingURL=unplugin.mjs.map
|
package/dist/unplugin.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unplugin.mjs","names":[],"sources":["../src/unplugin.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 CustomLogger,\n ExecutionContext,\n Options,\n UnpluginBuilderVariant,\n UnpluginOptions\n} from \"@powerlines/core\";\nimport {\n formatFolder,\n handleTypes,\n initializeTsconfig,\n installDependencies,\n isUnpluginBuilderVariant,\n loadParsedConfig,\n resolveRoot,\n resolveTsconfig,\n writeMetaFile\n} from \"@powerlines/core\";\nimport { UNPLUGIN_BUILDER_VARIANTS } from \"@powerlines/core/constants\";\nimport { PowerlinesExecutionContext } from \"@powerlines/core/context/execution-context\";\nimport { resolvePluginConfig } from \"@powerlines/core/lib/context-helpers\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { getString } from \"@powerlines/core/lib/utilities/source-file\";\nimport {\n addVirtualPrefix,\n formatConfig,\n formatExecutionId,\n removeVirtualPrefix,\n VIRTUAL_MODULE_PREFIX_REGEX\n} from \"@powerlines/core/plugin-utils\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getWorkspaceRoot } from \"@stryke/fs/get-workspace-root\";\nimport { createDirectory } from \"@stryke/fs/helpers\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { LoadResult } from \"rolldown\";\nimport type {\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { UnpluginFactory } from \"./types\";\n\nexport * from \"@powerlines/core/lib/unplugin\";\n\n/**\n * The options required to create a Powerlines unplugin factory, which generates a plugin instance for a specific build variant and allows for optional customization of logging and framework identification.\n */\nexport interface UnpluginFactoryOptions extends Options {\n /**\n * The build variant for which to create the unplugin.\n *\n * @remarks\n * This option is required to ensure that the unplugin is built with the correct configuration and behavior for the intended build tool or framework. The variant will determine how the unplugin integrates with the build process and which hooks it will call during execution.\n */\n variant: UnpluginBuilderVariant;\n\n /**\n * An optional string prefix to use for virtual module IDs. This can be useful for ensuring that virtual modules are only processed by the plugin and not by other plugins or the bundler itself. If not provided, the default prefix `__powerlines-virtual:` will be used.\n *\n * @defaultValue \"\\\\0\"\n */\n virtualModulePrefix?: string | false;\n\n /**\n * A custom logger instance that implements the {@link CustomLogger} interface, which can be used for logging messages during the build process instead of the default Powerlines logger.\n *\n * @remarks\n * Providing a custom logger allows you to integrate Powerlines logging with your own logging system or to customize the logging behavior, such as formatting log messages differently or sending logs to an external service. If a custom logger is not provided, Powerlines will use its default logger implementation.\n */\n customLogger?: CustomLogger;\n}\n\nexport type UnpluginFactoryDecorator<TContext extends ExecutionContext> = (\n options: UnpluginOptions<TContext>\n) => Partial<UnpluginOptions<TContext>>;\n\n/**\n * Creates a Powerlines unplugin factory that generates a plugin instance.\n *\n * @remarks\n * The factory will handle loading the Powerlines configuration, resolving the plugin configuration, and executing the appropriate hooks during the build process. It also allows for optional customization of logging and framework identification through the provided options.\n *\n * @example\n * ```ts\n * import { createUnpluginFactory } from \"@powerlines/unplugin\";\n *\n * const factory = createUnpluginFactory({\n * variant: \"vite\",\n * framework: \"my-framework\",\n * orgId: \"my-org\",\n * customLogger: myCustomLogger\n * });\n *\n * const plugin = createVitePlugin(factory);\n * export default plugin;\n * ```\n *\n * @param options - The options for the unplugin factory, including the build variant and an optional custom logger.\n * @param decorate - An optional function to decorate the unplugin options.\n * @returns The unplugin factory that generates a plugin instance.\n */\nexport function createUnpluginFactory<\n TContext extends ExecutionContext = ExecutionContext\n>(\n options: UnpluginFactoryOptions,\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n): UnpluginFactory<TContext> {\n if (!isUnpluginBuilderVariant(options.variant)) {\n throw new Error(\n `Invalid unplugin builder variant: ${String(options.variant)}. Expected one of: ${UNPLUGIN_BUILDER_VARIANTS.join(\n \", \"\n )}.`\n );\n }\n\n const cwd = getWorkspaceRoot(process.cwd());\n const virtualModulePrefix = options.virtualModulePrefix ?? \"\\\\0\";\n\n return (params = {}): UnpluginOptions<TContext> => {\n let context!: ExecutionContext<TContext[\"config\"], TContext[\"system\"]>;\n try {\n const framework =\n (params.framework?.name ?? options.framework?.name) || \"powerlines\";\n const orgId =\n (params.framework?.orgId ?? options.framework?.orgId) ||\n \"storm-software\";\n\n const root = resolveRoot(cwd, params.root, params.configFile);\n\n async function buildStart(this: UnpluginBuildContext): Promise<void> {\n const config = await loadParsedConfig(cwd, root, framework, orgId, {\n ...params,\n command: \"build\"\n });\n if (!config) {\n throw new Error(\"Failed to load configuration\");\n }\n\n const configs = toArray(config.config);\n if (\n params.configIndex !== undefined &&\n params.configIndex >= configs.length\n ) {\n throw new Error(\n `Invalid execution index: ${params.configIndex}. The configuration file contains ${configs.length} execution(s).`\n );\n }\n\n const _options = {\n cwd,\n root,\n ...params,\n command: \"build\",\n configFile: config.configFile!,\n executionId: formatExecutionId(\n config.config.name || root,\n \"build\",\n 0\n ),\n configIndex: 0\n };\n\n context = await PowerlinesExecutionContext.from(\n {\n ...options,\n ..._options,\n configFile: config.configFile!\n },\n _options\n );\n context.logger.info(\n `Starting ${titleCase(framework)} ${titleCase(options.variant)} plugin execution`\n );\n\n context.logger.debug({\n meta: { category: \"config\" },\n message: `Invoking ${titleCase(framework)} ${titleCase(\n options.variant\n )} plugin with the following execution parameters: \\n --- Execution Options --- \\n${formatConfig(\n params\n )}`\n });\n\n await resolvePluginConfig(context);\n\n const timer = context.timer(\"Preparation\");\n\n await executeEnvironments(context, async env => {\n env.debug(\n `Initializing the processing options for the Powerlines project.`\n );\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"pre\"\n });\n\n await initializeTsconfig(env);\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"normal\"\n });\n\n if (env.entry.length > 0) {\n const entriesLength = isObject(env.config.input)\n ? Object.keys(env.config.input).length\n : toArray(env.config.input).length;\n env.debug(\n `The configuration provided ${entriesLength} entry point${\n entriesLength !== 1 ? \"s\" : \"\"\n }, Powerlines has found ${env.entry.length} entry file${\n env.entry.length !== 1 ? \"s\" : \"\"\n } for the ${env.config.title} project${\n env.entry.length > 0 && env.entry.length < 10\n ? `: \\n${env.entry\n .map(\n entry =>\n `- ${replacePath(entry.file, context.config.root)}${\n entry.output\n ? ` -> ${replacePath(\n entry.output,\n context.config.root\n )}`\n : \"\"\n }`\n )\n .join(\" \\n\")}`\n : \"\"\n }`\n );\n } else {\n env.warn(\n `No entry files were found for the ${\n env.config.title\n } project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`\n );\n }\n\n await resolveTsconfig(env);\n await installDependencies(env);\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"post\"\n });\n\n env.trace({\n meta: {\n category: \"config\"\n },\n message: `Powerlines configuration after configResolved hook: \\n${formatConfig(\n env.config\n )}`\n });\n\n if (!env.fs.existsSync(env.cachePath)) {\n await createDirectory(env.cachePath);\n }\n\n if (!env.fs.existsSync(env.dataPath)) {\n await createDirectory(env.dataPath);\n }\n\n await context.callHook(\"prepare\", {\n environment: env,\n order: \"pre\"\n });\n await context.callHook(\"prepare\", {\n environment: env,\n order: \"normal\"\n });\n\n await context.callHook(\"prepare\", {\n environment: env,\n order: \"post\"\n });\n\n if (env.config.output.types !== false) {\n await handleTypes(context, env);\n }\n\n context.debug(\"Formatting files generated during the prepare step.\");\n\n await Promise.all([\n formatFolder(env, env.builtinsPath),\n formatFolder(env, env.entryPath)\n ]);\n\n await writeMetaFile(env);\n env.persistedMeta = env.meta;\n });\n\n timer();\n }\n\n async function resolveId(\n this: UnpluginBuildContext & UnpluginContext,\n id: string,\n importer?: string,\n opts: {\n isEntry: boolean;\n } = { isEntry: false }\n ) {\n const normalizedId = removeVirtualPrefix(id);\n const normalizedImporter = importer\n ? removeVirtualPrefix(importer)\n : undefined;\n\n let result = await context.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && virtualModulePrefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n result = await context.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && virtualModulePrefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n result = await context.resolve(normalizedId, normalizedImporter, {\n isFile: true,\n ...opts\n });\n if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && virtualModulePrefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n result = await context.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && virtualModulePrefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n return null;\n }\n\n const load = {\n filter:\n virtualModulePrefix !== false\n ? {\n id: VIRTUAL_MODULE_PREFIX_REGEX\n }\n : undefined,\n async handler(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<LoadResult | null | undefined> {\n const normalizedId = removeVirtualPrefix(id);\n\n let result = await context.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n normalizedId\n );\n if (result) {\n return result;\n }\n\n result = await context.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n normalizedId\n );\n if (result) {\n return result;\n }\n\n result = await context.load(normalizedId);\n if (result) {\n return result;\n }\n\n return context.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n normalizedId\n );\n }\n } as UnpluginOptions<TContext>[\"load\"];\n\n async function transform(\n code: string,\n id: string\n ): Promise<TransformResult> {\n return context.callHook(\n \"transform\",\n {\n environment: await context.getEnvironment(),\n result: \"merge\",\n asNextParam: previousResult => getString(previousResult)\n },\n getString(code),\n id\n );\n }\n\n async function writeBundle(): Promise<void> {\n context.logger.debug(\"Finalizing Powerlines project output...\");\n\n await context.callHook(\"writeBundle\", {\n environment: await context.getEnvironment()\n });\n }\n\n context.logger.debug(\"Unplugin initialized successfully.\");\n\n const result = {\n name: `${kebabCase(framework)}:${kebabCase(options.variant)}-plugin`,\n context,\n resolveId,\n load,\n transform,\n buildStart,\n writeBundle\n } as unknown as UnpluginOptions<TContext>;\n\n return {\n ...result,\n ...decorate(result)\n };\n } catch (error) {\n if (isFunction(context?.logger?.error)) {\n context.logger.error((error as Error)?.message);\n }\n\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6HA,SAAgB,sBAGd,SACA,YAA+C,YAAW,SAC/B;CAC3B,IAAI,CAAC,yBAAyB,QAAQ,OAAO,GAC3C,MAAM,IAAI,MACR,qCAAqC,OAAO,QAAQ,OAAO,EAAE,qBAAqB,0BAA0B,KAC1G,IACF,EAAE,EACJ;CAGF,MAAM,MAAM,iBAAiB,QAAQ,IAAI,CAAC;CAC1C,MAAM,sBAAsB,QAAQ,uBAAuB;CAE3D,QAAQ,SAAS,CAAC,MAAiC;EACjD,IAAI;EACJ,IAAI;GACF,MAAM,aACH,OAAO,WAAW,QAAQ,QAAQ,WAAW,SAAS;GACzD,MAAM,SACH,OAAO,WAAW,SAAS,QAAQ,WAAW,UAC/C;GAEF,MAAM,OAAO,YAAY,KAAK,OAAO,MAAM,OAAO,UAAU;GAE5D,eAAe,aAAsD;IACnE,MAAM,SAAS,MAAM,iBAAiB,KAAK,MAAM,WAAW,OAAO;KACjE,GAAG;KACH,SAAS;IACX,CAAC;IACD,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,8BAA8B;IAGhD,MAAM,UAAU,QAAQ,OAAO,MAAM;IACrC,IAC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;MACE,YAAY;MACZ,QAAQ;MACR,OAAO;KACT,GACA,YACF;KACA,IAAI,QACF,OAAO;KAGT,SAAS,MAAM,QAAQ,KAAK,YAAY;KACxC,IAAI,QACF,OAAO;KAGT,OAAO,QAAQ,SACb,QACA;MACE,YAAY;MACZ,QAAQ;MACR,OAAO;KACT,GACA,YACF;IACF;GACF;GAEA,eAAe,UACb,MACA,IAC0B;IAC1B,OAAO,QAAQ,SACb,aACA;KACE,aAAa,MAAM,QAAQ,eAAe;KAC1C,QAAQ;KACR,cAAa,mBAAkB,UAAU,cAAc;IACzD,GACA,UAAU,IAAI,GACd,EACF;GACF;GAEA,eAAe,cAA6B;IAC1C,QAAQ,OAAO,MAAM,yCAAyC;IAE9D,MAAM,QAAQ,SAAS,eAAe,EACpC,aAAa,MAAM,QAAQ,eAAe,EAC5C,CAAC;GACH;GAEA,QAAQ,OAAO,MAAM,oCAAoC;GAEzD,MAAM,SAAS;IACb,MAAM,GAAG,UAAU,SAAS,EAAE,GAAG,UAAU,QAAQ,OAAO,EAAE;IAC5D;IACA;IACA;IACA;IACA;IACA;GACF;GAEA,OAAO;IACL,GAAG;IACH,GAAG,SAAS,MAAM;GACpB;EACF,SAAS,OAAO;GACd,IAAI,WAAW,SAAS,QAAQ,KAAK,GACnC,QAAQ,OAAO,MAAO,OAAiB,OAAO;GAGhD,MAAM;EACR;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"unplugin.mjs","names":[],"sources":["../src/unplugin.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 CustomLogger,\n ExecutionContext,\n Options,\n UnpluginBuilderVariant,\n UnpluginOptions\n} from \"@powerlines/core\";\nimport {\n formatFolder,\n handleTypes,\n initializeTsconfig,\n installDependencies,\n isUnpluginBuilderVariant,\n loadParsedConfig,\n resolveRoot,\n resolveTsconfig,\n writeMetaFile\n} from \"@powerlines/core\";\nimport { UNPLUGIN_BUILDER_VARIANTS } from \"@powerlines/core/constants\";\nimport { PowerlinesExecutionContext } from \"@powerlines/core/context/execution-context\";\nimport { resolvePluginConfig } from \"@powerlines/core/lib/context-helpers\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { getString } from \"@powerlines/core/lib/utilities/source-file\";\nimport {\n addVirtualPrefix,\n formatConfig,\n formatExecutionId,\n removeVirtualPrefix,\n VIRTUAL_MODULE_PREFIX_REGEX\n} from \"@powerlines/core/plugin-utils\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getWorkspaceRoot } from \"@stryke/fs/get-workspace-root\";\nimport { createDirectory } from \"@stryke/fs/helpers\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { LoadResult } from \"rolldown\";\nimport type {\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { UnpluginFactory } from \"./types\";\n\nexport * from \"@powerlines/core/lib/unplugin\";\n\n/**\n * The options required to create a Powerlines unplugin factory, which generates a plugin instance for a specific build variant and allows for optional customization of logging and framework identification.\n */\nexport interface UnpluginFactoryOptions extends Options {\n /**\n * The build variant for which to create the unplugin.\n *\n * @remarks\n * This option is required to ensure that the unplugin is built with the correct configuration and behavior for the intended build tool or framework. The variant will determine how the unplugin integrates with the build process and which hooks it will call during execution.\n */\n variant: UnpluginBuilderVariant;\n\n /**\n * An optional string prefix to use for virtual module IDs. This can be useful for ensuring that virtual modules are only processed by the plugin and not by other plugins or the bundler itself. If not provided, the default prefix `__powerlines-virtual:` will be used.\n *\n * @defaultValue \"\\\\0\"\n */\n virtualModulePrefix?: string | false;\n\n /**\n * A custom logger instance that implements the {@link CustomLogger} interface, which can be used for logging messages during the build process instead of the default Powerlines logger.\n *\n * @remarks\n * Providing a custom logger allows you to integrate Powerlines logging with your own logging system or to customize the logging behavior, such as formatting log messages differently or sending logs to an external service. If a custom logger is not provided, Powerlines will use its default logger implementation.\n */\n customLogger?: CustomLogger;\n}\n\nexport type UnpluginFactoryDecorator<TContext extends ExecutionContext> = (\n options: UnpluginOptions<TContext>\n) => Partial<UnpluginOptions<TContext>>;\n\n/**\n * Creates a Powerlines unplugin factory that generates a plugin instance.\n *\n * @remarks\n * The factory will handle loading the Powerlines configuration, resolving the plugin configuration, and executing the appropriate hooks during the build process. It also allows for optional customization of logging and framework identification through the provided options.\n *\n * @example\n * ```ts\n * import { createUnpluginFactory } from \"@powerlines/unplugin\";\n *\n * const factory = createUnpluginFactory({\n * variant: \"vite\",\n * framework: \"my-framework\",\n * orgId: \"my-org\",\n * customLogger: myCustomLogger\n * });\n *\n * const plugin = createVitePlugin(factory);\n * export default plugin;\n * ```\n *\n * @param options - The options for the unplugin factory, including the build variant and an optional custom logger.\n * @param decorate - An optional function to decorate the unplugin options.\n * @returns The unplugin factory that generates a plugin instance.\n */\nexport function createUnpluginFactory<\n TContext extends ExecutionContext = ExecutionContext\n>(\n options: UnpluginFactoryOptions,\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n): UnpluginFactory<TContext> {\n if (!isUnpluginBuilderVariant(options.variant)) {\n throw new Error(\n `Invalid unplugin builder variant: ${String(options.variant)}. Expected one of: ${UNPLUGIN_BUILDER_VARIANTS.join(\n \", \"\n )}.`\n );\n }\n\n const cwd = getWorkspaceRoot(process.cwd());\n const virtualModulePrefix = options.virtualModulePrefix ?? \"\\\\0\";\n\n return (params = {}): UnpluginOptions<TContext> => {\n let context!: ExecutionContext<TContext[\"config\"], TContext[\"system\"]>;\n try {\n const framework =\n (params.framework?.name ?? options.framework?.name) || \"powerlines\";\n const orgId =\n (params.framework?.orgId ?? options.framework?.orgId) ||\n \"storm-software\";\n\n const root = resolveRoot(cwd, params.root, params.configFile);\n\n async function buildStart(this: UnpluginBuildContext): Promise<void> {\n const config = await loadParsedConfig(cwd, root, framework, orgId, {\n ...params,\n command: \"build\"\n });\n if (!config) {\n throw new Error(\"Failed to load configuration\");\n }\n\n const configs = toArray(config.config);\n if (\n params.configIndex !== undefined &&\n params.configIndex >= configs.length\n ) {\n throw new Error(\n `Invalid execution index: ${params.configIndex}. The configuration file contains ${configs.length} execution(s).`\n );\n }\n\n const _options = {\n cwd,\n root,\n ...params,\n command: \"build\",\n configFile: config.configFile!,\n executionId: formatExecutionId(\n config.config.name || root,\n \"build\",\n 0\n ),\n configIndex: 0\n };\n\n context = await PowerlinesExecutionContext.from(\n {\n ...options,\n ..._options,\n configFile: config.configFile!\n },\n _options\n );\n context.logger.info(\n `Starting ${titleCase(framework)} ${titleCase(options.variant)} plugin execution`\n );\n\n context.logger.debug({\n meta: { category: \"config\" },\n message: `Invoking ${titleCase(framework)} ${titleCase(\n options.variant\n )} plugin with the following execution parameters: \\n --- Execution Options --- \\n${formatConfig(\n params\n )}`\n });\n\n await resolvePluginConfig(context);\n\n const timer = context.timer(\"Preparation\");\n\n await executeEnvironments(context, async env => {\n env.debug(\n `Initializing the processing options for the Powerlines project.`\n );\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"pre\"\n });\n\n await initializeTsconfig(env);\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"normal\"\n });\n\n if (env.entry.length > 0) {\n const entriesLength = isObject(env.config.input)\n ? Object.keys(env.config.input).length\n : toArray(env.config.input).length;\n env.debug(\n `The configuration provided ${entriesLength} entry point${\n entriesLength !== 1 ? \"s\" : \"\"\n }, Powerlines has found ${env.entry.length} entry file${\n env.entry.length !== 1 ? \"s\" : \"\"\n } for the ${env.config.title} project${\n env.entry.length > 0 && env.entry.length < 10\n ? `: \\n${env.entry\n .map(\n entry =>\n `- ${replacePath(entry.file, context.config.root)}${\n entry.output\n ? ` -> ${replacePath(\n entry.output,\n context.config.root\n )}`\n : \"\"\n }`\n )\n .join(\" \\n\")}`\n : \"\"\n }`\n );\n } else {\n env.warn(\n `No entry files were found for the ${\n env.config.title\n } project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`\n );\n }\n\n await resolveTsconfig(env);\n await installDependencies(env);\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"post\"\n });\n\n env.trace({\n meta: {\n category: \"config\"\n },\n message: `Powerlines configuration after configResolved hook: \\n${formatConfig(\n env.config\n )}`\n });\n\n if (!env.fs.existsSync(env.cachePath)) {\n await createDirectory(env.cachePath);\n }\n\n if (!env.fs.existsSync(env.dataPath)) {\n await createDirectory(env.dataPath);\n }\n\n await context.callHook(\"prepare\", {\n environment: env,\n order: \"pre\"\n });\n await context.callHook(\"prepare\", {\n environment: env,\n order: \"normal\"\n });\n\n await context.callHook(\"prepare\", {\n environment: env,\n order: \"post\"\n });\n\n if (env.config.output.types !== false) {\n await handleTypes(context, env);\n }\n\n context.debug(\"Formatting files generated during the prepare step.\");\n\n await Promise.all([\n formatFolder(env, env.builtinsPath),\n formatFolder(env, env.entryPath)\n ]);\n\n await writeMetaFile(env);\n env.persistedMeta = env.meta;\n });\n\n timer();\n }\n\n async function resolveId(\n this: UnpluginBuildContext & UnpluginContext,\n id: string,\n importer?: string,\n opts: {\n isEntry: boolean;\n } = { isEntry: false }\n ) {\n const normalizedId = removeVirtualPrefix(id);\n const normalizedImporter = importer\n ? removeVirtualPrefix(importer)\n : undefined;\n\n let result = await context.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && virtualModulePrefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n result = await context.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && virtualModulePrefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n result = await context.resolve(normalizedId, normalizedImporter, {\n isFile: true,\n ...opts\n });\n if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && virtualModulePrefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n result = await context.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && virtualModulePrefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n return null;\n }\n\n const load = {\n filter:\n virtualModulePrefix !== false\n ? {\n id: VIRTUAL_MODULE_PREFIX_REGEX\n }\n : undefined,\n async handler(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<LoadResult | null | undefined> {\n const normalizedId = removeVirtualPrefix(id);\n\n let result = await context.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n normalizedId\n );\n if (result) {\n return result;\n }\n\n result = await context.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n normalizedId\n );\n if (result) {\n return result;\n }\n\n result = await context.load(normalizedId);\n if (result) {\n return result;\n }\n\n return context.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n normalizedId\n );\n }\n } as UnpluginOptions<TContext>[\"load\"];\n\n async function transform(\n code: string,\n id: string\n ): Promise<TransformResult> {\n return context.callHook(\n \"transform\",\n {\n environment: await context.getEnvironment(),\n result: \"merge\",\n asNextParam: previousResult => getString(previousResult)\n },\n getString(code),\n id\n );\n }\n\n async function writeBundle(): Promise<void> {\n context.logger.debug(\"Finalizing Powerlines project output...\");\n\n await context.callHook(\"writeBundle\", {\n environment: await context.getEnvironment()\n });\n }\n\n context.logger.debug(\"Unplugin initialized successfully.\");\n\n const result = {\n name: `${kebabCase(framework)}:${kebabCase(options.variant)}-plugin`,\n context,\n resolveId,\n load,\n transform,\n buildStart,\n writeBundle\n } as unknown as UnpluginOptions<TContext>;\n\n return {\n ...result,\n ...decorate(result)\n };\n } catch (error) {\n if (isFunction(context?.logger?.error)) {\n context.logger.error((error as Error)?.message);\n }\n\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6HA,SAAgB,sBAGd,SACA,YAA+C,YAAW,SAC/B;CAC3B,IAAI,CAAC,yBAAyB,QAAQ,OAAO,GAC3C,MAAM,IAAI,MACR,qCAAqC,OAAO,QAAQ,OAAO,EAAE,qBAAqB,0BAA0B,KAC1G,IACF,EAAE,EACJ;CAGF,MAAM,MAAM,iBAAiB,QAAQ,IAAI,CAAC;CAC1C,MAAM,sBAAsB,QAAQ,uBAAuB;CAE3D,QAAQ,SAAS,CAAC,MAAiC;EACjD,IAAI;EACJ,IAAI;GACF,MAAM,aACH,OAAO,WAAW,QAAQ,QAAQ,WAAW,SAAS;GACzD,MAAM,SACH,OAAO,WAAW,SAAS,QAAQ,WAAW,UAC/C;GAEF,MAAM,OAAO,YAAY,KAAK,OAAO,MAAM,OAAO,UAAU;GAE5D,eAAe,aAAsD;IACnE,MAAM,SAAS,MAAM,iBAAiB,KAAK,MAAM,WAAW,OAAO;KACjE,GAAG;KACH,SAAS;IACX,CAAC;IACD,IAAI,CAAC,QAC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AAO;KACT,GACA,YACF;KACA,IAAI,QACF,OAAO;KAGT,SAAS,MAAM,QAAQ,SACrB,QACA;MACE,YAAY;MACZ,QAAQ;MACR,OAAO;KACT,GACA,YACF;KACA,IAAI,QACF,OAAO;KAGT,SAAS,MAAM,QAAQ,KAAK,YAAY;KACxC,IAAI,QACF,OAAO;KAGT,OAAO,QAAQ,SACb,QACA;MACE,YAAY;MACZ,QAAQ;MACR,OAAO;KACT,GACA,YACF;IACF;GACF;GAEA,eAAe,UACb,MACA,IAC0B;IAC1B,OAAO,QAAQ,SACb,aACA;KACE,aAAa,MAAM,QAAQ,eAAe;KAC1C,QAAQ;KACR,cAAa,mBAAkB,UAAU,cAAc;IACzD,GACA,UAAU,IAAI,GACd,EACF;GACF;GAEA,eAAe,cAA6B;IAC1C,QAAQ,OAAO,MAAM,yCAAyC;IAE9D,MAAM,QAAQ,SAAS,eAAe,EACpC,aAAa,MAAM,QAAQ,eAAe,EAC5C,CAAC;GACH;GAEA,QAAQ,OAAO,MAAM,oCAAoC;GAEzD,MAAM,SAAS;IACb,MAAM,GAAG,UAAU,SAAS,EAAE,GAAG,UAAU,QAAQ,OAAO,EAAE;IAC5D;IACA;IACA;IACA;IACA;IACA;GACF;GAEA,OAAO;IACL,GAAG;IACH,GAAG,SAAS,MAAM;GACpB;EACF,SAAS,OAAO;GACd,IAAI,WAAW,SAAS,QAAQ,KAAK,GACnC,QAAQ,OAAO,MAAO,OAAiB,OAAO;GAGhD,MAAM;EACR;CACF;AACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
const require_unplugin = require('./unplugin.cjs');
|
|
10
|
+
let vitest = require("vitest");
|
|
11
|
+
|
|
12
|
+
//#region src/unplugin.test.ts
|
|
13
|
+
(0, vitest.describe)("devkit/unplugin/src/unplugin.ts", () => {
|
|
14
|
+
(0, vitest.it)("loads module exports", () => {
|
|
15
|
+
(0, vitest.expect)(require_unplugin.unplugin_exports).toBeDefined();
|
|
16
|
+
(0, vitest.expect)(typeof require_unplugin.unplugin_exports).toBe("object");
|
|
17
|
+
});
|
|
18
|
+
(0, vitest.it)("has at least one runtime export", () => {
|
|
19
|
+
(0, vitest.expect)(Object.keys(require_unplugin.unplugin_exports).length).toBeGreaterThan(0);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { unplugin_exports } from "./unplugin.mjs";
|
|
10
|
+
import { describe, expect, it } from "vitest";
|
|
11
|
+
|
|
12
|
+
//#region src/unplugin.test.ts
|
|
13
|
+
describe("devkit/unplugin/src/unplugin.ts", () => {
|
|
14
|
+
it("loads module exports", () => {
|
|
15
|
+
expect(unplugin_exports).toBeDefined();
|
|
16
|
+
expect(typeof unplugin_exports).toBe("object");
|
|
17
|
+
});
|
|
18
|
+
it("has at least one runtime export", () => {
|
|
19
|
+
expect(Object.keys(unplugin_exports).length).toBeGreaterThan(0);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { };
|
|
25
|
+
//# sourceMappingURL=unplugin.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unplugin.test.mjs","names":["moduleExports"],"sources":["../src/unplugin.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./unplugin\";\n\ndescribe(\"devkit/unplugin/src/unplugin.ts\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n\n it(\"has at least one runtime export\", () => {\n expect(Object.keys(moduleExports).length).toBeGreaterThan(0);\n });\n});\n"],"mappings":";;;;;;;;;;;;AAGA,SAAS,yCAAyC;CAChD,GAAG,8BAA8B;EAC/B,OAAOA,gBAAa,EAAE,YAAY;EAClC,OAAO,OAAOA,gBAAa,EAAE,KAAK,QAAQ;CAC5C,CAAC;CAED,GAAG,yCAAyC;EAC1C,OAAO,OAAO,KAAKA,gBAAa,EAAE,MAAM,EAAE,gBAAgB,CAAC;CAC7D,CAAC;AACH,CAAC"}
|
package/dist/vite.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.cts","names":[],"sources":["../src/vite.ts"],"mappings":";;;;;;cAsCa,eAAA,EAAiB,OAAO,CAAC,YAAA;;;AAAtC;;;;iBAiBgB,cAAA,kBAAgC,iBAAA,
|
|
1
|
+
{"version":3,"file":"vite.d.cts","names":[],"sources":["../src/vite.ts"],"mappings":";;;;;;cAsCa,eAAA,EAAiB,OAAO,CAAC,YAAA;;;AAAtC;;;;iBAiBgB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,YAAA;AAFH;;;;;;;;;;;;;;AAEa;AAuFb;;;;;;;AAzFA,iBAyFgB,iBAAA,kBAAmC,gBAAA,EACjD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;;;;;;;;;;;;;;;;;cAqGtD,MAAA,GAAM,OAAA,GAAwC,wBAAxC,gCAAA,MAAA,uBAAA,MAAA"}
|
package/dist/vite.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.mts","names":[],"sources":["../src/vite.ts"],"mappings":";;;;;;;;cAsCa,eAAA,EAAiB,OAAO,CAAC,YAAA;;;;;;;iBAiBtB,cAAA,kBAAgC,iBAAA,
|
|
1
|
+
{"version":3,"file":"vite.d.mts","names":[],"sources":["../src/vite.ts"],"mappings":";;;;;;;;cAsCa,eAAA,EAAiB,OAAO,CAAC,YAAA;;;;;;;iBAiBtB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,YAAA;;;;AAnBH;;;;AAAgD;AAiBhD;;;;;;;;;;;;;;iBAyFgB,iBAAA,kBAAmC,gBAAA,EACjD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;AAFnE;;;;;;;;;;;;;;;;AAAA,cAuGa,MAAA,GAAM,OAAA,GAAwC,wBAAxC,gCAAA,MAAA,uBAAA,MAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
const require_vite = require('./vite.cjs');
|
|
10
|
+
let vitest = require("vitest");
|
|
11
|
+
|
|
12
|
+
//#region src/vite.test.ts
|
|
13
|
+
(0, vitest.describe)("vite DEFAULT_OPTIONS", () => {
|
|
14
|
+
(0, vitest.it)("is an object", () => {
|
|
15
|
+
(0, vitest.expect)(typeof require_vite.DEFAULT_OPTIONS).toBe("object");
|
|
16
|
+
(0, vitest.expect)(require_vite.DEFAULT_OPTIONS).not.toBeNull();
|
|
17
|
+
});
|
|
18
|
+
(0, vitest.it)("has logLevel set to silent", () => {
|
|
19
|
+
(0, vitest.expect)(require_vite.DEFAULT_OPTIONS.logLevel).toBe("silent");
|
|
20
|
+
});
|
|
21
|
+
(0, vitest.it)("has resolve.extensions array", () => {
|
|
22
|
+
(0, vitest.expect)(Array.isArray(require_vite.DEFAULT_OPTIONS.resolve?.extensions)).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { DEFAULT_OPTIONS } from "./vite.mjs";
|
|
10
|
+
import { describe, expect, it } from "vitest";
|
|
11
|
+
|
|
12
|
+
//#region src/vite.test.ts
|
|
13
|
+
describe("vite DEFAULT_OPTIONS", () => {
|
|
14
|
+
it("is an object", () => {
|
|
15
|
+
expect(typeof DEFAULT_OPTIONS).toBe("object");
|
|
16
|
+
expect(DEFAULT_OPTIONS).not.toBeNull();
|
|
17
|
+
});
|
|
18
|
+
it("has logLevel set to silent", () => {
|
|
19
|
+
expect(DEFAULT_OPTIONS.logLevel).toBe("silent");
|
|
20
|
+
});
|
|
21
|
+
it("has resolve.extensions array", () => {
|
|
22
|
+
expect(Array.isArray(DEFAULT_OPTIONS.resolve?.extensions)).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { };
|
|
28
|
+
//# sourceMappingURL=vite.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.test.mjs","names":[],"sources":["../src/vite.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport { DEFAULT_OPTIONS } from \"./vite\";\n\ndescribe(\"vite DEFAULT_OPTIONS\", () => {\n it(\"is an object\", () => {\n expect(typeof DEFAULT_OPTIONS).toBe(\"object\");\n expect(DEFAULT_OPTIONS).not.toBeNull();\n });\n\n it(\"has logLevel set to silent\", () => {\n expect(DEFAULT_OPTIONS.logLevel).toBe(\"silent\");\n });\n\n it(\"has resolve.extensions array\", () => {\n expect(Array.isArray(DEFAULT_OPTIONS.resolve?.extensions)).toBe(true);\n });\n});\n"],"mappings":";;;;;;;;;;;;AAGA,SAAS,8BAA8B;CACrC,GAAG,sBAAsB;EACvB,OAAO,OAAO,eAAe,EAAE,KAAK,QAAQ;EAC5C,OAAO,eAAe,EAAE,IAAI,SAAS;CACvC,CAAC;CAED,GAAG,oCAAoC;EACrC,OAAO,gBAAgB,QAAQ,EAAE,KAAK,QAAQ;CAChD,CAAC;CAED,GAAG,sCAAsC;EACvC,OAAO,MAAM,QAAQ,gBAAgB,SAAS,UAAU,CAAC,EAAE,KAAK,IAAI;CACtE,CAAC;AACH,CAAC"}
|
package/dist/webpack.cjs
CHANGED
|
@@ -15,6 +15,12 @@ defu = require_runtime.__toESM(defu, 1);
|
|
|
15
15
|
let unplugin = require("unplugin");
|
|
16
16
|
|
|
17
17
|
//#region src/webpack.ts
|
|
18
|
+
var webpack_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
19
|
+
createWebpackFactory: () => createWebpackFactory,
|
|
20
|
+
default: () => plugin,
|
|
21
|
+
plugin: () => plugin,
|
|
22
|
+
resolveOptions: () => resolveOptions
|
|
23
|
+
});
|
|
18
24
|
/**
|
|
19
25
|
* Resolves the options for [webpack](https://webpack.js.org/).
|
|
20
26
|
*
|
|
@@ -99,4 +105,10 @@ const plugin = (0, unplugin.createWebpackPlugin)(createWebpackFactory());
|
|
|
99
105
|
exports.createWebpackFactory = createWebpackFactory;
|
|
100
106
|
exports.default = plugin;
|
|
101
107
|
exports.plugin = plugin;
|
|
102
|
-
exports.resolveOptions = resolveOptions;
|
|
108
|
+
exports.resolveOptions = resolveOptions;
|
|
109
|
+
Object.defineProperty(exports, 'webpack_exports', {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function () {
|
|
112
|
+
return webpack_exports;
|
|
113
|
+
}
|
|
114
|
+
});
|
package/dist/webpack.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.d.cts","names":[],"sources":["../src/webpack.ts"],"mappings":";;;;;;;;;;AAqCA;;;iBAAgB,cAAA,CACd,OAAA,EAAS,OAAA,GACR,WAAA,CAAY,wBAAA;;;;;;;;;;AAAwB;AAiEvC;;;;;;;;;;;;iBAAgB,oBAAA,kBAAsC,gBAAA,
|
|
1
|
+
{"version":3,"file":"webpack.d.cts","names":[],"sources":["../src/webpack.ts"],"mappings":";;;;;;;;;;AAqCA;;;iBAAgB,cAAA,CACd,OAAA,EAAS,OAAA,GACR,WAAA,CAAY,wBAAA;;;;;;;;;;AAAwB;AAiEvC;;;;;;;;;;;;iBAAgB,oBAAA,kBAAsC,gBAAA,EACpD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;;;;;;;;;;;;AAAA;AAgCnE;;;cAAa,MAAA,GAAM,OAAA,GAA8C,wBAA9C,mCAAA,qBAAA"}
|
package/dist/webpack.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.d.mts","names":[],"sources":["../src/webpack.ts"],"mappings":";;;;;;;;;;;;;;;iBAqCgB,cAAA,CACd,OAAA,EAAS,OAAA,GACR,WAAA,CAAY,wBAAA;;;;;AAFf;;;;;;;;;;;;;AAEuC;AAiEvC;;;;iBAAgB,oBAAA,kBAAsC,gBAAA,
|
|
1
|
+
{"version":3,"file":"webpack.d.mts","names":[],"sources":["../src/webpack.ts"],"mappings":";;;;;;;;;;;;;;;iBAqCgB,cAAA,CACd,OAAA,EAAS,OAAA,GACR,WAAA,CAAY,wBAAA;;;;;AAFf;;;;;;;;;;;;;AAEuC;AAiEvC;;;;iBAAgB,oBAAA,kBAAsC,gBAAA,EACpD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;;;;;;;;;;;;;;;;cAgCtD,MAAA,GAAM,OAAA,GAA8C,wBAA9C,mCAAA,qBAAA"}
|
package/dist/webpack.mjs
CHANGED
|
@@ -6,12 +6,19 @@ import __tsdown_shims_url from 'node:url'
|
|
|
6
6
|
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
7
|
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
8
|
|
|
9
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
9
10
|
import { createUnpluginFactory } from "./unplugin.mjs";
|
|
10
11
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
11
12
|
import defu from "defu";
|
|
12
13
|
import { createWebpackPlugin } from "unplugin";
|
|
13
14
|
|
|
14
15
|
//#region src/webpack.ts
|
|
16
|
+
var webpack_exports = /* @__PURE__ */ __exportAll({
|
|
17
|
+
createWebpackFactory: () => createWebpackFactory,
|
|
18
|
+
default: () => plugin,
|
|
19
|
+
plugin: () => plugin,
|
|
20
|
+
resolveOptions: () => resolveOptions
|
|
21
|
+
});
|
|
15
22
|
/**
|
|
16
23
|
* Resolves the options for [webpack](https://webpack.js.org/).
|
|
17
24
|
*
|
|
@@ -93,5 +100,5 @@ function createWebpackFactory(options = {}, decorate = (options) => options) {
|
|
|
93
100
|
const plugin = createWebpackPlugin(createWebpackFactory());
|
|
94
101
|
|
|
95
102
|
//#endregion
|
|
96
|
-
export { createWebpackFactory, plugin as default, plugin, resolveOptions };
|
|
103
|
+
export { createWebpackFactory, plugin as default, plugin, resolveOptions, webpack_exports };
|
|
97
104
|
//# sourceMappingURL=webpack.mjs.map
|
package/dist/webpack.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.mjs","names":[],"sources":["../src/webpack.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 { Context, ExecutionContext } from \"@powerlines/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { DeepPartial } from \"@stryke/types/base\";\nimport defu from \"defu\";\nimport { createWebpackPlugin, WebpackCompiler } from \"unplugin\";\nimport { WebpackOptionsNormalized } from \"webpack\";\nimport { UnpluginOptions } from \"./types\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Resolves the options for [webpack](https://webpack.js.org/).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(\n context: Context\n): DeepPartial<WebpackOptionsNormalized> {\n return {\n output: {\n path: context.config.output.path\n },\n name: context.config.name,\n resolve: {\n alias: context.alias\n },\n node:\n context.config.platform === \"node\"\n ? {\n __dirname: true,\n __filename: true,\n global: true\n }\n : false,\n mode:\n context.config.mode === \"development\"\n ? (\"development\" as const)\n : (\"production\" as const),\n cache: {\n type: \"filesystem\" as const,\n cacheDirectory: joinPaths(context.cachePath, \"webpack\", \"cache\")\n },\n recordsInputPath: joinPaths(\n context.cachePath,\n \"webpack\",\n \".webpack-records.json\"\n ),\n recordsOutputPath: joinPaths(\n context.cachePath,\n \"webpack\",\n \".webpack-records.json\"\n ),\n context: joinPaths(context.config.cwd, context.config.root),\n devtool: context.config.output.sourceMap ? \"source-map\" : false,\n optimization: {\n minimize: context.config.output.minify\n }\n };\n}\n\n/**\n * Creates a Webpack plugin factory that generates a plugin instance.\n *\n * @see https://webpack.js.org/api/plugins/\n *\n * @example\n * ```ts\n * // webpack.config.ts\n * import { createWebpackFactory } from \"@powerlines/unplugin/webpack\";\n *\n * const powerlinesPlugin = createWebpackFactory({ 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 Webpack plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Webpack build.\n */\nexport function createWebpackFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"webpack\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n webpack(compiler: WebpackCompiler) {\n compiler.hooks.beforeRun.tap(\"PowerlinesWebpackPlugin\", compiler => {\n compiler.options = defu(\n resolveOptions(unplugin.context),\n compiler.options\n ) as WebpackOptionsNormalized;\n });\n }\n })\n );\n}\n\n/**\n * An Webpack plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://webpack.js.org/contribute/writing-a-plugin/#basic-plugin-architecture\n *\n * @example\n * ```js\n * // webpack.config.js\n * import powerlines from \"@powerlines/unplugin/webpack\";\n *\n * export default {\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * }\n * ```\n */\nexport const plugin = createWebpackPlugin(createWebpackFactory());\n\nexport default plugin;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"webpack.mjs","names":[],"sources":["../src/webpack.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 { Context, ExecutionContext } from \"@powerlines/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { DeepPartial } from \"@stryke/types/base\";\nimport defu from \"defu\";\nimport { createWebpackPlugin, WebpackCompiler } from \"unplugin\";\nimport { WebpackOptionsNormalized } from \"webpack\";\nimport { UnpluginOptions } from \"./types\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Resolves the options for [webpack](https://webpack.js.org/).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(\n context: Context\n): DeepPartial<WebpackOptionsNormalized> {\n return {\n output: {\n path: context.config.output.path\n },\n name: context.config.name,\n resolve: {\n alias: context.alias\n },\n node:\n context.config.platform === \"node\"\n ? {\n __dirname: true,\n __filename: true,\n global: true\n }\n : false,\n mode:\n context.config.mode === \"development\"\n ? (\"development\" as const)\n : (\"production\" as const),\n cache: {\n type: \"filesystem\" as const,\n cacheDirectory: joinPaths(context.cachePath, \"webpack\", \"cache\")\n },\n recordsInputPath: joinPaths(\n context.cachePath,\n \"webpack\",\n \".webpack-records.json\"\n ),\n recordsOutputPath: joinPaths(\n context.cachePath,\n \"webpack\",\n \".webpack-records.json\"\n ),\n context: joinPaths(context.config.cwd, context.config.root),\n devtool: context.config.output.sourceMap ? \"source-map\" : false,\n optimization: {\n minimize: context.config.output.minify\n }\n };\n}\n\n/**\n * Creates a Webpack plugin factory that generates a plugin instance.\n *\n * @see https://webpack.js.org/api/plugins/\n *\n * @example\n * ```ts\n * // webpack.config.ts\n * import { createWebpackFactory } from \"@powerlines/unplugin/webpack\";\n *\n * const powerlinesPlugin = createWebpackFactory({ 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 Webpack plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Webpack build.\n */\nexport function createWebpackFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"webpack\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n webpack(compiler: WebpackCompiler) {\n compiler.hooks.beforeRun.tap(\"PowerlinesWebpackPlugin\", compiler => {\n compiler.options = defu(\n resolveOptions(unplugin.context),\n compiler.options\n ) as WebpackOptionsNormalized;\n });\n }\n })\n );\n}\n\n/**\n * An Webpack plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://webpack.js.org/contribute/writing-a-plugin/#basic-plugin-architecture\n *\n * @example\n * ```js\n * // webpack.config.js\n * import powerlines from \"@powerlines/unplugin/webpack\";\n *\n * export default {\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * }\n * ```\n */\nexport const plugin = createWebpackPlugin(createWebpackFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAgB,eACd,SACuC;CACvC,OAAO;EACL,QAAQ,EACN,MAAM,QAAQ,OAAO,OAAO,KAC9B;EACA,MAAM,QAAQ,OAAO;EACrB,SAAS,EACP,OAAO,QAAQ,MACjB;EACA,MACE,QAAQ,OAAO,aAAa,SACxB;GACE,WAAW;GACX,YAAY;GACZ,QAAQ;EACV,IACA;EACN,MACE,QAAQ,OAAO,SAAS,gBACnB,gBACA;EACP,OAAO;GACL,MAAM;GACN,gBAAgB,UAAU,QAAQ,WAAW,WAAW,OAAO;EACjE;EACA,kBAAkB,UAChB,QAAQ,WACR,WACA,uBACF;EACA,mBAAmB,UACjB,QAAQ,WACR,WACA,uBACF;EACA,SAAS,UAAU,QAAQ,OAAO,KAAK,QAAQ,OAAO,IAAI;EAC1D,SAAS,QAAQ,OAAO,OAAO,YAAY,eAAe;EAC1D,cAAc,EACZ,UAAU,QAAQ,OAAO,OAAO,OAClC;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,qBACd,UAAmD,CAAC,GACpD,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;CAAU,IAAG,aAC/D,SAAS;EACP,GAAI;EACJ,QAAQ,UAA2B;GACjC,SAAS,MAAM,UAAU,IAAI,4BAA2B,aAAY;IAClE,SAAS,UAAU,KACjB,eAAe,SAAS,OAAO,GAC/B,SAAS,OACX;GACF,CAAC;EACH;CACF,CAAC,CACH;AACF;;;;;;;;;;;;;;;;AAiBA,MAAa,SAAS,oBAAoB,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
const require_webpack = require('./webpack.cjs');
|
|
10
|
+
let vitest = require("vitest");
|
|
11
|
+
|
|
12
|
+
//#region src/webpack.test.ts
|
|
13
|
+
(0, vitest.describe)("devkit/unplugin/src/webpack.ts", () => {
|
|
14
|
+
(0, vitest.it)("loads module exports", () => {
|
|
15
|
+
(0, vitest.expect)(require_webpack.webpack_exports).toBeDefined();
|
|
16
|
+
(0, vitest.expect)(typeof require_webpack.webpack_exports).toBe("object");
|
|
17
|
+
});
|
|
18
|
+
(0, vitest.it)("has at least one runtime export", () => {
|
|
19
|
+
(0, vitest.expect)(Object.keys(require_webpack.webpack_exports).length).toBeGreaterThan(0);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { webpack_exports } from "./webpack.mjs";
|
|
10
|
+
import { describe, expect, it } from "vitest";
|
|
11
|
+
|
|
12
|
+
//#region src/webpack.test.ts
|
|
13
|
+
describe("devkit/unplugin/src/webpack.ts", () => {
|
|
14
|
+
it("loads module exports", () => {
|
|
15
|
+
expect(webpack_exports).toBeDefined();
|
|
16
|
+
expect(typeof webpack_exports).toBe("object");
|
|
17
|
+
});
|
|
18
|
+
it("has at least one runtime export", () => {
|
|
19
|
+
expect(Object.keys(webpack_exports).length).toBeGreaterThan(0);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { };
|
|
25
|
+
//# sourceMappingURL=webpack.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack.test.mjs","names":["moduleExports"],"sources":["../src/webpack.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./webpack\";\n\ndescribe(\"devkit/unplugin/src/webpack.ts\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n\n it(\"has at least one runtime export\", () => {\n expect(Object.keys(moduleExports).length).toBeGreaterThan(0);\n });\n});\n"],"mappings":";;;;;;;;;;;;AAGA,SAAS,wCAAwC;CAC/C,GAAG,8BAA8B;EAC/B,OAAOA,eAAa,EAAE,YAAY;EAClC,OAAO,OAAOA,eAAa,EAAE,KAAK,QAAQ;CAC5C,CAAC;CAED,GAAG,yCAAyC;EAC1C,OAAO,OAAO,KAAKA,eAAa,EAAE,MAAM,EAAE,gBAAgB,CAAC;CAC7D,CAAC;AACH,CAAC"}
|