@danielx/civet 0.10.3 → 0.10.5
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/CHANGELOG.md +11 -0
- package/dist/babel-plugin.js +1 -1
- package/dist/babel-plugin.mjs +1 -1
- package/dist/browser.js +64 -41
- package/dist/civet +1 -1
- package/dist/config.js +1 -1
- package/dist/config.mjs +1 -1
- package/dist/esbuild-plugin.js +1 -1
- package/dist/esm.mjs +1 -1
- package/dist/main.js +74 -44
- package/dist/main.mjs +73 -43
- package/dist/node-worker.mjs +1 -1
- package/dist/types.d.ts +2 -1
- package/dist/unplugin/astro.js +1 -1
- package/dist/unplugin/astro.mjs +1 -1
- package/dist/unplugin/esbuild.js +1 -1
- package/dist/unplugin/esbuild.mjs +1 -1
- package/dist/unplugin/farm.js +1 -1
- package/dist/unplugin/farm.mjs +1 -1
- package/dist/unplugin/rolldown.js +1 -1
- package/dist/unplugin/rolldown.mjs +1 -1
- package/dist/unplugin/rollup.js +1 -1
- package/dist/unplugin/rollup.mjs +1 -1
- package/dist/unplugin/rspack.js +1 -1
- package/dist/unplugin/rspack.mjs +1 -1
- package/dist/unplugin/unplugin.js +36 -38
- package/dist/unplugin/unplugin.mjs +36 -38
- package/dist/unplugin/vite.js +1 -1
- package/dist/unplugin/vite.mjs +1 -1
- package/dist/unplugin/webpack.js +1 -1
- package/dist/unplugin/webpack.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// unplugin-civet
|
|
1
|
+
// unplugin-civet:/home/daniel/apps/Civet/source/unplugin/unplugin.civet.jsx
|
|
2
2
|
import { createUnplugin } from "unplugin";
|
|
3
3
|
import civet, { lib, SourceMap } from "@danielx/civet";
|
|
4
4
|
import { findInDir, loadConfig } from "@danielx/civet/config";
|
|
@@ -14,24 +14,26 @@ import os from "os";
|
|
|
14
14
|
// source/unplugin/constants.mjs
|
|
15
15
|
var DEFAULT_EXTENSIONS = [".mjs", ".js", ".mts", ".ts", ".jsx", ".tsx", ".json"];
|
|
16
16
|
|
|
17
|
-
// unplugin-civet
|
|
17
|
+
// unplugin-civet:/home/daniel/apps/Civet/source/unplugin/unplugin.civet.jsx
|
|
18
18
|
var DiagnosticCategory = {};
|
|
19
19
|
DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning";
|
|
20
20
|
DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error";
|
|
21
21
|
DiagnosticCategory[DiagnosticCategory["Suggestion"] = 2] = "Suggestion";
|
|
22
22
|
DiagnosticCategory[DiagnosticCategory["Message"] = 3] = "Message";
|
|
23
|
-
var civetExtension = /\.civet$/;
|
|
24
|
-
var isCivetTranspiled = /(\.civet)(\.[jt]sx)?([?#].*)?$/;
|
|
25
23
|
var postfixRE = /[?#].*$/s;
|
|
26
24
|
var isWindows = os.platform() === "win32";
|
|
27
25
|
var windowsSlashRE = /\\/g;
|
|
28
|
-
|
|
26
|
+
var civetSuffix = ".civet";
|
|
27
|
+
function extractCivetFilename(id, outputExtension) {
|
|
29
28
|
let postfix = "";
|
|
30
|
-
|
|
29
|
+
let filename = id.replace(postfixRE, (match) => {
|
|
31
30
|
postfix = match;
|
|
32
31
|
return "";
|
|
33
|
-
})
|
|
34
|
-
|
|
32
|
+
});
|
|
33
|
+
if (filename.endsWith(outputExtension)) {
|
|
34
|
+
filename = filename.slice(0, -outputExtension.length);
|
|
35
|
+
}
|
|
36
|
+
return { filename, postfix };
|
|
35
37
|
}
|
|
36
38
|
function tryStatSync(file) {
|
|
37
39
|
try {
|
|
@@ -327,10 +329,8 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
327
329
|
} else {
|
|
328
330
|
console.log(`WARNING: No .d.ts extension in ${filePath}`);
|
|
329
331
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
const match = ref1;
|
|
333
|
-
filePath = filePath.slice(0, -match[0].length);
|
|
332
|
+
if (filePath.endsWith(civetSuffix)) {
|
|
333
|
+
filePath = filePath.slice(0, -civetSuffix.length);
|
|
334
334
|
} else {
|
|
335
335
|
console.log(`WARNING: No .civet extension in ${filePath}`);
|
|
336
336
|
}
|
|
@@ -363,38 +363,36 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
363
363
|
id = aliasResolver(id);
|
|
364
364
|
}
|
|
365
365
|
if (/\0/.test(id)) return null;
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
ref2 = resolveAbsolutePath(rootDir, id, implicitExtension);
|
|
366
|
+
const { filename, postfix } = extractCivetFilename(id, outExt);
|
|
367
|
+
let ref1;
|
|
368
|
+
if (path.isAbsolute(filename)) {
|
|
369
|
+
ref1 = resolveAbsolutePath(rootDir, filename, implicitExtension);
|
|
371
370
|
} else {
|
|
372
|
-
|
|
371
|
+
ref1 = path.resolve(path.dirname(importer ?? ""), filename);
|
|
373
372
|
}
|
|
374
373
|
;
|
|
375
|
-
let
|
|
376
|
-
if (!
|
|
377
|
-
if (!
|
|
374
|
+
let resolved = ref1;
|
|
375
|
+
if (!resolved) return null;
|
|
376
|
+
if (!resolved.endsWith(civetSuffix)) {
|
|
378
377
|
if (!implicitExtension) return null;
|
|
379
|
-
const implicitId = implicitCivet(
|
|
378
|
+
const implicitId = implicitCivet(resolved);
|
|
380
379
|
if (!implicitId) return null;
|
|
381
|
-
|
|
380
|
+
resolved = implicitId;
|
|
382
381
|
}
|
|
383
382
|
if (options2.scan && meta.framework === "vite") {
|
|
384
|
-
|
|
383
|
+
resolved = `\0${resolved}`;
|
|
385
384
|
}
|
|
386
|
-
return
|
|
385
|
+
return resolved + outExt + postfix;
|
|
387
386
|
},
|
|
388
387
|
loadInclude(id) {
|
|
389
|
-
return
|
|
388
|
+
return extractCivetFilename(id, outExt).filename.endsWith(civetSuffix);
|
|
390
389
|
},
|
|
391
390
|
async load(id) {
|
|
392
|
-
|
|
393
|
-
if (!
|
|
391
|
+
let { filename } = extractCivetFilename(id, outExt);
|
|
392
|
+
if (!filename.endsWith(civetSuffix)) {
|
|
394
393
|
return null;
|
|
395
394
|
}
|
|
396
|
-
|
|
397
|
-
const filename = path.resolve(rootDir, basename);
|
|
395
|
+
filename = path.resolve(rootDir, filename);
|
|
398
396
|
this.addWatchFile(filename);
|
|
399
397
|
let mtime, cached, resolve;
|
|
400
398
|
if (cache != null) {
|
|
@@ -408,9 +406,9 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
408
406
|
if (cached.promise) {
|
|
409
407
|
await cached.promise;
|
|
410
408
|
}
|
|
411
|
-
let
|
|
412
|
-
if ((
|
|
413
|
-
const result =
|
|
409
|
+
let ref2;
|
|
410
|
+
if ((ref2 = cached.result) != null) {
|
|
411
|
+
const result = ref2;
|
|
414
412
|
return result;
|
|
415
413
|
}
|
|
416
414
|
}
|
|
@@ -486,8 +484,8 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
486
484
|
}
|
|
487
485
|
}
|
|
488
486
|
if (transformTS) {
|
|
489
|
-
for (let
|
|
490
|
-
const _spec =
|
|
487
|
+
for (let ref3 = lib.gatherRecursive(ast, ($) => $.type === "ModuleSpecifier"), i = 0, len = ref3.length; i < len; i++) {
|
|
488
|
+
const _spec = ref3[i];
|
|
491
489
|
const spec = _spec;
|
|
492
490
|
if (spec.module?.input) {
|
|
493
491
|
spec.module.token = spec.module.input.replace(/\.([mc])?ts(['"])$/, ".$1js$2");
|
|
@@ -590,9 +588,9 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
590
588
|
compiler.options.resolve.extensions.unshift(".civet");
|
|
591
589
|
}
|
|
592
590
|
return aliasResolver = (id) => {
|
|
593
|
-
let
|
|
594
|
-
for (const key in
|
|
595
|
-
const value =
|
|
591
|
+
let ref4;
|
|
592
|
+
for (const key in ref4 = compiler.options.resolve.alias) {
|
|
593
|
+
const value = ref4[key];
|
|
596
594
|
if (key.endsWith("$")) {
|
|
597
595
|
if (id === key.slice(0, -1)) {
|
|
598
596
|
return typeof value === "string" ? value : "\0";
|
package/dist/unplugin/vite.js
CHANGED
|
@@ -26,7 +26,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
));
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
28
|
|
|
29
|
-
// unplugin-civet
|
|
29
|
+
// unplugin-civet:/home/daniel/apps/Civet/source/unplugin/vite.civet.jsx
|
|
30
30
|
var vite_civet_exports = {};
|
|
31
31
|
__export(vite_civet_exports, {
|
|
32
32
|
default: () => vite_civet_default
|
package/dist/unplugin/vite.mjs
CHANGED
package/dist/unplugin/webpack.js
CHANGED
|
@@ -26,7 +26,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
));
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
28
|
|
|
29
|
-
// unplugin-civet
|
|
29
|
+
// unplugin-civet:/home/daniel/apps/Civet/source/unplugin/webpack.civet.jsx
|
|
30
30
|
var webpack_civet_exports = {};
|
|
31
31
|
__export(webpack_civet_exports, {
|
|
32
32
|
default: () => webpack_civet_default
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// unplugin-civet
|
|
1
|
+
// unplugin-civet:/home/daniel/apps/Civet/source/unplugin/webpack.civet.jsx
|
|
2
2
|
import civetUnplugin from "./unplugin.mjs";
|
|
3
3
|
var webpack_civet_default = civetUnplugin.webpack;
|
|
4
4
|
export {
|