@danielx/civet 0.7.4 → 0.7.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/dist/astro.js +6 -6
- package/dist/babel-plugin.mjs +4 -2
- package/dist/browser.js +214 -132
- package/dist/bun-civet.mjs +4 -4
- package/dist/civet +4 -4
- package/dist/config.js +4 -1
- package/dist/esbuild-plugin.js +1 -1
- package/dist/esbuild.js +6 -6
- package/dist/esm.mjs +1 -1
- package/dist/main.js +215 -132
- package/dist/main.mjs +214 -132
- package/dist/rollup.js +6 -6
- package/dist/types.d.ts +15 -5
- package/dist/unplugin-shared.mjs +6 -6
- package/dist/unplugin.js +6 -6
- package/dist/vite.js +6 -6
- package/dist/webpack.js +6 -6
- package/package.json +2 -2
package/dist/rollup.js
CHANGED
|
@@ -166,9 +166,9 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
166
166
|
const compiledTS = import_civet.default.compile(rawCivetSource, {
|
|
167
167
|
filename,
|
|
168
168
|
js: false,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
comptime: Boolean(options.comptime),
|
|
170
|
+
sync: true
|
|
171
|
+
// TS readFile API seems to need to be synchronous
|
|
172
172
|
});
|
|
173
173
|
fsMap.set(filename, compiledTS);
|
|
174
174
|
return compiledTS;
|
|
@@ -321,12 +321,12 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
321
321
|
}
|
|
322
322
|
};
|
|
323
323
|
if (options.ts === "civet" && !transformTS) {
|
|
324
|
-
compiled = import_civet.default.compile(rawCivetSource, {
|
|
324
|
+
compiled = await import_civet.default.compile(rawCivetSource, {
|
|
325
325
|
...civetOptions,
|
|
326
326
|
js: true
|
|
327
327
|
});
|
|
328
328
|
} else {
|
|
329
|
-
const compiledTS = import_civet.default.compile(rawCivetSource, {
|
|
329
|
+
const compiledTS = await import_civet.default.compile(rawCivetSource, {
|
|
330
330
|
...civetOptions,
|
|
331
331
|
js: false
|
|
332
332
|
});
|
|
@@ -372,7 +372,7 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
372
372
|
}
|
|
373
373
|
case "civet":
|
|
374
374
|
default: {
|
|
375
|
-
compiled = import_civet.default.compile(rawCivetSource, {
|
|
375
|
+
compiled = await import_civet.default.compile(rawCivetSource, {
|
|
376
376
|
...civetOptions,
|
|
377
377
|
js: true
|
|
378
378
|
});
|
package/dist/types.d.ts
CHANGED
|
@@ -42,6 +42,8 @@ declare module "@danielx/civet" {
|
|
|
42
42
|
trace?: string
|
|
43
43
|
parseOptions?: ParseOptions
|
|
44
44
|
}
|
|
45
|
+
export type SyncCompileOptions = CompileOptions &
|
|
46
|
+
{ parseOptions?: { comptime?: false } }
|
|
45
47
|
|
|
46
48
|
export type SourceMapping = [number] | [number, number, number, number]
|
|
47
49
|
|
|
@@ -64,11 +66,19 @@ declare module "@danielx/civet" {
|
|
|
64
66
|
}
|
|
65
67
|
export function isCompileError(err: any): err is ParseError
|
|
66
68
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
sourceMap:
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
type CompileOutput<T extends CompileOptions> =
|
|
70
|
+
T extends { ast: true } ? CivetAST :
|
|
71
|
+
T extends { sourceMap: true } ? {
|
|
72
|
+
code: string,
|
|
73
|
+
sourceMap: SourceMap,
|
|
74
|
+
} : string
|
|
75
|
+
export function compile<const T extends CompileOptions>(source: string, options?: T):
|
|
76
|
+
T extends { sync: true } ? CompileOutput<T> : Promise<CompileOutput<T>>
|
|
77
|
+
/** Warning: No caching */
|
|
78
|
+
export function parse(source: string, options?: CompileOptions & {startRule?: string}): CivetAST
|
|
79
|
+
/** Warning: No caching */
|
|
80
|
+
export function parseProgram<T extends CompileOptions>(source: string, options?: T):
|
|
81
|
+
T extends { comptime: true } ? Promise<CivetAST> : CivetAST
|
|
72
82
|
export function generate(ast: CivetAST, options?: CompileOptions): string
|
|
73
83
|
|
|
74
84
|
const Civet: {
|
package/dist/unplugin-shared.mjs
CHANGED
|
@@ -133,9 +133,9 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
133
133
|
const compiledTS = civet.compile(rawCivetSource, {
|
|
134
134
|
filename,
|
|
135
135
|
js: false,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
comptime: Boolean(options.comptime),
|
|
137
|
+
sync: true
|
|
138
|
+
// TS readFile API seems to need to be synchronous
|
|
139
139
|
});
|
|
140
140
|
fsMap.set(filename, compiledTS);
|
|
141
141
|
return compiledTS;
|
|
@@ -288,12 +288,12 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
288
288
|
}
|
|
289
289
|
};
|
|
290
290
|
if (options.ts === "civet" && !transformTS) {
|
|
291
|
-
compiled = civet.compile(rawCivetSource, {
|
|
291
|
+
compiled = await civet.compile(rawCivetSource, {
|
|
292
292
|
...civetOptions,
|
|
293
293
|
js: true
|
|
294
294
|
});
|
|
295
295
|
} else {
|
|
296
|
-
const compiledTS = civet.compile(rawCivetSource, {
|
|
296
|
+
const compiledTS = await civet.compile(rawCivetSource, {
|
|
297
297
|
...civetOptions,
|
|
298
298
|
js: false
|
|
299
299
|
});
|
|
@@ -339,7 +339,7 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
339
339
|
}
|
|
340
340
|
case "civet":
|
|
341
341
|
default: {
|
|
342
|
-
compiled = civet.compile(rawCivetSource, {
|
|
342
|
+
compiled = await civet.compile(rawCivetSource, {
|
|
343
343
|
...civetOptions,
|
|
344
344
|
js: true
|
|
345
345
|
});
|
package/dist/unplugin.js
CHANGED
|
@@ -166,9 +166,9 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
166
166
|
const compiledTS = import_civet.default.compile(rawCivetSource, {
|
|
167
167
|
filename,
|
|
168
168
|
js: false,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
comptime: Boolean(options.comptime),
|
|
170
|
+
sync: true
|
|
171
|
+
// TS readFile API seems to need to be synchronous
|
|
172
172
|
});
|
|
173
173
|
fsMap.set(filename, compiledTS);
|
|
174
174
|
return compiledTS;
|
|
@@ -321,12 +321,12 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
321
321
|
}
|
|
322
322
|
};
|
|
323
323
|
if (options.ts === "civet" && !transformTS) {
|
|
324
|
-
compiled = import_civet.default.compile(rawCivetSource, {
|
|
324
|
+
compiled = await import_civet.default.compile(rawCivetSource, {
|
|
325
325
|
...civetOptions,
|
|
326
326
|
js: true
|
|
327
327
|
});
|
|
328
328
|
} else {
|
|
329
|
-
const compiledTS = import_civet.default.compile(rawCivetSource, {
|
|
329
|
+
const compiledTS = await import_civet.default.compile(rawCivetSource, {
|
|
330
330
|
...civetOptions,
|
|
331
331
|
js: false
|
|
332
332
|
});
|
|
@@ -372,7 +372,7 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
372
372
|
}
|
|
373
373
|
case "civet":
|
|
374
374
|
default: {
|
|
375
|
-
compiled = import_civet.default.compile(rawCivetSource, {
|
|
375
|
+
compiled = await import_civet.default.compile(rawCivetSource, {
|
|
376
376
|
...civetOptions,
|
|
377
377
|
js: true
|
|
378
378
|
});
|
package/dist/vite.js
CHANGED
|
@@ -166,9 +166,9 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
166
166
|
const compiledTS = import_civet.default.compile(rawCivetSource, {
|
|
167
167
|
filename,
|
|
168
168
|
js: false,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
comptime: Boolean(options.comptime),
|
|
170
|
+
sync: true
|
|
171
|
+
// TS readFile API seems to need to be synchronous
|
|
172
172
|
});
|
|
173
173
|
fsMap.set(filename, compiledTS);
|
|
174
174
|
return compiledTS;
|
|
@@ -321,12 +321,12 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
321
321
|
}
|
|
322
322
|
};
|
|
323
323
|
if (options.ts === "civet" && !transformTS) {
|
|
324
|
-
compiled = import_civet.default.compile(rawCivetSource, {
|
|
324
|
+
compiled = await import_civet.default.compile(rawCivetSource, {
|
|
325
325
|
...civetOptions,
|
|
326
326
|
js: true
|
|
327
327
|
});
|
|
328
328
|
} else {
|
|
329
|
-
const compiledTS = import_civet.default.compile(rawCivetSource, {
|
|
329
|
+
const compiledTS = await import_civet.default.compile(rawCivetSource, {
|
|
330
330
|
...civetOptions,
|
|
331
331
|
js: false
|
|
332
332
|
});
|
|
@@ -372,7 +372,7 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
372
372
|
}
|
|
373
373
|
case "civet":
|
|
374
374
|
default: {
|
|
375
|
-
compiled = import_civet.default.compile(rawCivetSource, {
|
|
375
|
+
compiled = await import_civet.default.compile(rawCivetSource, {
|
|
376
376
|
...civetOptions,
|
|
377
377
|
js: true
|
|
378
378
|
});
|
package/dist/webpack.js
CHANGED
|
@@ -166,9 +166,9 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
166
166
|
const compiledTS = import_civet.default.compile(rawCivetSource, {
|
|
167
167
|
filename,
|
|
168
168
|
js: false,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
comptime: Boolean(options.comptime),
|
|
170
|
+
sync: true
|
|
171
|
+
// TS readFile API seems to need to be synchronous
|
|
172
172
|
});
|
|
173
173
|
fsMap.set(filename, compiledTS);
|
|
174
174
|
return compiledTS;
|
|
@@ -321,12 +321,12 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
321
321
|
}
|
|
322
322
|
};
|
|
323
323
|
if (options.ts === "civet" && !transformTS) {
|
|
324
|
-
compiled = import_civet.default.compile(rawCivetSource, {
|
|
324
|
+
compiled = await import_civet.default.compile(rawCivetSource, {
|
|
325
325
|
...civetOptions,
|
|
326
326
|
js: true
|
|
327
327
|
});
|
|
328
328
|
} else {
|
|
329
|
-
const compiledTS = import_civet.default.compile(rawCivetSource, {
|
|
329
|
+
const compiledTS = await import_civet.default.compile(rawCivetSource, {
|
|
330
330
|
...civetOptions,
|
|
331
331
|
js: false
|
|
332
332
|
});
|
|
@@ -372,7 +372,7 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
372
372
|
}
|
|
373
373
|
case "civet":
|
|
374
374
|
default: {
|
|
375
|
-
compiled = import_civet.default.compile(rawCivetSource, {
|
|
375
|
+
compiled = await import_civet.default.compile(rawCivetSource, {
|
|
376
376
|
...civetOptions,
|
|
377
377
|
js: true
|
|
378
378
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danielx/civet",
|
|
3
3
|
"type": "commonjs",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.5",
|
|
5
5
|
"description": "CoffeeScript style syntax for TypeScript",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/main.mjs",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"unplugin": "^1.6.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@danielx/civet": "0.7.
|
|
77
|
+
"@danielx/civet": "0.7.4",
|
|
78
78
|
"@danielx/hera": "^0.8.13",
|
|
79
79
|
"@prettier/sync": "^0.3.0",
|
|
80
80
|
"@types/assert": "^1.5.6",
|