@into-mini/sfc-split-plugin 0.2.0 → 0.4.0
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/helper/transform.mjs +32 -0
- package/dist/index.mjs +58 -0
- package/dist/loader/fake-vue-loader.mjs +118 -0
- package/dist/plugin/add-wxs.mjs +48 -0
- package/dist/plugin/entry-rename.mjs +78 -0
- package/dist/plugin/expose-entry-bk.mjs +63 -0
- package/dist/plugin/expose-entry.mjs +79 -0
- package/dist/plugin/mina-runtime.mjs +38 -0
- package/dist/plugin/sfc-split.mjs +74 -0
- package/package.json +8 -9
- package/helper/empty.json +0 -1
- package/helper/transform.mjs +0 -39
- package/loader/fake-vue-loader.mjs +0 -140
- package/plugin/add-wxs.mjs +0 -62
- package/plugin/entry-rename.mjs +0 -109
- package/plugin/expose-entry-bk.mjs +0 -86
- package/plugin/expose-entry.mjs +0 -104
- package/plugin/mina-runtime.mjs +0 -58
- package/plugin/sfc-split.mjs +0 -102
- package/plugin.mjs +0 -62
package/plugin.mjs
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath } from 'node:url';
|
|
2
|
-
|
|
3
|
-
import { AddWxsPlugin } from './plugin/add-wxs.mjs';
|
|
4
|
-
import { ExposeEntryNamePlugin } from './plugin/expose-entry.mjs';
|
|
5
|
-
// import { EntryRenamePlugin } from './plugin/entry-rename.mjs';
|
|
6
|
-
import { SfcSplitPluginBase } from './plugin/sfc-split.mjs';
|
|
7
|
-
import { MinaRuntimeWebpackPlugin } from './plugin/mina-runtime.mjs';
|
|
8
|
-
|
|
9
|
-
export const COMPONENT_ROOT = 'as-components';
|
|
10
|
-
|
|
11
|
-
function reach(path) {
|
|
12
|
-
return fileURLToPath(import.meta.resolve(path));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export class SfcSplitPlugin {
|
|
16
|
-
constructor({ type = false, tagMatcher, preserveTap } = {}) {
|
|
17
|
-
this.type = type;
|
|
18
|
-
this.tagMatcher = tagMatcher;
|
|
19
|
-
this.preserveTap = preserveTap;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
#applyLoader(compiler) {
|
|
23
|
-
compiler.options.module.rules.push(
|
|
24
|
-
// {
|
|
25
|
-
// exclude: /\.(vue|wxml)$/,
|
|
26
|
-
// layer: 'other',
|
|
27
|
-
// },
|
|
28
|
-
{
|
|
29
|
-
test: /\.vue$/,
|
|
30
|
-
loader: reach('./loader/fake-vue-loader.mjs'),
|
|
31
|
-
options: {
|
|
32
|
-
componentRoot: COMPONENT_ROOT,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
test: /\.wxml$/,
|
|
37
|
-
type: 'asset/resource',
|
|
38
|
-
loader: reach('@into-mini/wxml-loader'),
|
|
39
|
-
generator: {
|
|
40
|
-
filename: '[entry][ext]',
|
|
41
|
-
// filename: '[contenthash:8][ext]',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
apply(compiler) {
|
|
48
|
-
this.#applyLoader(compiler);
|
|
49
|
-
|
|
50
|
-
const { type, tagMatcher, preserveTap } = this;
|
|
51
|
-
|
|
52
|
-
if (type) {
|
|
53
|
-
new AddWxsPlugin().apply(compiler);
|
|
54
|
-
new MinaRuntimeWebpackPlugin().apply(compiler);
|
|
55
|
-
new SfcSplitPluginBase({ tagMatcher, preserveTap }).apply(compiler);
|
|
56
|
-
new ExposeEntryNamePlugin().apply(compiler);
|
|
57
|
-
// new EntryRenamePlugin({ issuer: /\.vue$/, test: /\.wxml/ }).apply(
|
|
58
|
-
// compiler,
|
|
59
|
-
// );
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|