@into-mini/sfc-split-plugin 0.5.0 → 0.5.3
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.mjs +63 -22
- package/dist/plugin/entry-rename.mjs +2 -3
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { fileURLToPath } from 'node:url';
|
|
2
2
|
import { AddWxsPlugin } from "./plugin/add-wxs.mjs";
|
|
3
|
-
import { ExposeEntryNamePlugin } from
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import { MinaRuntimeWebpackPlugin } from "./plugin/mina-runtime.mjs";
|
|
3
|
+
// import { ExposeEntryNamePlugin } from './plugin/expose-entry.mts';
|
|
4
|
+
import { EntryRenamePlugin } from "./plugin/entry-rename.mjs";
|
|
5
|
+
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
7
6
|
export const COMPONENT_ROOT = 'as-components';
|
|
8
7
|
function reach(path) {
|
|
9
8
|
return fileURLToPath(import.meta.resolve(path));
|
|
10
9
|
}
|
|
10
|
+
const theLoader = reach('@into-mini/sfc-split-loader/src/index.mts');
|
|
11
11
|
export class SfcSplitPlugin {
|
|
12
12
|
options;
|
|
13
13
|
constructor({ type = false, tagMatcher, preserveTap } = {}) {
|
|
@@ -18,41 +18,82 @@ export class SfcSplitPlugin {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
#applyLoader(compiler) {
|
|
21
|
-
compiler.options.module.rules.push(
|
|
21
|
+
compiler.options.module.rules.push(
|
|
22
|
+
// {
|
|
23
|
+
// test: /\.vue$/,
|
|
24
|
+
// use: [
|
|
25
|
+
// {
|
|
26
|
+
// loader: reach('./loader/fake-vue-loader.mts'),
|
|
27
|
+
// options: {
|
|
28
|
+
// componentRoot: COMPONENT_ROOT,
|
|
29
|
+
// },
|
|
30
|
+
// },
|
|
31
|
+
// ],
|
|
32
|
+
// },
|
|
33
|
+
{
|
|
22
34
|
test: /\.vue$/,
|
|
35
|
+
issuer: /\.vue$/,
|
|
36
|
+
resourceQuery: /type=script/,
|
|
37
|
+
type: 'javascript/esm',
|
|
38
|
+
loader: theLoader,
|
|
39
|
+
}, {
|
|
40
|
+
test: /\.vue$/,
|
|
41
|
+
issuer: /\.vue$/,
|
|
42
|
+
resourceQuery: /type=template/,
|
|
43
|
+
type: 'asset/resource',
|
|
44
|
+
generator: {
|
|
45
|
+
filename: '[path][name].[hash:8].wxml',
|
|
46
|
+
},
|
|
23
47
|
use: [
|
|
24
48
|
{
|
|
25
|
-
loader: reach('
|
|
26
|
-
options: {
|
|
27
|
-
componentRoot: COMPONENT_ROOT,
|
|
28
|
-
},
|
|
49
|
+
loader: reach('@into-mini/wxml-loader'),
|
|
29
50
|
},
|
|
30
51
|
{
|
|
31
|
-
loader:
|
|
32
|
-
options: this.options,
|
|
52
|
+
loader: theLoader,
|
|
33
53
|
},
|
|
34
54
|
],
|
|
35
55
|
}, {
|
|
36
|
-
test: /\.
|
|
56
|
+
test: /\.vue$/,
|
|
57
|
+
issuer: /\.vue$/,
|
|
58
|
+
resourceQuery: /type=style/,
|
|
59
|
+
use: [
|
|
60
|
+
{ loader: MiniCssExtractPlugin.loader },
|
|
61
|
+
{ loader: 'css-loader' },
|
|
62
|
+
{ loader: theLoader },
|
|
63
|
+
],
|
|
64
|
+
}, {
|
|
65
|
+
test: /\.vue$/,
|
|
66
|
+
issuer: /\.vue$/,
|
|
67
|
+
resourceQuery: [/type=config&lang=json/],
|
|
37
68
|
type: 'asset/resource',
|
|
38
|
-
loader: reach('@into-mini/wxml-loader'),
|
|
39
69
|
generator: {
|
|
40
|
-
filename: '[
|
|
41
|
-
// filename: '[contenthash:8][ext]',
|
|
70
|
+
filename: '[path][hash:8].json',
|
|
42
71
|
},
|
|
72
|
+
loader: theLoader,
|
|
73
|
+
}, {
|
|
74
|
+
test: /\.vue$/,
|
|
75
|
+
resourceQuery: { not: /type=/ },
|
|
76
|
+
type: 'javascript/esm',
|
|
77
|
+
loader: theLoader,
|
|
78
|
+
}, {
|
|
79
|
+
test: /\.vue$/,
|
|
80
|
+
enforce: 'pre',
|
|
81
|
+
loader: reach('@into-mini/sfc-split-loader/src/next.mts'),
|
|
82
|
+
options: this.options,
|
|
43
83
|
});
|
|
44
84
|
}
|
|
45
85
|
apply(compiler) {
|
|
46
86
|
this.#applyLoader(compiler);
|
|
47
|
-
const { type
|
|
87
|
+
const { type } = this.options;
|
|
48
88
|
if (type) {
|
|
49
89
|
new AddWxsPlugin().apply(compiler);
|
|
50
|
-
new MinaRuntimeWebpackPlugin().apply(compiler);
|
|
51
|
-
new SfcSplitPluginBase({ tagMatcher, preserveTap }).apply(compiler);
|
|
52
|
-
new ExposeEntryNamePlugin().apply(compiler);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
90
|
+
// new MinaRuntimeWebpackPlugin().apply(compiler);
|
|
91
|
+
// new SfcSplitPluginBase({ tagMatcher, preserveTap }).apply(compiler);
|
|
92
|
+
// new ExposeEntryNamePlugin().apply(compiler);
|
|
93
|
+
new EntryRenamePlugin({
|
|
94
|
+
issuer: /\.vue$/,
|
|
95
|
+
test: /\.wxml|json/,
|
|
96
|
+
}).apply(compiler);
|
|
56
97
|
}
|
|
57
98
|
}
|
|
58
99
|
}
|
|
@@ -67,10 +67,9 @@ export class EntryRenamePlugin {
|
|
|
67
67
|
if (newName === filename) {
|
|
68
68
|
continue;
|
|
69
69
|
}
|
|
70
|
-
if (compilation.getAsset(
|
|
71
|
-
|
|
70
|
+
if (compilation.getAsset(filename)) {
|
|
71
|
+
compilation.renameAsset(filename, newName);
|
|
72
72
|
}
|
|
73
|
-
compilation.renameAsset(filename, newName);
|
|
74
73
|
}
|
|
75
74
|
});
|
|
76
75
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@into-mini/sfc-split-plugin",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"loader",
|
|
@@ -28,16 +28,17 @@
|
|
|
28
28
|
],
|
|
29
29
|
"type": "module",
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"mini-css-extract-plugin": "^2.9.4",
|
|
31
32
|
"slash": "^5.1.0",
|
|
32
33
|
"webpack-virtual-modules": "^0.6.2",
|
|
33
34
|
"yaml": "^2.8.2",
|
|
34
35
|
"@into-mini/clsx": "^0.1.0",
|
|
35
36
|
"@into-mini/sfc-transformer": "^0.6.0",
|
|
36
|
-
"@into-mini/sfc-split-loader": "^0.2.
|
|
37
|
+
"@into-mini/sfc-split-loader": "^0.2.2",
|
|
37
38
|
"@into-mini/wxml-loader": "^0.0.0"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
|
-
"webpack": "^5.
|
|
41
|
+
"webpack": "^5.104.0"
|
|
41
42
|
},
|
|
42
43
|
"engines": {
|
|
43
44
|
"node": ">=22.18.0"
|