@sepveneto/plugin-mp-router-view 0.3.2 → 0.3.4
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/README.md +3 -3
- package/dist/{chunk-ID2REES4.js → chunk-TUTSLW5Q.js} +6 -10
- package/dist/esbuild.cjs +5 -10
- package/dist/esbuild.js +4 -3
- package/dist/index.cjs +11 -11
- package/dist/index.d.ts +5 -3
- package/dist/index.js +7 -3
- package/dist/rollup.cjs +5 -10
- package/dist/rollup.js +4 -3
- package/dist/type.d.cjs +1 -1
- package/dist/types.cjs +1 -1
- package/dist/vite.cjs +5 -10
- package/dist/vite.js +4 -3
- package/dist/webpack.cjs +40 -50
- package/dist/webpack.d.ts +2 -2
- package/dist/webpack.js +4 -9
- package/package.json +3 -3
- package/dist/nuxt.cjs +0 -37230
- package/dist/nuxt.d.ts +0 -5
- package/dist/nuxt.js +0 -18
package/README.md
CHANGED
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
|
|
12
12
|
### 安装
|
|
13
13
|
```bash
|
|
14
|
-
npm i @
|
|
15
|
-
yarn add @
|
|
16
|
-
pnpm i @
|
|
14
|
+
npm i @sepveneto/plugin-mp-router-view
|
|
15
|
+
yarn add @sepveneto/plugin-mp-router-view
|
|
16
|
+
pnpm i @sepveneto/plugin-mp-router-view
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
### 使用
|
|
@@ -37054,12 +37054,6 @@ function countRouterView(code) {
|
|
|
37054
37054
|
if (node2.tag === "router-view") {
|
|
37055
37055
|
++count;
|
|
37056
37056
|
return true;
|
|
37057
|
-
} else {
|
|
37058
|
-
if (count) {
|
|
37059
|
-
after += node2.loc.source;
|
|
37060
|
-
} else {
|
|
37061
|
-
before += node2.loc.source;
|
|
37062
|
-
}
|
|
37063
37057
|
}
|
|
37064
37058
|
}
|
|
37065
37059
|
traverse(ast);
|
|
@@ -37159,7 +37153,7 @@ function transform2(path4, code, entryPages, level) {
|
|
|
37159
37153
|
|
|
37160
37154
|
// src/index.ts
|
|
37161
37155
|
var NAME = "unplugin-mp-router-view";
|
|
37162
|
-
var
|
|
37156
|
+
var unpluginFactory = (options) => {
|
|
37163
37157
|
var _a, _b;
|
|
37164
37158
|
const log3 = (_a = options == null ? void 0 : options.log) != null ? _a : "error";
|
|
37165
37159
|
const entryPages = getPages((_b = options == null ? void 0 : options.collect) != null ? _b : true);
|
|
@@ -37175,12 +37169,14 @@ var src_default = createUnplugin((options) => {
|
|
|
37175
37169
|
return res;
|
|
37176
37170
|
}
|
|
37177
37171
|
};
|
|
37178
|
-
}
|
|
37172
|
+
};
|
|
37173
|
+
var unplugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
|
|
37174
|
+
var src_default = unplugin;
|
|
37179
37175
|
|
|
37180
37176
|
export {
|
|
37181
|
-
getPages,
|
|
37182
|
-
transform2 as transform,
|
|
37183
37177
|
NAME,
|
|
37178
|
+
unpluginFactory,
|
|
37179
|
+
unplugin,
|
|
37184
37180
|
src_default
|
|
37185
37181
|
};
|
|
37186
37182
|
/*!
|
package/dist/esbuild.cjs
CHANGED
|
@@ -58,6 +58,7 @@ __export(esbuild_exports, {
|
|
|
58
58
|
default: () => esbuild_default
|
|
59
59
|
});
|
|
60
60
|
module.exports = __toCommonJS(esbuild_exports);
|
|
61
|
+
var import_unplugin2 = require("unplugin");
|
|
61
62
|
|
|
62
63
|
// src/index.ts
|
|
63
64
|
var import_node_path2 = __toESM(require("path"), 1);
|
|
@@ -37083,12 +37084,6 @@ function countRouterView(code) {
|
|
|
37083
37084
|
if (node2.tag === "router-view") {
|
|
37084
37085
|
++count;
|
|
37085
37086
|
return true;
|
|
37086
|
-
} else {
|
|
37087
|
-
if (count) {
|
|
37088
|
-
after += node2.loc.source;
|
|
37089
|
-
} else {
|
|
37090
|
-
before += node2.loc.source;
|
|
37091
|
-
}
|
|
37092
37087
|
}
|
|
37093
37088
|
}
|
|
37094
37089
|
traverse(ast);
|
|
@@ -37188,7 +37183,7 @@ function transform2(path4, code, entryPages, level) {
|
|
|
37188
37183
|
|
|
37189
37184
|
// src/index.ts
|
|
37190
37185
|
var NAME = "unplugin-mp-router-view";
|
|
37191
|
-
var
|
|
37186
|
+
var unpluginFactory = (options) => {
|
|
37192
37187
|
var _a, _b;
|
|
37193
37188
|
const log3 = (_a = options == null ? void 0 : options.log) != null ? _a : "error";
|
|
37194
37189
|
const entryPages = getPages((_b = options == null ? void 0 : options.collect) != null ? _b : true);
|
|
@@ -37204,10 +37199,10 @@ var src_default = (0, import_unplugin.createUnplugin)((options) => {
|
|
|
37204
37199
|
return res;
|
|
37205
37200
|
}
|
|
37206
37201
|
};
|
|
37207
|
-
}
|
|
37202
|
+
};
|
|
37208
37203
|
|
|
37209
37204
|
// src/esbuild.ts
|
|
37210
|
-
var esbuild_default =
|
|
37205
|
+
var esbuild_default = (0, import_unplugin2.createEsbuildPlugin)(unpluginFactory);
|
|
37211
37206
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37212
37207
|
0 && (module.exports = {});
|
|
37213
37208
|
/*!
|
|
@@ -37218,4 +37213,4 @@ var esbuild_default = src_default.esbuild;
|
|
|
37218
37213
|
*/
|
|
37219
37214
|
/*! https://mths.be/cssesc v3.0.0 by @mathias */
|
|
37220
37215
|
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
37221
|
-
exports.default = module.exports;
|
|
37216
|
+
if (module.exports.default) module.exports = module.exports.default;
|
package/dist/esbuild.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
unpluginFactory
|
|
3
|
+
} from "./chunk-TUTSLW5Q.js";
|
|
4
4
|
|
|
5
5
|
// src/esbuild.ts
|
|
6
|
-
|
|
6
|
+
import { createEsbuildPlugin } from "unplugin";
|
|
7
|
+
var esbuild_default = createEsbuildPlugin(unpluginFactory);
|
|
7
8
|
export {
|
|
8
9
|
esbuild_default as default
|
|
9
10
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -56,7 +56,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
56
56
|
var src_exports = {};
|
|
57
57
|
__export(src_exports, {
|
|
58
58
|
NAME: () => NAME,
|
|
59
|
-
default: () => src_default
|
|
59
|
+
default: () => src_default,
|
|
60
|
+
unplugin: () => unplugin,
|
|
61
|
+
unpluginFactory: () => unpluginFactory
|
|
60
62
|
});
|
|
61
63
|
module.exports = __toCommonJS(src_exports);
|
|
62
64
|
var import_node_path2 = __toESM(require("path"), 1);
|
|
@@ -37082,12 +37084,6 @@ function countRouterView(code) {
|
|
|
37082
37084
|
if (node2.tag === "router-view") {
|
|
37083
37085
|
++count;
|
|
37084
37086
|
return true;
|
|
37085
|
-
} else {
|
|
37086
|
-
if (count) {
|
|
37087
|
-
after += node2.loc.source;
|
|
37088
|
-
} else {
|
|
37089
|
-
before += node2.loc.source;
|
|
37090
|
-
}
|
|
37091
37087
|
}
|
|
37092
37088
|
}
|
|
37093
37089
|
traverse(ast);
|
|
@@ -37187,7 +37183,7 @@ function transform2(path4, code, entryPages, level) {
|
|
|
37187
37183
|
|
|
37188
37184
|
// src/index.ts
|
|
37189
37185
|
var NAME = "unplugin-mp-router-view";
|
|
37190
|
-
var
|
|
37186
|
+
var unpluginFactory = (options) => {
|
|
37191
37187
|
var _a, _b;
|
|
37192
37188
|
const log3 = (_a = options == null ? void 0 : options.log) != null ? _a : "error";
|
|
37193
37189
|
const entryPages = getPages((_b = options == null ? void 0 : options.collect) != null ? _b : true);
|
|
@@ -37203,10 +37199,14 @@ var src_default = (0, import_unplugin.createUnplugin)((options) => {
|
|
|
37203
37199
|
return res;
|
|
37204
37200
|
}
|
|
37205
37201
|
};
|
|
37206
|
-
}
|
|
37202
|
+
};
|
|
37203
|
+
var unplugin = /* @__PURE__ */ (0, import_unplugin.createUnplugin)(unpluginFactory);
|
|
37204
|
+
var src_default = unplugin;
|
|
37207
37205
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37208
37206
|
0 && (module.exports = {
|
|
37209
|
-
NAME
|
|
37207
|
+
NAME,
|
|
37208
|
+
unplugin,
|
|
37209
|
+
unpluginFactory
|
|
37210
37210
|
});
|
|
37211
37211
|
/*!
|
|
37212
37212
|
* The buffer module from node.js, for the browser.
|
|
@@ -37216,4 +37216,4 @@ var src_default = (0, import_unplugin.createUnplugin)((options) => {
|
|
|
37216
37216
|
*/
|
|
37217
37217
|
/*! https://mths.be/cssesc v3.0.0 by @mathias */
|
|
37218
37218
|
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
37219
|
-
exports.default = module.exports;
|
|
37219
|
+
if (module.exports.default) module.exports = module.exports.default;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _unplugin from 'unplugin';
|
|
2
|
+
import { UnpluginFactory } from 'unplugin';
|
|
2
3
|
import { Options } from './types.js';
|
|
3
4
|
|
|
4
5
|
declare const NAME = "unplugin-mp-router-view";
|
|
5
|
-
declare const
|
|
6
|
+
declare const unpluginFactory: UnpluginFactory<Options | undefined>;
|
|
7
|
+
declare const unplugin: _unplugin.UnpluginInstance<Options | undefined, boolean>;
|
|
6
8
|
|
|
7
|
-
export { NAME,
|
|
9
|
+
export { NAME, unplugin as default, unplugin, unpluginFactory };
|
package/dist/index.js
CHANGED
package/dist/rollup.cjs
CHANGED
|
@@ -58,6 +58,7 @@ __export(rollup_exports, {
|
|
|
58
58
|
default: () => rollup_default
|
|
59
59
|
});
|
|
60
60
|
module.exports = __toCommonJS(rollup_exports);
|
|
61
|
+
var import_unplugin2 = require("unplugin");
|
|
61
62
|
|
|
62
63
|
// src/index.ts
|
|
63
64
|
var import_node_path2 = __toESM(require("path"), 1);
|
|
@@ -37083,12 +37084,6 @@ function countRouterView(code) {
|
|
|
37083
37084
|
if (node2.tag === "router-view") {
|
|
37084
37085
|
++count;
|
|
37085
37086
|
return true;
|
|
37086
|
-
} else {
|
|
37087
|
-
if (count) {
|
|
37088
|
-
after += node2.loc.source;
|
|
37089
|
-
} else {
|
|
37090
|
-
before += node2.loc.source;
|
|
37091
|
-
}
|
|
37092
37087
|
}
|
|
37093
37088
|
}
|
|
37094
37089
|
traverse(ast);
|
|
@@ -37188,7 +37183,7 @@ function transform2(path4, code, entryPages, level) {
|
|
|
37188
37183
|
|
|
37189
37184
|
// src/index.ts
|
|
37190
37185
|
var NAME = "unplugin-mp-router-view";
|
|
37191
|
-
var
|
|
37186
|
+
var unpluginFactory = (options) => {
|
|
37192
37187
|
var _a, _b;
|
|
37193
37188
|
const log3 = (_a = options == null ? void 0 : options.log) != null ? _a : "error";
|
|
37194
37189
|
const entryPages = getPages((_b = options == null ? void 0 : options.collect) != null ? _b : true);
|
|
@@ -37204,10 +37199,10 @@ var src_default = (0, import_unplugin.createUnplugin)((options) => {
|
|
|
37204
37199
|
return res;
|
|
37205
37200
|
}
|
|
37206
37201
|
};
|
|
37207
|
-
}
|
|
37202
|
+
};
|
|
37208
37203
|
|
|
37209
37204
|
// src/rollup.ts
|
|
37210
|
-
var rollup_default =
|
|
37205
|
+
var rollup_default = (0, import_unplugin2.createRollupPlugin)(unpluginFactory);
|
|
37211
37206
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37212
37207
|
0 && (module.exports = {});
|
|
37213
37208
|
/*!
|
|
@@ -37218,4 +37213,4 @@ var rollup_default = src_default.rollup;
|
|
|
37218
37213
|
*/
|
|
37219
37214
|
/*! https://mths.be/cssesc v3.0.0 by @mathias */
|
|
37220
37215
|
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
37221
|
-
exports.default = module.exports;
|
|
37216
|
+
if (module.exports.default) module.exports = module.exports.default;
|
package/dist/rollup.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
unpluginFactory
|
|
3
|
+
} from "./chunk-TUTSLW5Q.js";
|
|
4
4
|
|
|
5
5
|
// src/rollup.ts
|
|
6
|
-
|
|
6
|
+
import { createRollupPlugin } from "unplugin";
|
|
7
|
+
var rollup_default = createRollupPlugin(unpluginFactory);
|
|
7
8
|
export {
|
|
8
9
|
rollup_default as default
|
|
9
10
|
};
|
package/dist/type.d.cjs
CHANGED
|
@@ -16,4 +16,4 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
16
16
|
// src/type.d.ts
|
|
17
17
|
var type_d_exports = {};
|
|
18
18
|
module.exports = __toCommonJS(type_d_exports);
|
|
19
|
-
exports.default = module.exports;
|
|
19
|
+
if (module.exports.default) module.exports = module.exports.default;
|
package/dist/types.cjs
CHANGED
|
@@ -16,4 +16,4 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
16
16
|
// src/types.ts
|
|
17
17
|
var types_exports = {};
|
|
18
18
|
module.exports = __toCommonJS(types_exports);
|
|
19
|
-
exports.default = module.exports;
|
|
19
|
+
if (module.exports.default) module.exports = module.exports.default;
|
package/dist/vite.cjs
CHANGED
|
@@ -58,6 +58,7 @@ __export(vite_exports, {
|
|
|
58
58
|
default: () => vite_default
|
|
59
59
|
});
|
|
60
60
|
module.exports = __toCommonJS(vite_exports);
|
|
61
|
+
var import_unplugin2 = require("unplugin");
|
|
61
62
|
|
|
62
63
|
// src/index.ts
|
|
63
64
|
var import_node_path2 = __toESM(require("path"), 1);
|
|
@@ -37083,12 +37084,6 @@ function countRouterView(code) {
|
|
|
37083
37084
|
if (node2.tag === "router-view") {
|
|
37084
37085
|
++count;
|
|
37085
37086
|
return true;
|
|
37086
|
-
} else {
|
|
37087
|
-
if (count) {
|
|
37088
|
-
after += node2.loc.source;
|
|
37089
|
-
} else {
|
|
37090
|
-
before += node2.loc.source;
|
|
37091
|
-
}
|
|
37092
37087
|
}
|
|
37093
37088
|
}
|
|
37094
37089
|
traverse(ast);
|
|
@@ -37188,7 +37183,7 @@ function transform2(path4, code, entryPages, level) {
|
|
|
37188
37183
|
|
|
37189
37184
|
// src/index.ts
|
|
37190
37185
|
var NAME = "unplugin-mp-router-view";
|
|
37191
|
-
var
|
|
37186
|
+
var unpluginFactory = (options) => {
|
|
37192
37187
|
var _a, _b;
|
|
37193
37188
|
const log3 = (_a = options == null ? void 0 : options.log) != null ? _a : "error";
|
|
37194
37189
|
const entryPages = getPages((_b = options == null ? void 0 : options.collect) != null ? _b : true);
|
|
@@ -37204,10 +37199,10 @@ var src_default = (0, import_unplugin.createUnplugin)((options) => {
|
|
|
37204
37199
|
return res;
|
|
37205
37200
|
}
|
|
37206
37201
|
};
|
|
37207
|
-
}
|
|
37202
|
+
};
|
|
37208
37203
|
|
|
37209
37204
|
// src/vite.ts
|
|
37210
|
-
var vite_default =
|
|
37205
|
+
var vite_default = (0, import_unplugin2.createVitePlugin)(unpluginFactory);
|
|
37211
37206
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37212
37207
|
0 && (module.exports = {});
|
|
37213
37208
|
/*!
|
|
@@ -37218,4 +37213,4 @@ var vite_default = src_default.vite;
|
|
|
37218
37213
|
*/
|
|
37219
37214
|
/*! https://mths.be/cssesc v3.0.0 by @mathias */
|
|
37220
37215
|
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
37221
|
-
exports.default = module.exports;
|
|
37216
|
+
if (module.exports.default) module.exports = module.exports.default;
|
package/dist/vite.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
unpluginFactory
|
|
3
|
+
} from "./chunk-TUTSLW5Q.js";
|
|
4
4
|
|
|
5
5
|
// src/vite.ts
|
|
6
|
-
|
|
6
|
+
import { createVitePlugin } from "unplugin";
|
|
7
|
+
var vite_default = createVitePlugin(unpluginFactory);
|
|
7
8
|
export {
|
|
8
9
|
vite_default as default
|
|
9
10
|
};
|
package/dist/webpack.cjs
CHANGED
|
@@ -58,38 +58,19 @@ __export(webpack_exports, {
|
|
|
58
58
|
default: () => webpack_default
|
|
59
59
|
});
|
|
60
60
|
module.exports = __toCommonJS(webpack_exports);
|
|
61
|
+
var import_unplugin2 = require("unplugin");
|
|
62
|
+
|
|
63
|
+
// src/index.ts
|
|
64
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
65
|
+
var import_unplugin = require("unplugin");
|
|
61
66
|
|
|
62
67
|
// src/util/parse.ts
|
|
63
68
|
var import_node_fs = __toESM(require("fs"), 1);
|
|
64
|
-
var
|
|
69
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
65
70
|
var import_jsonc_parser = require("jsonc-parser");
|
|
66
71
|
|
|
67
72
|
// src/util/error.ts
|
|
68
73
|
var import_colors = __toESM(require("colors"), 1);
|
|
69
|
-
|
|
70
|
-
// src/index.ts
|
|
71
|
-
var import_node_path = __toESM(require("path"), 1);
|
|
72
|
-
var import_unplugin = require("unplugin");
|
|
73
|
-
var NAME = "unplugin-mp-router-view";
|
|
74
|
-
var src_default = (0, import_unplugin.createUnplugin)((options) => {
|
|
75
|
-
var _a, _b;
|
|
76
|
-
const log3 = (_a = options == null ? void 0 : options.log) != null ? _a : "error";
|
|
77
|
-
const entryPages = getPages((_b = options == null ? void 0 : options.collect) != null ? _b : true);
|
|
78
|
-
return {
|
|
79
|
-
name: NAME,
|
|
80
|
-
enforce: "pre",
|
|
81
|
-
transformInclude(id2) {
|
|
82
|
-
const _id = import_node_path.default.resolve(id2);
|
|
83
|
-
return isAppVue(_id) || isEntryPage(_id, entryPages);
|
|
84
|
-
},
|
|
85
|
-
transform(code, id2) {
|
|
86
|
-
const res = transform(import_node_path.default.resolve(id2), code, entryPages, log3);
|
|
87
|
-
return res;
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// src/util/error.ts
|
|
93
74
|
function genError(msg) {
|
|
94
75
|
return `${import_colors.default.yellow(`
|
|
95
76
|
[${NAME}]`)} ${import_colors.default.red(`\u2716 ${msg}`)}`;
|
|
@@ -14634,7 +14615,7 @@ function createTransformContext(root2, { filename = "", prefixIdentifiers = fals
|
|
|
14634
14615
|
}
|
|
14635
14616
|
return context;
|
|
14636
14617
|
}
|
|
14637
|
-
function
|
|
14618
|
+
function transform(root2, options) {
|
|
14638
14619
|
const context = createTransformContext(root2, options);
|
|
14639
14620
|
traverseNode(root2, context);
|
|
14640
14621
|
if (options.hoistStatic) {
|
|
@@ -19090,7 +19071,7 @@ function baseCompile(template, options = {}) {
|
|
|
19090
19071
|
options.expressionPlugins = [...expressionPlugins || [], "typescript"];
|
|
19091
19072
|
}
|
|
19092
19073
|
}
|
|
19093
|
-
|
|
19074
|
+
transform(ast, extend({}, options, {
|
|
19094
19075
|
prefixIdentifiers,
|
|
19095
19076
|
nodeTransforms: [
|
|
19096
19077
|
...nodeTransforms,
|
|
@@ -22029,7 +22010,7 @@ var CompilerDOM = /* @__PURE__ */ Object.freeze({
|
|
|
22029
22010
|
TRANSITION_GROUP,
|
|
22030
22011
|
baseCompile,
|
|
22031
22012
|
baseParse,
|
|
22032
|
-
transform
|
|
22013
|
+
transform,
|
|
22033
22014
|
createTransformContext,
|
|
22034
22015
|
traverseNode,
|
|
22035
22016
|
createStructuralDirectiveTransform,
|
|
@@ -24976,7 +24957,7 @@ function basename(path4, ext) {
|
|
|
24976
24957
|
function extname(path4) {
|
|
24977
24958
|
return splitPath(path4)[3];
|
|
24978
24959
|
}
|
|
24979
|
-
var
|
|
24960
|
+
var path = {
|
|
24980
24961
|
extname,
|
|
24981
24962
|
basename,
|
|
24982
24963
|
dirname,
|
|
@@ -25017,7 +24998,7 @@ var _polyfillNode_path = /* @__PURE__ */ Object.freeze({
|
|
|
25017
24998
|
dirname,
|
|
25018
24999
|
basename,
|
|
25019
25000
|
extname,
|
|
25020
|
-
"default":
|
|
25001
|
+
"default": path
|
|
25021
25002
|
});
|
|
25022
25003
|
var maxInt = 2147483647;
|
|
25023
25004
|
var base = 36;
|
|
@@ -26514,7 +26495,7 @@ var transformAssetUrl = (node2, context, options = defaultAssetUrlOptions) => {
|
|
|
26514
26495
|
const protocol = base2.protocol || "";
|
|
26515
26496
|
const host = base2.host ? protocol + "//" + base2.host : "";
|
|
26516
26497
|
const basePath = base2.path || "/";
|
|
26517
|
-
attr.value.content = host + (
|
|
26498
|
+
attr.value.content = host + (path.posix || path).join(basePath, url.path + (url.hash || ""));
|
|
26518
26499
|
return;
|
|
26519
26500
|
}
|
|
26520
26501
|
const exp = getImportsExpressionExp(url.path, url.hash, attr.loc, context);
|
|
@@ -26601,7 +26582,7 @@ var transformSrcset = (node2, context, options = defaultAssetUrlOptions) => {
|
|
|
26601
26582
|
let { url, descriptor } = candidate;
|
|
26602
26583
|
descriptor = descriptor ? ` ${descriptor}` : ``;
|
|
26603
26584
|
if (url[0] === ".") {
|
|
26604
|
-
candidate.url = (
|
|
26585
|
+
candidate.url = (path.posix || path).join(base2, url);
|
|
26605
26586
|
set.push(candidate.url + descriptor);
|
|
26606
26587
|
} else if (shouldProcessUrl(url)) {
|
|
26607
26588
|
needImportTransform = true;
|
|
@@ -27617,7 +27598,7 @@ function compile$1(template, options = {}) {
|
|
|
27617
27598
|
});
|
|
27618
27599
|
const ast = baseParse(template, options);
|
|
27619
27600
|
rawOptionsMap.set(ast, options);
|
|
27620
|
-
|
|
27601
|
+
transform(ast, Object.assign(Object.assign({}, options), { hoistStatic: false, nodeTransforms: [
|
|
27621
27602
|
ssrTransformIf,
|
|
27622
27603
|
ssrTransformFor,
|
|
27623
27604
|
trackVForSlotScopes,
|
|
@@ -27823,7 +27804,7 @@ function resolveTemplateUsageCheckString(sfc) {
|
|
|
27823
27804
|
return cached;
|
|
27824
27805
|
}
|
|
27825
27806
|
let code = "";
|
|
27826
|
-
|
|
27807
|
+
transform(createRoot([ast]), {
|
|
27827
27808
|
nodeTransforms: [
|
|
27828
27809
|
(node2) => {
|
|
27829
27810
|
if (node2.type === 1) {
|
|
@@ -37103,12 +37084,6 @@ function countRouterView(code) {
|
|
|
37103
37084
|
if (node2.tag === "router-view") {
|
|
37104
37085
|
++count;
|
|
37105
37086
|
return true;
|
|
37106
|
-
} else {
|
|
37107
|
-
if (count) {
|
|
37108
|
-
after += node2.loc.source;
|
|
37109
|
-
} else {
|
|
37110
|
-
before += node2.loc.source;
|
|
37111
|
-
}
|
|
37112
37087
|
}
|
|
37113
37088
|
}
|
|
37114
37089
|
traverse(ast);
|
|
@@ -37149,7 +37124,7 @@ function addToFooter(code, footer2) {
|
|
|
37149
37124
|
return code.replace(/(<\/view>)(\s*)(<\/template>)(?!(([\s\S]*)(<\/template>)))/, (p) => footer2 + p);
|
|
37150
37125
|
}
|
|
37151
37126
|
function getPages(collectMode) {
|
|
37152
|
-
const jsonStr = import_node_fs.default.readFileSync(
|
|
37127
|
+
const jsonStr = import_node_fs.default.readFileSync(import_node_path.default.resolve(INPUT_DIR, "pages.json"), "utf-8");
|
|
37153
37128
|
const pagesJson = parseJson(jsonStr);
|
|
37154
37129
|
const { pages, subPackages = [] } = pagesJson;
|
|
37155
37130
|
const entryList = [...collectEntry(collectMode, pages), ...collectEntry(collectMode, subPackages)];
|
|
@@ -37165,7 +37140,7 @@ function collectEntry(collectMode, json, root2 = "") {
|
|
|
37165
37140
|
if (!collectMode) {
|
|
37166
37141
|
return;
|
|
37167
37142
|
}
|
|
37168
|
-
const _path2 =
|
|
37143
|
+
const _path2 = import_node_path.default.resolve(INPUT_DIR, `${root2}${root2 ? "/" : ""}${item.path}`);
|
|
37169
37144
|
if (collectMode && typeof collectMode === "boolean" && !item["ROUTER_VIEW_EXCLUDE"]) {
|
|
37170
37145
|
entryList.push(_path2);
|
|
37171
37146
|
} else if (typeof collectMode === "string" && item[collectMode]) {
|
|
@@ -37185,7 +37160,7 @@ function combineCode(code, header2, footer2) {
|
|
|
37185
37160
|
code = addToFooter(code, footer2);
|
|
37186
37161
|
return code;
|
|
37187
37162
|
}
|
|
37188
|
-
function
|
|
37163
|
+
function transform2(path4, code, entryPages, level) {
|
|
37189
37164
|
logLevel = level;
|
|
37190
37165
|
if (isAppVue(path4)) {
|
|
37191
37166
|
log(`\u57FA\u4E8E\u5E73\u53F0${process.env.UNI_PLATFORM}, \u5904\u7406App.vue...`, logLevel);
|
|
@@ -37206,13 +37181,28 @@ function transform(path4, code, entryPages, level) {
|
|
|
37206
37181
|
return code;
|
|
37207
37182
|
}
|
|
37208
37183
|
|
|
37209
|
-
// src/
|
|
37210
|
-
|
|
37184
|
+
// src/index.ts
|
|
37185
|
+
var NAME = "unplugin-mp-router-view";
|
|
37186
|
+
var unpluginFactory = (options) => {
|
|
37211
37187
|
var _a, _b;
|
|
37212
|
-
const
|
|
37213
|
-
const entryPages = getPages(collect);
|
|
37214
|
-
return
|
|
37215
|
-
|
|
37188
|
+
const log3 = (_a = options == null ? void 0 : options.log) != null ? _a : "error";
|
|
37189
|
+
const entryPages = getPages((_b = options == null ? void 0 : options.collect) != null ? _b : true);
|
|
37190
|
+
return {
|
|
37191
|
+
name: NAME,
|
|
37192
|
+
enforce: "pre",
|
|
37193
|
+
transformInclude(id2) {
|
|
37194
|
+
const _id = import_node_path2.default.resolve(id2);
|
|
37195
|
+
return isAppVue(_id) || isEntryPage(_id, entryPages);
|
|
37196
|
+
},
|
|
37197
|
+
transform(code, id2) {
|
|
37198
|
+
const res = transform2(import_node_path2.default.resolve(id2), code, entryPages, log3);
|
|
37199
|
+
return res;
|
|
37200
|
+
}
|
|
37201
|
+
};
|
|
37202
|
+
};
|
|
37203
|
+
|
|
37204
|
+
// src/webpack.ts
|
|
37205
|
+
var webpack_default = (0, import_unplugin2.createWebpackPlugin)(unpluginFactory);
|
|
37216
37206
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37217
37207
|
0 && (module.exports = {});
|
|
37218
37208
|
/*!
|
|
@@ -37223,4 +37213,4 @@ function webpack_default(code) {
|
|
|
37223
37213
|
*/
|
|
37224
37214
|
/*! https://mths.be/cssesc v3.0.0 by @mathias */
|
|
37225
37215
|
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
37226
|
-
exports.default = module.exports;
|
|
37216
|
+
if (module.exports.default) module.exports = module.exports.default;
|
package/dist/webpack.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as webpack from 'webpack';
|
|
2
2
|
import { Options } from './types.js';
|
|
3
3
|
|
|
4
|
-
declare
|
|
4
|
+
declare const _default: (options?: Options | undefined) => webpack.WebpackPluginInstance;
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { _default as default };
|
package/dist/webpack.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "./chunk-ID2REES4.js";
|
|
2
|
+
unpluginFactory
|
|
3
|
+
} from "./chunk-TUTSLW5Q.js";
|
|
5
4
|
|
|
6
5
|
// src/webpack.ts
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const { log = "error", collect = true } = (_b = (_a = this.getOptions) == null ? void 0 : _a.call(this)) != null ? _b : this.query;
|
|
10
|
-
const entryPages = getPages(collect);
|
|
11
|
-
return transform(this.resourcePath, code, entryPages, log);
|
|
12
|
-
}
|
|
6
|
+
import { createWebpackPlugin } from "unplugin";
|
|
7
|
+
var webpack_default = createWebpackPlugin(unpluginFactory);
|
|
13
8
|
export {
|
|
14
9
|
webpack_default as default
|
|
15
10
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sepveneto/plugin-mp-router-view",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.4",
|
|
5
5
|
"packageManager": "pnpm@7.1.1",
|
|
6
6
|
"description": "Register global imports on demand for Vite and Webpack",
|
|
7
7
|
"license": "MIT",
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
],
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"colors": "^1.4.0",
|
|
72
|
+
"debug": "^4.3.4",
|
|
72
73
|
"jsonc-parser": "^3.2.0",
|
|
73
74
|
"node-html-parser": "^6.1.4",
|
|
74
|
-
"
|
|
75
|
-
"unplugin": "^1.0.1"
|
|
75
|
+
"unplugin": "^1.4.0"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@antfu/eslint-config": "^0.33.1",
|