@into-mini/sfc-split-plugin 0.5.11 → 0.6.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/index.d.mts +0 -2
- package/dist/index.mjs +0 -74
- package/dist/loader/entry-loader.mjs +2 -3
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { Compiler, WebpackPluginInstance } from 'webpack';
|
|
2
2
|
import type { Options } from '@into-mini/sfc-transformer/src/transformer.mts';
|
|
3
|
-
export declare const COMPONENT_ROOT = "as-components";
|
|
4
3
|
export declare class SfcSplitPlugin implements WebpackPluginInstance {
|
|
5
|
-
#private;
|
|
6
4
|
options: Options;
|
|
7
5
|
constructor({ type, tagMatcher, preserveTap }?: Options);
|
|
8
6
|
apply(compiler: Compiler): void;
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import { fileURLToPath } from 'node:url';
|
|
2
1
|
import { AddWxsPlugin } from "./plugin/add-wxs.mjs";
|
|
3
2
|
import { ExposeEntryNamePlugin } from "./plugin/expose-entry.mjs";
|
|
4
3
|
// import { EntryRenamePlugin } from './plugin/entry-rename.mts';
|
|
5
4
|
import { MinaRuntimeWebpackPlugin } from "./plugin/mina-runtime.mjs";
|
|
6
|
-
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
7
|
-
export const COMPONENT_ROOT = 'as-components';
|
|
8
|
-
function reach(path) {
|
|
9
|
-
return fileURLToPath(import.meta.resolve(path));
|
|
10
|
-
}
|
|
11
|
-
const theLoader = reach('@into-mini/sfc-split-loader/dist/index.mjs');
|
|
12
5
|
export class SfcSplitPlugin {
|
|
13
6
|
options;
|
|
14
7
|
constructor({ type = false, tagMatcher, preserveTap } = {}) {
|
|
@@ -18,74 +11,7 @@ export class SfcSplitPlugin {
|
|
|
18
11
|
preserveTap,
|
|
19
12
|
};
|
|
20
13
|
}
|
|
21
|
-
#applyLoader(compiler) {
|
|
22
|
-
compiler.options.module.rules.push({
|
|
23
|
-
test: /\.vue$/,
|
|
24
|
-
use: [],
|
|
25
|
-
}, {
|
|
26
|
-
test: /\.vue$/,
|
|
27
|
-
issuer: /\.vue$/,
|
|
28
|
-
resourceQuery: /type=script/,
|
|
29
|
-
type: 'javascript/esm',
|
|
30
|
-
loader: theLoader,
|
|
31
|
-
}, {
|
|
32
|
-
test: /\.vue$/,
|
|
33
|
-
issuer: /\.vue$/,
|
|
34
|
-
resourceQuery: /type=template/,
|
|
35
|
-
type: 'asset/resource',
|
|
36
|
-
generator: {
|
|
37
|
-
filename: '[entry].wxml',
|
|
38
|
-
},
|
|
39
|
-
use: [
|
|
40
|
-
{
|
|
41
|
-
loader: reach('@into-mini/wxml-loader'),
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
loader: theLoader,
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
}, {
|
|
48
|
-
test: /\.vue$/,
|
|
49
|
-
issuer: /\.vue$/,
|
|
50
|
-
resourceQuery: /type=style/,
|
|
51
|
-
use: [
|
|
52
|
-
{ loader: MiniCssExtractPlugin.loader },
|
|
53
|
-
{ loader: 'css-loader' },
|
|
54
|
-
{ loader: theLoader },
|
|
55
|
-
],
|
|
56
|
-
}, {
|
|
57
|
-
test: /\.vue$/,
|
|
58
|
-
issuer: /\.vue$/,
|
|
59
|
-
resourceQuery: [/type=config&lang=json/],
|
|
60
|
-
type: 'asset/resource',
|
|
61
|
-
generator: {
|
|
62
|
-
filename: '[entry].json',
|
|
63
|
-
},
|
|
64
|
-
use: [
|
|
65
|
-
{
|
|
66
|
-
loader: reach('@into-mini/sfc-split-plugin/dist/loader/entry-loader.mjs'),
|
|
67
|
-
options: {
|
|
68
|
-
componentRoot: COMPONENT_ROOT,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
loader: theLoader,
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
}, {
|
|
76
|
-
test: /\.vue$/,
|
|
77
|
-
resourceQuery: { not: /type=/ },
|
|
78
|
-
type: 'javascript/esm',
|
|
79
|
-
loader: theLoader,
|
|
80
|
-
}, {
|
|
81
|
-
test: /\.vue$/,
|
|
82
|
-
enforce: 'pre',
|
|
83
|
-
loader: reach('@into-mini/sfc-split-loader/dist/next.mjs'),
|
|
84
|
-
options: this.options,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
14
|
apply(compiler) {
|
|
88
|
-
this.#applyLoader(compiler);
|
|
89
15
|
const { type } = this.options;
|
|
90
16
|
if (type) {
|
|
91
17
|
new AddWxsPlugin().apply(compiler);
|
|
@@ -10,7 +10,8 @@ function createShortHash(input) {
|
|
|
10
10
|
function reach(path) {
|
|
11
11
|
return fileURLToPath(import.meta.resolve(path));
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
const componentRoot = 'as-components';
|
|
14
|
+
function handleImport({ toThis, addSmartEntry, context, rootContext, maps, callback, }) {
|
|
14
15
|
if (Object.keys(maps).length > 0) {
|
|
15
16
|
for (const [name, path] of Object.entries(maps)) {
|
|
16
17
|
if (path.endsWith('.vue') && !path.startsWith('plugin://')) {
|
|
@@ -54,7 +55,6 @@ function handleImport({ toThis, addSmartEntry, componentRoot, context, rootConte
|
|
|
54
55
|
export default function loader(source) {
|
|
55
56
|
this.cacheable();
|
|
56
57
|
const callback = this.async();
|
|
57
|
-
const { componentRoot } = this.getOptions();
|
|
58
58
|
const { entryName: thisEntryName } = this;
|
|
59
59
|
const config = JSON.parse(source);
|
|
60
60
|
const { rootContext, context } = this;
|
|
@@ -86,7 +86,6 @@ export default function loader(source) {
|
|
|
86
86
|
handleImport.bind(this)({
|
|
87
87
|
toThis,
|
|
88
88
|
addSmartEntry,
|
|
89
|
-
componentRoot,
|
|
90
89
|
context,
|
|
91
90
|
rootContext,
|
|
92
91
|
maps: Object.fromEntries(Object.entries(config.componentGenerics)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@into-mini/sfc-split-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"loader",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@into-mini/clsx": "^0.1.0",
|
|
36
36
|
"@into-mini/sfc-split-loader": "^0.2.6",
|
|
37
37
|
"@into-mini/wxml-loader": "^0.0.0",
|
|
38
|
-
"@into-mini/sfc-transformer": "^0.6.
|
|
38
|
+
"@into-mini/sfc-transformer": "^0.6.3"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"webpack": "^5.104.0"
|