@powerlines/plugin-unenv 0.1.278 → 0.1.280
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/index.cjs +10 -12
- package/dist/index.d.cts +6 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +6 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +10 -12
- package/dist/index.mjs.map +1 -1
- package/dist/types/plugin.d.cts +1 -3
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +1 -3
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -18,27 +18,25 @@ const plugin = (options = {}) => {
|
|
|
18
18
|
},
|
|
19
19
|
configResolved() {
|
|
20
20
|
this.unenv = (0, unenv.defineEnv)(this.config.unenv || {});
|
|
21
|
-
this.config.
|
|
22
|
-
if (Array.isArray(this.config.
|
|
21
|
+
this.config.resolve.alias ??= {};
|
|
22
|
+
if (Array.isArray(this.config.resolve.alias)) this.config.resolve.alias = Object.entries(this.unenv.env.alias).reduce((aliases, [key, value]) => {
|
|
23
23
|
if (!aliases.find((alias) => alias.find === key)) aliases.push({
|
|
24
24
|
find: key,
|
|
25
25
|
replacement: value
|
|
26
26
|
});
|
|
27
27
|
return aliases;
|
|
28
|
-
}, this.config.
|
|
29
|
-
else this.config.
|
|
28
|
+
}, this.config.resolve.alias);
|
|
29
|
+
else this.config.resolve.alias = {
|
|
30
30
|
...this.unenv.env.alias,
|
|
31
|
-
...this.config.
|
|
31
|
+
...this.config.resolve.alias
|
|
32
32
|
};
|
|
33
|
-
this.config.
|
|
34
|
-
this.config.
|
|
35
|
-
this.config.
|
|
36
|
-
this.config.
|
|
33
|
+
this.config.resolve.external ??= [];
|
|
34
|
+
this.config.resolve.external.push(...this.unenv.env.external);
|
|
35
|
+
this.config.inject ??= {};
|
|
36
|
+
this.config.inject = {
|
|
37
37
|
...this.unenv.env.inject,
|
|
38
|
-
...this.config.
|
|
38
|
+
...this.config.inject
|
|
39
39
|
};
|
|
40
|
-
this.config.build.polyfill ??= [];
|
|
41
|
-
this.config.build.polyfill.push(...this.unenv.env.polyfill);
|
|
42
40
|
}
|
|
43
41
|
};
|
|
44
42
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { UnenvPluginContext, UnenvPluginOptions, UnenvPluginResolvedConfig, UnenvPluginUserConfig, __ΩUnenvPluginContext, __ΩUnenvPluginOptions, __ΩUnenvPluginResolvedConfig, __ΩUnenvPluginUserConfig } from "./types/plugin.cjs";
|
|
2
2
|
import "./types/index.cjs";
|
|
3
|
-
import { Plugin } from "powerlines
|
|
3
|
+
import { Plugin } from "powerlines";
|
|
4
4
|
|
|
5
5
|
//#region src/index.d.ts
|
|
6
|
-
|
|
6
|
+
declare module "powerlines" {
|
|
7
|
+
interface UserConfig {
|
|
8
|
+
unenv?: UnenvPluginOptions;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
7
11
|
/**
|
|
8
12
|
* The unenv plugin for Powerlines.
|
|
9
13
|
*
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;IAsBwB,KAAA,CAAA,EAIZ,kBAJY;EAAA;;;;AAgBxB;;;;;;AAIS,cAJI,MAIJ,EAAA,CAAA,iBAHU,kBAGV,GAH+B,kBAG/B,CAAA,CAAA,OAAA,CAAA,EADE,kBACF,EAAA,GAAN,MAAM,CAAC,QAAD,CAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { UnenvPluginContext, UnenvPluginOptions, UnenvPluginResolvedConfig, UnenvPluginUserConfig, __ΩUnenvPluginContext, __ΩUnenvPluginOptions, __ΩUnenvPluginResolvedConfig, __ΩUnenvPluginUserConfig } from "./types/plugin.mjs";
|
|
2
2
|
import "./types/index.mjs";
|
|
3
|
-
import { Plugin } from "powerlines
|
|
3
|
+
import { Plugin } from "powerlines";
|
|
4
4
|
|
|
5
5
|
//#region src/index.d.ts
|
|
6
|
-
|
|
6
|
+
declare module "powerlines" {
|
|
7
|
+
interface UserConfig {
|
|
8
|
+
unenv?: UnenvPluginOptions;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
7
11
|
/**
|
|
8
12
|
* The unenv plugin for Powerlines.
|
|
9
13
|
*
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;IAsBwB,KAAA,CAAA,EAIZ,kBAJY;EAAA;;;;AAgBxB;;;;;;AAIS,cAJI,MAIJ,EAAA,CAAA,iBAHU,kBAGV,GAH+B,kBAG/B,CAAA,CAAA,OAAA,CAAA,EADE,kBACF,EAAA,GAAN,MAAM,CAAC,QAAD,CAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -17,27 +17,25 @@ const plugin = (options = {}) => {
|
|
|
17
17
|
},
|
|
18
18
|
configResolved() {
|
|
19
19
|
this.unenv = defineEnv(this.config.unenv || {});
|
|
20
|
-
this.config.
|
|
21
|
-
if (Array.isArray(this.config.
|
|
20
|
+
this.config.resolve.alias ??= {};
|
|
21
|
+
if (Array.isArray(this.config.resolve.alias)) this.config.resolve.alias = Object.entries(this.unenv.env.alias).reduce((aliases, [key, value]) => {
|
|
22
22
|
if (!aliases.find((alias) => alias.find === key)) aliases.push({
|
|
23
23
|
find: key,
|
|
24
24
|
replacement: value
|
|
25
25
|
});
|
|
26
26
|
return aliases;
|
|
27
|
-
}, this.config.
|
|
28
|
-
else this.config.
|
|
27
|
+
}, this.config.resolve.alias);
|
|
28
|
+
else this.config.resolve.alias = {
|
|
29
29
|
...this.unenv.env.alias,
|
|
30
|
-
...this.config.
|
|
30
|
+
...this.config.resolve.alias
|
|
31
31
|
};
|
|
32
|
-
this.config.
|
|
33
|
-
this.config.
|
|
34
|
-
this.config.
|
|
35
|
-
this.config.
|
|
32
|
+
this.config.resolve.external ??= [];
|
|
33
|
+
this.config.resolve.external.push(...this.unenv.env.external);
|
|
34
|
+
this.config.inject ??= {};
|
|
35
|
+
this.config.inject = {
|
|
36
36
|
...this.unenv.env.inject,
|
|
37
|
-
...this.config.
|
|
37
|
+
...this.config.inject
|
|
38
38
|
};
|
|
39
|
-
this.config.build.polyfill ??= [];
|
|
40
|
-
this.config.build.polyfill.push(...this.unenv.env.polyfill);
|
|
41
39
|
}
|
|
42
40
|
};
|
|
43
41
|
};
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.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 { Plugin } from \"powerlines
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.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 { Plugin } from \"powerlines\";\nimport { defineEnv } from \"unenv\";\nimport { UnenvPluginContext, UnenvPluginOptions } from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n export interface UserConfig {\n unenv?: UnenvPluginOptions;\n }\n}\n\n/**\n * The unenv plugin for Powerlines.\n *\n * @see https://unjs.dev/packages/unenv\n *\n * @param options - The unenv plugin user configuration options.\n * @returns A Powerlines plugin to transform source code to be platform agnostic using unenv.\n */\nexport const plugin = <\n TContext extends UnenvPluginContext = UnenvPluginContext\n>(\n options: UnenvPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"unenv\",\n async config() {\n return {\n unenv: options\n };\n },\n configResolved() {\n this.unenv = defineEnv(this.config.unenv || {});\n\n this.config.resolve.alias ??= {};\n if (Array.isArray(this.config.resolve.alias)) {\n this.config.resolve.alias = Object.entries(this.unenv.env.alias).reduce(\n (aliases, [key, value]) => {\n if (!aliases.find(alias => alias.find === key)) {\n aliases.push({ find: key, replacement: value });\n }\n\n return aliases;\n },\n this.config.resolve.alias\n );\n } else {\n this.config.resolve.alias = {\n ...this.unenv.env.alias,\n ...this.config.resolve.alias\n };\n }\n\n this.config.resolve.external ??= [];\n this.config.resolve.external.push(...this.unenv.env.external);\n\n this.config.inject ??= {};\n this.config.inject = {\n ...(this.unenv.env.inject as Record<string, string | string[]>),\n ...this.config.inject\n };\n\n // this.config.build.polyfill ??= [];\n // this.config.build.polyfill.push(...this.unenv.env.polyfill);\n }\n } as Plugin<TContext>;\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;AAsCA,MAAa,UAGX,UAA8B,EAAE,KACX;AACrB,QAAO;EACL,MAAM;EACN,MAAM,SAAS;AACb,UAAO,EACL,OAAO,SACR;;EAEH,iBAAiB;AACf,QAAK,QAAQ,UAAU,KAAK,OAAO,SAAS,EAAE,CAAC;AAE/C,QAAK,OAAO,QAAQ,UAAU,EAAE;AAChC,OAAI,MAAM,QAAQ,KAAK,OAAO,QAAQ,MAAM,CAC1C,MAAK,OAAO,QAAQ,QAAQ,OAAO,QAAQ,KAAK,MAAM,IAAI,MAAM,CAAC,QAC9D,SAAS,CAAC,KAAK,WAAW;AACzB,QAAI,CAAC,QAAQ,MAAK,UAAS,MAAM,SAAS,IAAI,CAC5C,SAAQ,KAAK;KAAE,MAAM;KAAK,aAAa;KAAO,CAAC;AAGjD,WAAO;MAET,KAAK,OAAO,QAAQ,MACrB;OAED,MAAK,OAAO,QAAQ,QAAQ;IAC1B,GAAG,KAAK,MAAM,IAAI;IAClB,GAAG,KAAK,OAAO,QAAQ;IACxB;AAGH,QAAK,OAAO,QAAQ,aAAa,EAAE;AACnC,QAAK,OAAO,QAAQ,SAAS,KAAK,GAAG,KAAK,MAAM,IAAI,SAAS;AAE7D,QAAK,OAAO,WAAW,EAAE;AACzB,QAAK,OAAO,SAAS;IACnB,GAAI,KAAK,MAAM,IAAI;IACnB,GAAG,KAAK,OAAO;IAChB;;EAKJ;;AAGH,kBAAe"}
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
+
import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
|
|
1
2
|
import * as unenv0 from "unenv";
|
|
2
3
|
import { CreateEnvOptions } from "unenv";
|
|
3
|
-
import { UserConfig } from "powerlines/types/config";
|
|
4
|
-
import { PluginContext } from "powerlines/types/context";
|
|
5
|
-
import { ResolvedConfig } from "powerlines/types/resolved";
|
|
6
4
|
|
|
7
5
|
//#region src/types/plugin.d.ts
|
|
8
6
|
type UnenvPluginOptions = Partial<CreateEnvOptions>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;KAqBY,kBAAA,GAAqB,QAAQ;UAExB,qBAAA,SAA8B;SACtC;AAHT;AAEiB,UAIA,yBAAA,SAAkC,cAJJ,CAAA;EAI9B,KAAA,EACR,gBADQ;AAIjB;AAC0B,KADd,kBACc,CAAA,wBAAA,yBAAA,GAA4B,yBAA5B,CAAA,GACtB,aADsB,CACR,eADQ,CAAA,GAAA;EAA4B,KAAA,EAE7C,UAF6C,CAAA,OACrC,MAAA,CAC0B,SAFW,CAAA;CACpC;AAAd,qCAAA,GAAA,EAAA;AAAa,wCAC0B,GAAA,EAAA;AAAlC,4CAAA,GAAA,EAAA;AAAU,qCAAA,GAAA,EAAA"}
|
package/dist/types/plugin.d.mts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import * as unenv0 from "unenv";
|
|
2
2
|
import { CreateEnvOptions } from "unenv";
|
|
3
|
-
import { UserConfig } from "powerlines
|
|
4
|
-
import { PluginContext } from "powerlines/types/context";
|
|
5
|
-
import { ResolvedConfig } from "powerlines/types/resolved";
|
|
3
|
+
import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
|
|
6
4
|
|
|
7
5
|
//#region src/types/plugin.d.ts
|
|
8
6
|
type UnenvPluginOptions = Partial<CreateEnvOptions>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;KAqBY,kBAAA,GAAqB,QAAQ;UAExB,qBAAA,SAA8B;SACtC;AAHT;AAEiB,UAIA,yBAAA,SAAkC,cAJJ,CAAA;EAI9B,KAAA,EACR,gBADQ;AAIjB;AAC0B,KADd,kBACc,CAAA,wBAAA,yBAAA,GAA4B,yBAA5B,CAAA,GACtB,aADsB,CACR,eADQ,CAAA,GAAA;EAA4B,KAAA,EAE7C,UAF6C,CAAA,OACrC,MAAA,CAC0B,SAFW,CAAA;CACpC;AAAd,qCAAA,GAAA,EAAA;AAAa,wCAC0B,GAAA,EAAA;AAAlC,4CAAA,GAAA,EAAA;AAAU,qCAAA,GAAA,EAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-unenv",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.280",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A Powerlines plugin to transform source code to be platform agnostic using unenv.",
|
|
6
6
|
"repository": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"default": "./dist/index.mjs"
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
|
-
"
|
|
58
|
+
"./*": "./*",
|
|
59
59
|
"./types": {
|
|
60
60
|
"require": {
|
|
61
61
|
"types": "./dist/types/index.d.cts",
|
|
@@ -89,15 +89,15 @@
|
|
|
89
89
|
"files": ["dist/**/*"],
|
|
90
90
|
"keywords": ["unenv", "powerlines", "storm-software", "powerlines-plugin"],
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"powerlines": "^0.
|
|
92
|
+
"powerlines": "^0.39.0",
|
|
93
93
|
"typescript": "^5.9.3",
|
|
94
94
|
"unenv": "npm:unenv-nightly@2.0.0-rc.24"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
98
|
-
"@types/node": "^25.3.
|
|
97
|
+
"@powerlines/plugin-plugin": "^0.12.242",
|
|
98
|
+
"@types/node": "^25.3.2"
|
|
99
99
|
},
|
|
100
100
|
"publishConfig": { "access": "public" },
|
|
101
101
|
"types": "./dist/index.d.cts",
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "0dcb16f054b8a69915b074578e6d4dfa3ecc1529"
|
|
103
103
|
}
|