weapp-vite 1.1.5 → 1.1.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/{chunk-W7SB43KF.mjs → chunk-Q6MICYSC.mjs} +17 -5
- package/dist/cli.cjs +11 -6
- package/dist/cli.mjs +3 -8
- package/dist/index.cjs +12 -5
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
// package.json
|
|
2
|
+
var version = "1.1.6";
|
|
3
|
+
|
|
4
|
+
// src/constants.ts
|
|
5
|
+
var VERSION = version;
|
|
6
|
+
var jsExtensions = ["js", "ts"];
|
|
7
|
+
|
|
1
8
|
// src/context.ts
|
|
2
9
|
import process2 from "node:process";
|
|
3
10
|
import { addExtension as addExtension3, defu as defu3, removeExtension as removeExtension3 } from "@weapp-core/shared";
|
|
@@ -91,10 +98,9 @@ function searchAppEntry(options) {
|
|
|
91
98
|
const { formatPath, root } = defu(options, {
|
|
92
99
|
formatPath: (x) => x
|
|
93
100
|
});
|
|
94
|
-
const extensions = ["js", "ts"];
|
|
95
101
|
const appJsonPath = path2.resolve(root, "app.json");
|
|
96
102
|
if (fs2.existsSync(appJsonPath)) {
|
|
97
|
-
for (const ext of
|
|
103
|
+
for (const ext of jsExtensions) {
|
|
98
104
|
const entryPath = path2.resolve(root, addExtension("app", `.${ext}`));
|
|
99
105
|
if (fs2.existsSync(entryPath)) {
|
|
100
106
|
const appJson = fs2.readJSONSync(appJsonPath, { throws: false });
|
|
@@ -133,9 +139,8 @@ function searchAppEntry(options) {
|
|
|
133
139
|
}
|
|
134
140
|
function searchPageEntry(wxmlPath) {
|
|
135
141
|
if (fs2.existsSync(wxmlPath)) {
|
|
136
|
-
const extensions = ["js", "ts"];
|
|
137
142
|
const base = removeExtension(wxmlPath);
|
|
138
|
-
for (const ext of
|
|
143
|
+
for (const ext of jsExtensions) {
|
|
139
144
|
const entryPath = addExtension(base, `.${ext}`);
|
|
140
145
|
if (fs2.existsSync(entryPath)) {
|
|
141
146
|
return entryPath;
|
|
@@ -316,6 +321,12 @@ var debug = createDebugger("weapp-vite:plugin");
|
|
|
316
321
|
function normalizeCssPath(id) {
|
|
317
322
|
return addExtension2(removeExtension2(id), ".wxss");
|
|
318
323
|
}
|
|
324
|
+
function isJsOrTs(name) {
|
|
325
|
+
if (typeof name === "string") {
|
|
326
|
+
return jsExtensions.some((x) => name.endsWith(`.${x}`));
|
|
327
|
+
}
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
319
330
|
function getRealPath(res) {
|
|
320
331
|
if (res.query.wxss) {
|
|
321
332
|
return addExtension2(removeExtension2(res.filename), ".wxss");
|
|
@@ -474,7 +485,7 @@ function vitePluginWeapp(ctx) {
|
|
|
474
485
|
const bundleKeys = Object.keys(bundle);
|
|
475
486
|
for (const bundleKey of bundleKeys) {
|
|
476
487
|
const asset = bundle[bundleKey];
|
|
477
|
-
if (bundleKey.endsWith(".css") && asset.type === "asset" && asset.originalFileName
|
|
488
|
+
if (bundleKey.endsWith(".css") && asset.type === "asset" && typeof asset.originalFileName === "string" && isJsOrTs(asset.originalFileName)) {
|
|
478
489
|
const newFileName = normalizeCssPath(asset.originalFileName);
|
|
479
490
|
this.emitFile({
|
|
480
491
|
type: "asset",
|
|
@@ -723,5 +734,6 @@ var CompilerContext = class _CompilerContext {
|
|
|
723
734
|
};
|
|
724
735
|
|
|
725
736
|
export {
|
|
737
|
+
VERSION,
|
|
726
738
|
CompilerContext
|
|
727
739
|
};
|
package/dist/cli.cjs
CHANGED
|
@@ -29,10 +29,11 @@ var import_cac = require("cac");
|
|
|
29
29
|
var import_weapp_ide_cli = require("weapp-ide-cli");
|
|
30
30
|
|
|
31
31
|
// package.json
|
|
32
|
-
var version = "1.1.
|
|
32
|
+
var version = "1.1.6";
|
|
33
33
|
|
|
34
34
|
// src/constants.ts
|
|
35
35
|
var VERSION = version;
|
|
36
|
+
var jsExtensions = ["js", "ts"];
|
|
36
37
|
|
|
37
38
|
// src/context.ts
|
|
38
39
|
var import_node_process2 = __toESM(require("process"), 1);
|
|
@@ -127,10 +128,9 @@ function searchAppEntry(options) {
|
|
|
127
128
|
const { formatPath, root } = (0, import_shared.defu)(options, {
|
|
128
129
|
formatPath: (x) => x
|
|
129
130
|
});
|
|
130
|
-
const extensions = ["js", "ts"];
|
|
131
131
|
const appJsonPath = import_pathe2.default.resolve(root, "app.json");
|
|
132
132
|
if (import_fs_extra2.default.existsSync(appJsonPath)) {
|
|
133
|
-
for (const ext of
|
|
133
|
+
for (const ext of jsExtensions) {
|
|
134
134
|
const entryPath = import_pathe2.default.resolve(root, (0, import_shared.addExtension)("app", `.${ext}`));
|
|
135
135
|
if (import_fs_extra2.default.existsSync(entryPath)) {
|
|
136
136
|
const appJson = import_fs_extra2.default.readJSONSync(appJsonPath, { throws: false });
|
|
@@ -169,9 +169,8 @@ function searchAppEntry(options) {
|
|
|
169
169
|
}
|
|
170
170
|
function searchPageEntry(wxmlPath) {
|
|
171
171
|
if (import_fs_extra2.default.existsSync(wxmlPath)) {
|
|
172
|
-
const extensions = ["js", "ts"];
|
|
173
172
|
const base = (0, import_shared.removeExtension)(wxmlPath);
|
|
174
|
-
for (const ext of
|
|
173
|
+
for (const ext of jsExtensions) {
|
|
175
174
|
const entryPath = (0, import_shared.addExtension)(base, `.${ext}`);
|
|
176
175
|
if (import_fs_extra2.default.existsSync(entryPath)) {
|
|
177
176
|
return entryPath;
|
|
@@ -352,6 +351,12 @@ var debug = createDebugger("weapp-vite:plugin");
|
|
|
352
351
|
function normalizeCssPath(id) {
|
|
353
352
|
return (0, import_shared3.addExtension)((0, import_shared3.removeExtension)(id), ".wxss");
|
|
354
353
|
}
|
|
354
|
+
function isJsOrTs(name) {
|
|
355
|
+
if (typeof name === "string") {
|
|
356
|
+
return jsExtensions.some((x) => name.endsWith(`.${x}`));
|
|
357
|
+
}
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
355
360
|
function getRealPath(res) {
|
|
356
361
|
if (res.query.wxss) {
|
|
357
362
|
return (0, import_shared3.addExtension)((0, import_shared3.removeExtension)(res.filename), ".wxss");
|
|
@@ -510,7 +515,7 @@ function vitePluginWeapp(ctx) {
|
|
|
510
515
|
const bundleKeys = Object.keys(bundle);
|
|
511
516
|
for (const bundleKey of bundleKeys) {
|
|
512
517
|
const asset = bundle[bundleKey];
|
|
513
|
-
if (bundleKey.endsWith(".css") && asset.type === "asset" && asset.originalFileName
|
|
518
|
+
if (bundleKey.endsWith(".css") && asset.type === "asset" && typeof asset.originalFileName === "string" && isJsOrTs(asset.originalFileName)) {
|
|
514
519
|
const newFileName = normalizeCssPath(asset.originalFileName);
|
|
515
520
|
this.emitFile({
|
|
516
521
|
type: "asset",
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CompilerContext
|
|
3
|
-
|
|
2
|
+
CompilerContext,
|
|
3
|
+
VERSION
|
|
4
|
+
} from "./chunk-Q6MICYSC.mjs";
|
|
4
5
|
import "./chunk-444MQSSG.mjs";
|
|
5
6
|
|
|
6
7
|
// src/cli.ts
|
|
@@ -9,12 +10,6 @@ import { initConfig } from "@weapp-core/init";
|
|
|
9
10
|
import { cac } from "cac";
|
|
10
11
|
import { parse } from "weapp-ide-cli";
|
|
11
12
|
|
|
12
|
-
// package.json
|
|
13
|
-
var version = "1.1.5";
|
|
14
|
-
|
|
15
|
-
// src/constants.ts
|
|
16
|
-
var VERSION = version;
|
|
17
|
-
|
|
18
13
|
// src/logger.ts
|
|
19
14
|
import logger from "@weapp-core/logger";
|
|
20
15
|
var logger_default = logger;
|
package/dist/index.cjs
CHANGED
|
@@ -62,6 +62,9 @@ var import_magic_string = __toESM(require("magic-string"), 1);
|
|
|
62
62
|
var import_pathe4 = __toESM(require("pathe"), 1);
|
|
63
63
|
var import_vite = require("vite");
|
|
64
64
|
|
|
65
|
+
// src/constants.ts
|
|
66
|
+
var jsExtensions = ["js", "ts"];
|
|
67
|
+
|
|
65
68
|
// src/debugger.ts
|
|
66
69
|
var import_debug = __toESM(require("debug"), 1);
|
|
67
70
|
function createDebugger(namespace) {
|
|
@@ -127,10 +130,9 @@ function searchAppEntry(options) {
|
|
|
127
130
|
const { formatPath, root } = (0, import_shared.defu)(options, {
|
|
128
131
|
formatPath: (x) => x
|
|
129
132
|
});
|
|
130
|
-
const extensions = ["js", "ts"];
|
|
131
133
|
const appJsonPath = import_pathe2.default.resolve(root, "app.json");
|
|
132
134
|
if (import_fs_extra2.default.existsSync(appJsonPath)) {
|
|
133
|
-
for (const ext of
|
|
135
|
+
for (const ext of jsExtensions) {
|
|
134
136
|
const entryPath = import_pathe2.default.resolve(root, (0, import_shared.addExtension)("app", `.${ext}`));
|
|
135
137
|
if (import_fs_extra2.default.existsSync(entryPath)) {
|
|
136
138
|
const appJson = import_fs_extra2.default.readJSONSync(appJsonPath, { throws: false });
|
|
@@ -169,9 +171,8 @@ function searchAppEntry(options) {
|
|
|
169
171
|
}
|
|
170
172
|
function searchPageEntry(wxmlPath) {
|
|
171
173
|
if (import_fs_extra2.default.existsSync(wxmlPath)) {
|
|
172
|
-
const extensions = ["js", "ts"];
|
|
173
174
|
const base = (0, import_shared.removeExtension)(wxmlPath);
|
|
174
|
-
for (const ext of
|
|
175
|
+
for (const ext of jsExtensions) {
|
|
175
176
|
const entryPath = (0, import_shared.addExtension)(base, `.${ext}`);
|
|
176
177
|
if (import_fs_extra2.default.existsSync(entryPath)) {
|
|
177
178
|
return entryPath;
|
|
@@ -352,6 +353,12 @@ var debug = createDebugger("weapp-vite:plugin");
|
|
|
352
353
|
function normalizeCssPath(id) {
|
|
353
354
|
return (0, import_shared3.addExtension)((0, import_shared3.removeExtension)(id), ".wxss");
|
|
354
355
|
}
|
|
356
|
+
function isJsOrTs(name) {
|
|
357
|
+
if (typeof name === "string") {
|
|
358
|
+
return jsExtensions.some((x) => name.endsWith(`.${x}`));
|
|
359
|
+
}
|
|
360
|
+
return false;
|
|
361
|
+
}
|
|
355
362
|
function getRealPath(res) {
|
|
356
363
|
if (res.query.wxss) {
|
|
357
364
|
return (0, import_shared3.addExtension)((0, import_shared3.removeExtension)(res.filename), ".wxss");
|
|
@@ -510,7 +517,7 @@ function vitePluginWeapp(ctx) {
|
|
|
510
517
|
const bundleKeys = Object.keys(bundle);
|
|
511
518
|
for (const bundleKey of bundleKeys) {
|
|
512
519
|
const asset = bundle[bundleKey];
|
|
513
|
-
if (bundleKey.endsWith(".css") && asset.type === "asset" && asset.originalFileName
|
|
520
|
+
if (bundleKey.endsWith(".css") && asset.type === "asset" && typeof asset.originalFileName === "string" && isJsOrTs(asset.originalFileName)) {
|
|
514
521
|
const newFileName = normalizeCssPath(asset.originalFileName);
|
|
515
522
|
this.emitFile({
|
|
516
523
|
type: "asset",
|
package/dist/index.mjs
CHANGED