@best-shot/preset-mini 0.11.14 → 0.11.16
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/index.mjs +3 -7
- package/package.json +6 -5
- package/transform.mjs +9 -7
package/index.mjs
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { configKeys } from '@into-mini/auto-entries-plugin/helper/utils.mjs';
|
|
1
|
+
import { configKeys } from '@into-mini/auto-entries-plugin/dist/helper/utils.mjs';
|
|
2
2
|
import { transformJS } from './transform.mjs';
|
|
3
3
|
|
|
4
4
|
export function apply({ config: { copy, mini: { type } = {} } }) {
|
|
5
5
|
return async (chain) => {
|
|
6
6
|
if (chain.plugins.has('copy')) {
|
|
7
|
-
const
|
|
8
|
-
.rule('babel')
|
|
9
|
-
.use('babel-loader')
|
|
10
|
-
.get('options');
|
|
11
|
-
const transform = transformJS(targets);
|
|
7
|
+
const transform = transformJS(chain);
|
|
12
8
|
|
|
13
9
|
chain
|
|
14
10
|
.plugin('copy')
|
|
@@ -93,7 +89,7 @@ export function apply({ config: { copy, mini: { type } = {} } }) {
|
|
|
93
89
|
|
|
94
90
|
const rule = chain.module.rule('babel');
|
|
95
91
|
|
|
96
|
-
rule.test(rule.get('test').add('vue'));
|
|
92
|
+
// rule.test(rule.get('test').add('vue'));
|
|
97
93
|
|
|
98
94
|
const { SfcSplitPlugin } = await import('@into-mini/sfc-split-plugin');
|
|
99
95
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@best-shot/preset-mini",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.16",
|
|
4
4
|
"description": "A `best-shot` preset for mini program project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -27,15 +27,16 @@
|
|
|
27
27
|
"main": "index.mjs",
|
|
28
28
|
"type": "module",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@into-mini/auto-entries-plugin": "^0.
|
|
31
|
-
"@into-mini/sfc-split-
|
|
30
|
+
"@into-mini/auto-entries-plugin": "^0.2.0",
|
|
31
|
+
"@into-mini/sfc-split-loader": "^0.2.6",
|
|
32
|
+
"@into-mini/sfc-split-plugin": "^0.5.11",
|
|
32
33
|
"yaml": "^2.8.2"
|
|
33
34
|
},
|
|
34
35
|
"peerDependencies": {
|
|
35
36
|
"@babel/core": "^7.28.5",
|
|
36
37
|
"@best-shot/core": "^0.13.9",
|
|
37
|
-
"@best-shot/preset-
|
|
38
|
-
"@best-shot/preset-
|
|
38
|
+
"@best-shot/preset-babel": "^0.18.6",
|
|
39
|
+
"@best-shot/preset-style": "^0.16.2"
|
|
39
40
|
},
|
|
40
41
|
"engines": {
|
|
41
42
|
"node": ">=22.11.0"
|
package/transform.mjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import babel from '@babel/core';
|
|
2
2
|
|
|
3
|
-
export function transformJS(
|
|
4
|
-
console.log(targets);
|
|
5
|
-
|
|
3
|
+
export function transformJS(chain) {
|
|
6
4
|
return (input, absoluteFrom) => {
|
|
7
|
-
const
|
|
5
|
+
const { targets } = chain.module
|
|
6
|
+
.rule('babel')
|
|
7
|
+
.use('babel-loader')
|
|
8
|
+
.get('options');
|
|
9
|
+
const minimize = chain.optimization.get('minimize');
|
|
8
10
|
|
|
9
11
|
if (!absoluteFrom.endsWith('.js') || absoluteFrom.endsWith('.mjs')) {
|
|
10
12
|
return input;
|
|
@@ -20,10 +22,10 @@ export function transformJS(targets) {
|
|
|
20
22
|
babelrc: false,
|
|
21
23
|
filename: 'a.mjs',
|
|
22
24
|
sourceType: 'commonjs',
|
|
23
|
-
compact: !
|
|
24
|
-
retainLines: !
|
|
25
|
+
compact: !minimize,
|
|
26
|
+
retainLines: !minimize,
|
|
25
27
|
envName: process.env.NODE_ENV,
|
|
26
|
-
minified,
|
|
28
|
+
minified: minimize,
|
|
27
29
|
});
|
|
28
30
|
|
|
29
31
|
return (result?.code || input).replace(
|