pkgbld 1.16.5 → 1.16.7
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.js +14 -17
- package/dist/src/types.d.ts +3 -3
- package/package.json +3 -6
package/dist/index.js
CHANGED
|
@@ -87,7 +87,7 @@ async function getJson(fileName) {
|
|
|
87
87
|
async function clean (provider) {
|
|
88
88
|
const pluginClean = await provider.import('@rollup-extras/plugin-clean');
|
|
89
89
|
const pluginInstance = pluginClean();
|
|
90
|
-
provider.provide(pluginFactory, 1000 /*
|
|
90
|
+
provider.provide(pluginFactory, 1000 /* Priority.cleanup */, { outputPlugin: true });
|
|
91
91
|
let firstPluginInstance = true;
|
|
92
92
|
function pluginFactory() {
|
|
93
93
|
const result = firstPluginInstance ? pluginInstance : pluginInstance.api.addInstance();
|
|
@@ -98,7 +98,7 @@ async function clean (provider) {
|
|
|
98
98
|
|
|
99
99
|
async function commonjs (provider) {
|
|
100
100
|
const pluginCommonjs = await provider.import('@rollup/plugin-commonjs');
|
|
101
|
-
provider.provide(() => pluginCommonjs(), 4000 /*
|
|
101
|
+
provider.provide(() => pluginCommonjs(), 4000 /* Priority.commonjs */);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
async function externals (provider, config, inputs) {
|
|
@@ -109,7 +109,7 @@ async function externals (provider, config, inputs) {
|
|
|
109
109
|
const allowGenericUmd = config.umdInputs.length === 1 && inputs.length === 1;
|
|
110
110
|
if (config.formats.length > 0) {
|
|
111
111
|
const format = (allowGenericUmd ? undefined : config.formats.filter(format => format !== 'umd'));
|
|
112
|
-
provider.provide(() => pluginExternals(), 2000 /*
|
|
112
|
+
provider.provide(() => pluginExternals(), 2000 /* Priority.externals */, { format });
|
|
113
113
|
}
|
|
114
114
|
if (!allowGenericUmd && config.umdInputs.length > 0) {
|
|
115
115
|
const curry = (await provider.import('lodash/curry.js'));
|
|
@@ -117,7 +117,7 @@ async function externals (provider, config, inputs) {
|
|
|
117
117
|
const isExternal = curry((currentInput, id, external) => external || isExternalInput(currentInput, inputs, id, config))(currentInput);
|
|
118
118
|
provider.provide(() => pluginExternals({
|
|
119
119
|
external: isExternal
|
|
120
|
-
}), 2000 /*
|
|
120
|
+
}), 2000 /* Priority.externals */, { format: 'umd', inputs: [`./${config.sourceDir}/${currentInput}.ts`] });
|
|
121
121
|
}
|
|
122
122
|
// for eject config
|
|
123
123
|
provider.globalImport('path', 'path');
|
|
@@ -144,11 +144,11 @@ async function preprocess (provider, config) {
|
|
|
144
144
|
const include = config.preprocess.map(name => `${config.sourceDir}/${name}.ts`);
|
|
145
145
|
for (const format of config.formats) {
|
|
146
146
|
if (format !== 'umd') {
|
|
147
|
-
provider.provide(() => pluginPreprocess({ include, context: { [format]: true } }), 1000 /*
|
|
147
|
+
provider.provide(() => pluginPreprocess({ include, context: { [format]: true } }), 1000 /* Priority.preprocess */, { format });
|
|
148
148
|
}
|
|
149
149
|
else {
|
|
150
150
|
for (const currentInput of config.umdInputs) {
|
|
151
|
-
provider.provide(() => pluginPreprocess({ include, context: { umd: true } }), 1000 /*
|
|
151
|
+
provider.provide(() => pluginPreprocess({ include, context: { umd: true } }), 1000 /* Priority.preprocess */, { format, inputs: [`./${config.sourceDir}/${currentInput}.ts`] });
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -157,7 +157,7 @@ async function preprocess (provider, config) {
|
|
|
157
157
|
|
|
158
158
|
async function resolve (provider) {
|
|
159
159
|
const pluginResolve = await provider.import('@rollup/plugin-node-resolve');
|
|
160
|
-
provider.provide(() => pluginResolve(), 3000 /*
|
|
160
|
+
provider.provide(() => pluginResolve(), 3000 /* Priority.resolve */);
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
async function terser (provider, config) {
|
|
@@ -174,11 +174,11 @@ async function terser (provider, config) {
|
|
|
174
174
|
if (filteredFormats.length > 0) {
|
|
175
175
|
for (const format of filteredFormats) {
|
|
176
176
|
if (format !== 'umd') {
|
|
177
|
-
provider.provide(() => pluginTerser(options), 10000 /*
|
|
177
|
+
provider.provide(() => pluginTerser(options), 10000 /* Priority.compress */, { format, outputPlugin: true });
|
|
178
178
|
}
|
|
179
179
|
else {
|
|
180
180
|
for (const currentInput of config.umdInputs) {
|
|
181
|
-
provider.provide(() => pluginTerser(options), 10000 /*
|
|
181
|
+
provider.provide(() => pluginTerser(options), 10000 /* Priority.compress */, { format, outputPlugin: true, inputs: [`./${config.sourceDir}/${currentInput}.ts`] });
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
}
|
|
@@ -188,7 +188,7 @@ async function terser (provider, config) {
|
|
|
188
188
|
|
|
189
189
|
async function typescript (provider) {
|
|
190
190
|
const pluginTypescript = await provider.import('rollup-plugin-typescript2');
|
|
191
|
-
provider.provide(() => pluginTypescript(), 6000 /*
|
|
191
|
+
provider.provide(() => pluginTypescript(), 6000 /* Priority.transpile */);
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
async function binify (provider, config) {
|
|
@@ -200,7 +200,7 @@ async function binify (provider, config) {
|
|
|
200
200
|
}[path.extname(config.bin[0])] ?? 'cjs';
|
|
201
201
|
provider.provide(() => pluginBinify({
|
|
202
202
|
filter: (item) => item.type === 'chunk' && item.isEntry && config.bin.some(input => input === `./${config.dir}/${item.fileName}`)
|
|
203
|
-
}), 20000 /*
|
|
203
|
+
}), 20000 /* Priority.finalize */, { outputPlugin: true, format });
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
|
|
@@ -561,18 +561,15 @@ async function writeJson(path, json) {
|
|
|
561
561
|
await fs.writeFile(path, JSON.stringify(json, null, 2) + '\n');
|
|
562
562
|
}
|
|
563
563
|
|
|
564
|
-
var version = "1.16.
|
|
564
|
+
var version = "1.16.7";
|
|
565
565
|
var license = "MIT";
|
|
566
566
|
var name = "pkgbld";
|
|
567
|
-
var author =
|
|
568
|
-
name: "Konstantin Shutkin"
|
|
569
|
-
};
|
|
567
|
+
var author = "Konstantin Shutkin";
|
|
570
568
|
var bin = "./dist/index.js";
|
|
571
569
|
var main = "./dist/index.js";
|
|
572
570
|
var typings = "./dist/index.d.ts";
|
|
573
571
|
var files = [
|
|
574
|
-
"dist"
|
|
575
|
-
"LICENSE"
|
|
572
|
+
"dist"
|
|
576
573
|
];
|
|
577
574
|
var engines = {
|
|
578
575
|
node: ">=16"
|
package/dist/src/types.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type PackageJson = {
|
|
|
10
10
|
devDependencies?: Record<string, string>;
|
|
11
11
|
peerDependencies: Record<string, string>;
|
|
12
12
|
};
|
|
13
|
-
export declare const enum
|
|
13
|
+
export declare const enum Priority {
|
|
14
14
|
preprocess = 1000,
|
|
15
15
|
cleanup = 1000,
|
|
16
16
|
externals = 2000,
|
|
@@ -20,7 +20,7 @@ export declare const enum Priotiry {
|
|
|
20
20
|
compress = 10000,
|
|
21
21
|
finalize = 20000
|
|
22
22
|
}
|
|
23
|
-
export type ProvideFunction = (factory: () => Plugin, priority:
|
|
23
|
+
export type ProvideFunction = (factory: () => Plugin, priority: Priority, options?: {
|
|
24
24
|
format?: InternalModuleFormat | InternalModuleFormat[];
|
|
25
25
|
inputs?: string[];
|
|
26
26
|
outputPlugin?: true;
|
|
@@ -33,7 +33,7 @@ export type Provider = {
|
|
|
33
33
|
};
|
|
34
34
|
export type PkgbldRollupPlugin = {
|
|
35
35
|
plugin: () => Plugin;
|
|
36
|
-
priority:
|
|
36
|
+
priority: Priority;
|
|
37
37
|
format?: InternalModuleFormat | InternalModuleFormat[];
|
|
38
38
|
inputs?: string[];
|
|
39
39
|
outputPlugin?: true;
|
package/package.json
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.16.
|
|
2
|
+
"version": "1.16.7",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"name": "pkgbld",
|
|
5
|
-
"author":
|
|
6
|
-
"name": "Konstantin Shutkin"
|
|
7
|
-
},
|
|
5
|
+
"author": "Konstantin Shutkin",
|
|
8
6
|
"bin": "./dist/index.js",
|
|
9
7
|
"main": "./dist/index.js",
|
|
10
8
|
"typings": "./dist/index.d.ts",
|
|
11
9
|
"files": [
|
|
12
|
-
"dist"
|
|
13
|
-
"LICENSE"
|
|
10
|
+
"dist"
|
|
14
11
|
],
|
|
15
12
|
"engines": {
|
|
16
13
|
"node": ">=16"
|