@danielx/civet 0.8.0 → 0.8.2
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 +19 -0
- package/dist/browser.js +5770 -5593
- package/dist/civet +36 -43
- package/dist/config.js +7182 -1
- package/dist/config.mjs +7205 -1
- package/dist/main.js +5741 -5564
- package/dist/main.mjs +5741 -5564
- package/dist/types.d.ts +2 -0
- package/dist/unplugin/rollup.d.ts +1 -1
- package/dist/unplugin/unplugin.d.ts +2 -1
- package/dist/unplugin/unplugin.js +23 -8
- package/dist/unplugin/unplugin.mjs +23 -8
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: (options: import("./unplugin.js").PluginOptions) => import("rollup").Plugin | import("rollup").Plugin[];
|
|
1
|
+
declare const _default: (options: import("./unplugin.js").PluginOptions) => import("rollup").Plugin<any> | import("rollup").Plugin<any>[];
|
|
2
2
|
export default _default;
|
|
@@ -5,6 +5,7 @@ export type PluginOptions = {
|
|
|
5
5
|
outputExtension?: string;
|
|
6
6
|
transformOutput?: (code: string, id: string) => TransformResult | Promise<TransformResult>;
|
|
7
7
|
emitDeclaration?: boolean;
|
|
8
|
+
declarationExtension?: string;
|
|
8
9
|
typecheck?: boolean | string;
|
|
9
10
|
ts?: 'civet' | 'esbuild' | 'tsc' | 'preserve';
|
|
10
11
|
/** @deprecated Use "ts" option instead */
|
|
@@ -14,7 +15,7 @@ export type PluginOptions = {
|
|
|
14
15
|
/** Cache compilation results based on file mtime (useful for serve or watch mode) */
|
|
15
16
|
cache?: boolean;
|
|
16
17
|
/** config filename, or null to not look for default config file */
|
|
17
|
-
config?: string |
|
|
18
|
+
config?: (string | undefined) | null;
|
|
18
19
|
parseOptions?: ParseOptions;
|
|
19
20
|
};
|
|
20
21
|
export declare function slash(p: string): string;
|
|
@@ -52,6 +52,7 @@ DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning";
|
|
|
52
52
|
DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error";
|
|
53
53
|
DiagnosticCategory[DiagnosticCategory["Suggestion"] = 2] = "Suggestion";
|
|
54
54
|
DiagnosticCategory[DiagnosticCategory["Message"] = 3] = "Message";
|
|
55
|
+
var civetExtension = /\.civet$/;
|
|
55
56
|
var isCivetTranspiled = /(\.civet)(\.[jt]sx)([?#].*)?$/;
|
|
56
57
|
var postfixRE = /[?#].*$/s;
|
|
57
58
|
var isWindows = import_os.default.platform() === "win32";
|
|
@@ -320,7 +321,7 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
320
321
|
}
|
|
321
322
|
for (const file of fsMap.keys()) {
|
|
322
323
|
const slashed = slash(file);
|
|
323
|
-
if (file
|
|
324
|
+
if (!(file === slashed)) {
|
|
324
325
|
fsMap.delete(slashed);
|
|
325
326
|
}
|
|
326
327
|
}
|
|
@@ -329,7 +330,22 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
329
330
|
program.emit(
|
|
330
331
|
sourceFile,
|
|
331
332
|
(filePath, content) => {
|
|
332
|
-
|
|
333
|
+
if (options.declarationExtension != null) {
|
|
334
|
+
if (filePath.endsWith(".d.ts")) {
|
|
335
|
+
filePath = filePath.slice(0, -5);
|
|
336
|
+
} else {
|
|
337
|
+
console.log(`WARNING: No .d.ts extension in ${filePath}`);
|
|
338
|
+
}
|
|
339
|
+
let ref;
|
|
340
|
+
if (ref = filePath.match(civetExtension)) {
|
|
341
|
+
const match = ref;
|
|
342
|
+
filePath = filePath.slice(0, -match[0].length);
|
|
343
|
+
} else {
|
|
344
|
+
console.log(`WARNING: No .civet extension in ${filePath}`);
|
|
345
|
+
}
|
|
346
|
+
filePath += options.declarationExtension;
|
|
347
|
+
}
|
|
348
|
+
let pathFromDistDir = import_path.default.relative(
|
|
333
349
|
compilerOptions.outDir ?? process.cwd(),
|
|
334
350
|
filePath
|
|
335
351
|
);
|
|
@@ -341,7 +357,7 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
341
357
|
{ recursive: true }
|
|
342
358
|
);
|
|
343
359
|
}
|
|
344
|
-
this.emitFile({
|
|
360
|
+
return this.emitFile({
|
|
345
361
|
source: content,
|
|
346
362
|
fileName: pathFromDistDir,
|
|
347
363
|
type: "asset"
|
|
@@ -353,7 +369,6 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
353
369
|
void 0,
|
|
354
370
|
// @ts-ignore @internal interface
|
|
355
371
|
true
|
|
356
|
-
// forceDtsEmit
|
|
357
372
|
);
|
|
358
373
|
}
|
|
359
374
|
}
|
|
@@ -364,14 +379,14 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
364
379
|
return null;
|
|
365
380
|
let postfix;
|
|
366
381
|
({ id, postfix } = cleanCivetId(id));
|
|
367
|
-
let
|
|
382
|
+
let ref1;
|
|
368
383
|
if (import_path.default.isAbsolute(id)) {
|
|
369
|
-
|
|
384
|
+
ref1 = resolveAbsolutePath(rootDir, id, implicitExtension);
|
|
370
385
|
} else {
|
|
371
|
-
|
|
386
|
+
ref1 = import_path.default.resolve(import_path.default.dirname(importer ?? ""), id);
|
|
372
387
|
}
|
|
373
388
|
;
|
|
374
|
-
let resolvedId =
|
|
389
|
+
let resolvedId = ref1;
|
|
375
390
|
if (!resolvedId)
|
|
376
391
|
return null;
|
|
377
392
|
if (!resolvedId.endsWith(".civet")) {
|
|
@@ -20,6 +20,7 @@ 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$/;
|
|
23
24
|
var isCivetTranspiled = /(\.civet)(\.[jt]sx)([?#].*)?$/;
|
|
24
25
|
var postfixRE = /[?#].*$/s;
|
|
25
26
|
var isWindows = os.platform() === "win32";
|
|
@@ -288,7 +289,7 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
288
289
|
}
|
|
289
290
|
for (const file of fsMap.keys()) {
|
|
290
291
|
const slashed = slash(file);
|
|
291
|
-
if (file
|
|
292
|
+
if (!(file === slashed)) {
|
|
292
293
|
fsMap.delete(slashed);
|
|
293
294
|
}
|
|
294
295
|
}
|
|
@@ -297,7 +298,22 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
297
298
|
program.emit(
|
|
298
299
|
sourceFile,
|
|
299
300
|
(filePath, content) => {
|
|
300
|
-
|
|
301
|
+
if (options.declarationExtension != null) {
|
|
302
|
+
if (filePath.endsWith(".d.ts")) {
|
|
303
|
+
filePath = filePath.slice(0, -5);
|
|
304
|
+
} else {
|
|
305
|
+
console.log(`WARNING: No .d.ts extension in ${filePath}`);
|
|
306
|
+
}
|
|
307
|
+
let ref;
|
|
308
|
+
if (ref = filePath.match(civetExtension)) {
|
|
309
|
+
const match = ref;
|
|
310
|
+
filePath = filePath.slice(0, -match[0].length);
|
|
311
|
+
} else {
|
|
312
|
+
console.log(`WARNING: No .civet extension in ${filePath}`);
|
|
313
|
+
}
|
|
314
|
+
filePath += options.declarationExtension;
|
|
315
|
+
}
|
|
316
|
+
let pathFromDistDir = path.relative(
|
|
301
317
|
compilerOptions.outDir ?? process.cwd(),
|
|
302
318
|
filePath
|
|
303
319
|
);
|
|
@@ -309,7 +325,7 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
309
325
|
{ recursive: true }
|
|
310
326
|
);
|
|
311
327
|
}
|
|
312
|
-
this.emitFile({
|
|
328
|
+
return this.emitFile({
|
|
313
329
|
source: content,
|
|
314
330
|
fileName: pathFromDistDir,
|
|
315
331
|
type: "asset"
|
|
@@ -321,7 +337,6 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
321
337
|
void 0,
|
|
322
338
|
// @ts-ignore @internal interface
|
|
323
339
|
true
|
|
324
|
-
// forceDtsEmit
|
|
325
340
|
);
|
|
326
341
|
}
|
|
327
342
|
}
|
|
@@ -332,14 +347,14 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
332
347
|
return null;
|
|
333
348
|
let postfix;
|
|
334
349
|
({ id, postfix } = cleanCivetId(id));
|
|
335
|
-
let
|
|
350
|
+
let ref1;
|
|
336
351
|
if (path.isAbsolute(id)) {
|
|
337
|
-
|
|
352
|
+
ref1 = resolveAbsolutePath(rootDir, id, implicitExtension);
|
|
338
353
|
} else {
|
|
339
|
-
|
|
354
|
+
ref1 = path.resolve(path.dirname(importer ?? ""), id);
|
|
340
355
|
}
|
|
341
356
|
;
|
|
342
|
-
let resolvedId =
|
|
357
|
+
let resolvedId = ref1;
|
|
343
358
|
if (!resolvedId)
|
|
344
359
|
return null;
|
|
345
360
|
if (!resolvedId.endsWith(".civet")) {
|