@taro-minify-pack/preset 0.0.5-alpha.3 → 0.0.5-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +8 -4
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
- package/src/index.ts +22 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { RemoteAssetPluginOpt } from '@taro-minify-pack/plugin-remote-assets';
|
|
2
|
-
import { AsyncPackOpts } from '@taro-minify-pack/plugin-async-pack';
|
|
1
|
+
import type { RemoteAssetPluginOpt } from '@taro-minify-pack/plugin-remote-assets';
|
|
2
|
+
import type { AsyncPackOpts } from '@taro-minify-pack/plugin-async-pack';
|
|
3
|
+
import type { CoverBrowsersListOpt } from '@taro-minify-pack/plugin-cover-browserslist';
|
|
4
|
+
import type { BundleAnalyzerOpt } from '@taro-minify-pack/plugin-bundle-analyzer';
|
|
3
5
|
export * from '@taro-minify-pack/plugin-remote-assets';
|
|
4
6
|
interface Opt {
|
|
5
|
-
remoteAssets?: RemoteAssetPluginOpt;
|
|
6
7
|
asyncPack?: AsyncPackOpts | boolean;
|
|
8
|
+
bundleAnalyzer?: BundleAnalyzerOpt | boolean;
|
|
9
|
+
coverBrowsersList?: CoverBrowsersListOpt;
|
|
10
|
+
remoteAssets?: RemoteAssetPluginOpt;
|
|
7
11
|
}
|
|
8
12
|
declare const _default: (_: any, opt: Opt) => {
|
|
9
|
-
plugins: (string | (string | RemoteAssetPluginOpt)[] | (string | AsyncPackOpts)[])[];
|
|
13
|
+
plugins: (string | (string | RemoteAssetPluginOpt)[] | (string | CoverBrowsersListOpt)[] | (string | AsyncPackOpts | undefined)[] | (string | BundleAnalyzerOpt | undefined)[])[];
|
|
10
14
|
};
|
|
11
15
|
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -16,14 +16,20 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("@taro-minify-pack/plugin-remote-assets"), exports);
|
|
18
18
|
exports.default = (_, opt) => {
|
|
19
|
-
const { remoteAssets, asyncPack } = opt;
|
|
19
|
+
const { remoteAssets, asyncPack, coverBrowsersList, bundleAnalyzer } = opt;
|
|
20
20
|
const plugins = [];
|
|
21
21
|
if (remoteAssets)
|
|
22
22
|
plugins.push([require.resolve('@taro-minify-pack/plugin-remote-assets'), remoteAssets]);
|
|
23
|
-
if (
|
|
23
|
+
if (coverBrowsersList)
|
|
24
|
+
plugins.push([require.resolve('@taro-minify-pack/plugin-cover-browserslist'), coverBrowsersList]);
|
|
25
|
+
if (Boolean(asyncPack) && typeof asyncPack === 'boolean')
|
|
24
26
|
plugins.push(require.resolve('@taro-minify-pack/plugin-async-pack'));
|
|
25
|
-
if (asyncPack && typeof asyncPack !== 'boolean')
|
|
27
|
+
if (Boolean(asyncPack) && typeof asyncPack !== 'boolean')
|
|
26
28
|
plugins.push([require.resolve('@taro-minify-pack/plugin-async-pack'), asyncPack]);
|
|
29
|
+
if (Boolean(bundleAnalyzer) && typeof bundleAnalyzer === 'boolean')
|
|
30
|
+
plugins.push(require.resolve('@taro-minify-pack/plugin-bundle-analyzer'));
|
|
31
|
+
if (Boolean(bundleAnalyzer) && typeof bundleAnalyzer !== 'boolean')
|
|
32
|
+
plugins.push([require.resolve('@taro-minify-pack/plugin-bundle-analyzer'), bundleAnalyzer]);
|
|
27
33
|
return { plugins };
|
|
28
34
|
};
|
|
29
35
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAKA,yEAAsD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.5-alpha.
|
|
3
|
+
"version": "0.0.5-alpha.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,8 +15,10 @@
|
|
|
15
15
|
"author": "yu.pan",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@taro-minify-pack/plugin-async-pack": "0.0.5-alpha.
|
|
19
|
-
"@taro-minify-pack/plugin-
|
|
18
|
+
"@taro-minify-pack/plugin-async-pack": "0.0.5-alpha.5",
|
|
19
|
+
"@taro-minify-pack/plugin-cover-browserslist": "0.0.5-alpha.5",
|
|
20
|
+
"@taro-minify-pack/plugin-remote-assets": "0.0.5-alpha.5",
|
|
21
|
+
"@taro-minify-pack/plugin-bundle-analyzer": "0.0.5-alpha.5"
|
|
20
22
|
},
|
|
21
23
|
"devDependencies": {
|
|
22
24
|
"@types/node": "^18.19.130",
|
package/src/index.ts
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
|
-
import { RemoteAssetPluginOpt } from '@taro-minify-pack/plugin-remote-assets'
|
|
2
|
-
import { AsyncPackOpts } from '@taro-minify-pack/plugin-async-pack'
|
|
1
|
+
import type { RemoteAssetPluginOpt } from '@taro-minify-pack/plugin-remote-assets'
|
|
2
|
+
import type { AsyncPackOpts } from '@taro-minify-pack/plugin-async-pack'
|
|
3
|
+
import type{ CoverBrowsersListOpt } from '@taro-minify-pack/plugin-cover-browserslist'
|
|
4
|
+
import type { BundleAnalyzerOpt } from '@taro-minify-pack/plugin-bundle-analyzer'
|
|
3
5
|
|
|
4
6
|
export * from '@taro-minify-pack/plugin-remote-assets'
|
|
5
7
|
|
|
6
8
|
interface Opt {
|
|
7
|
-
remoteAssets?: RemoteAssetPluginOpt
|
|
8
9
|
asyncPack?: AsyncPackOpts | boolean
|
|
10
|
+
bundleAnalyzer?:BundleAnalyzerOpt | boolean
|
|
11
|
+
coverBrowsersList?: CoverBrowsersListOpt
|
|
12
|
+
remoteAssets?: RemoteAssetPluginOpt
|
|
9
13
|
}
|
|
10
14
|
|
|
11
15
|
export default (_: any, opt: Opt) => {
|
|
12
|
-
const { remoteAssets, asyncPack } = opt
|
|
16
|
+
const { remoteAssets, asyncPack, coverBrowsersList, bundleAnalyzer } = opt
|
|
13
17
|
const plugins = []
|
|
18
|
+
|
|
19
|
+
// 远程静态资源插件
|
|
14
20
|
if (remoteAssets) plugins.push([require.resolve('@taro-minify-pack/plugin-remote-assets'), remoteAssets])
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
|
|
22
|
+
// 覆盖 BrowsersList 插件
|
|
23
|
+
if (coverBrowsersList) plugins.push([require.resolve('@taro-minify-pack/plugin-cover-browserslist'), coverBrowsersList])
|
|
24
|
+
|
|
25
|
+
// 异步分包插件
|
|
26
|
+
if (Boolean(asyncPack) && typeof asyncPack === 'boolean') plugins.push(require.resolve('@taro-minify-pack/plugin-async-pack'))
|
|
27
|
+
if (Boolean(asyncPack) && typeof asyncPack !== 'boolean') plugins.push([require.resolve('@taro-minify-pack/plugin-async-pack'), asyncPack])
|
|
28
|
+
|
|
29
|
+
// 包体积分析插件
|
|
30
|
+
if (Boolean(bundleAnalyzer) && typeof bundleAnalyzer === 'boolean') plugins.push(require.resolve('@taro-minify-pack/plugin-bundle-analyzer'))
|
|
31
|
+
if (Boolean(bundleAnalyzer) && typeof bundleAnalyzer !== 'boolean') plugins.push([require.resolve('@taro-minify-pack/plugin-bundle-analyzer'), bundleAnalyzer])
|
|
32
|
+
|
|
17
33
|
return { plugins }
|
|
18
34
|
}
|