@proteus-vue/plugin-vite 0.2.0-beta.5 → 0.2.0-beta.6
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.js +13 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -118,7 +118,7 @@ function runGenRoutes(options) {
|
|
|
118
118
|
const APP_DIR = path2.resolve(ROOT, path2.dirname(config.pagesDir));
|
|
119
119
|
const OUT_DIR = path2.join(ROOT, "dist", "mp-weixin");
|
|
120
120
|
const FW_COMPONENTS = options.componentsDir ? path2.resolve(ROOT, options.componentsDir) : resolveComponentsRoot(ROOT);
|
|
121
|
-
if (!fs2.existsSync(FW_COMPONENTS)) {
|
|
121
|
+
if (!fs2.existsSync(FW_COMPONENTS) && appUsesFrameworkComponents(APP_DIR)) {
|
|
122
122
|
console.warn(
|
|
123
123
|
`[gen-routes] \u672A\u627E\u5230\u8BED\u4E49\u7EC4\u4EF6\u5E93 @proteus-vue/components\uFF08\u89E3\u6790\u4E3A ${FW_COMPONENTS}\uFF09\u2014\u2014p-* \u7EC4\u4EF6\u5C06\u4E0D\u88AB\u6CE8\u518C\uFF08\u9875\u9762 usingComponents \u7F3A\u5931 \u2192 WXML \u6574\u5757\u4E0D\u6E32\u67D3\uFF09\u3002\u8BF7\u786E\u8BA4\u5DF2\u5B89\u88C5\u4F9D\u8D56\uFF08npm i / pnpm i\uFF09\u3002`
|
|
124
124
|
);
|
|
@@ -148,6 +148,18 @@ function runGenRoutes(options) {
|
|
|
148
148
|
}
|
|
149
149
|
return acc;
|
|
150
150
|
}
|
|
151
|
+
function appUsesFrameworkComponents(appDir) {
|
|
152
|
+
for (const f of walkVueFiles2(appDir)) {
|
|
153
|
+
let src;
|
|
154
|
+
try {
|
|
155
|
+
src = fs2.readFileSync(f, "utf8");
|
|
156
|
+
} catch {
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
if (/<[pP]-[a-z][\w-]*[\s/>]/.test(src) || /<P[A-Z][\w]*[\s/>]/.test(src)) return true;
|
|
160
|
+
}
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
151
163
|
function resolveConfigMeta(configMeta, pageRel) {
|
|
152
164
|
if (!configMeta) return void 0;
|
|
153
165
|
let dirMeta;
|