@danielx/civet 0.2.12 → 0.2.13
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/README.md +19 -0
- package/dist/browser.js +54 -15
- package/dist/browser.js.map +2 -2
- package/dist/civet +8 -8
- package/dist/cli.js.map +3 -3
- package/dist/main.js +54 -15
- package/esbuild-plugin.js +26 -0
- package/package.json +2 -1
package/dist/main.js
CHANGED
|
@@ -462,7 +462,8 @@ var require_parser = __commonJS({
|
|
|
462
462
|
ThinArrowFunction,
|
|
463
463
|
Block,
|
|
464
464
|
BracedBlock,
|
|
465
|
-
|
|
465
|
+
SingleNestedExpression,
|
|
466
|
+
SingleNestedBlockStatement,
|
|
466
467
|
NestedBlockExpressions,
|
|
467
468
|
BlockExpression,
|
|
468
469
|
Literal,
|
|
@@ -528,6 +529,8 @@ var require_parser = __commonJS({
|
|
|
528
529
|
Condition,
|
|
529
530
|
ExpressionStatement,
|
|
530
531
|
KeywordStatement,
|
|
532
|
+
MaybeNestedExpression,
|
|
533
|
+
Return,
|
|
531
534
|
ImportDeclaration,
|
|
532
535
|
ImportClause,
|
|
533
536
|
NameSpaceImport,
|
|
@@ -756,8 +759,8 @@ var require_parser = __commonJS({
|
|
|
756
759
|
var $L107 = $L("break");
|
|
757
760
|
var $L108 = $L("continue");
|
|
758
761
|
var $L109 = $L("debugger");
|
|
759
|
-
var $L110 = $L("
|
|
760
|
-
var $L111 = $L("
|
|
762
|
+
var $L110 = $L("throw");
|
|
763
|
+
var $L111 = $L("return");
|
|
761
764
|
var $L112 = $L("import type");
|
|
762
765
|
var $L113 = $L("from");
|
|
763
766
|
var $L114 = $L("export");
|
|
@@ -1001,7 +1004,7 @@ var require_parser = __commonJS({
|
|
|
1001
1004
|
return FatArrow$0(state);
|
|
1002
1005
|
}
|
|
1003
1006
|
}
|
|
1004
|
-
var ConciseBody$0 = $S(EOS,
|
|
1007
|
+
var ConciseBody$0 = $S(EOS, SingleNestedBlockStatement);
|
|
1005
1008
|
var ConciseBody$1 = $S($N($S($Q(_), $EXPECT($L11, fail, 'ConciseBody "{"'))), AssignmentExpression);
|
|
1006
1009
|
var ConciseBody$2 = BracedBlock;
|
|
1007
1010
|
function ConciseBody(state) {
|
|
@@ -1447,19 +1450,34 @@ var require_parser = __commonJS({
|
|
|
1447
1450
|
return BracedBlock$0(state) || BracedBlock$1(state) || BracedBlock$2(state);
|
|
1448
1451
|
}
|
|
1449
1452
|
}
|
|
1450
|
-
var
|
|
1453
|
+
var SingleNestedExpression$0 = $TS($S(PushIndent, $E($S(Nested, Expression, StatementDelimiter)), $C($S($N($S(Nested, Expression)), PopIndent), $S(PopIndent, $N($EXPECT($L31, fail, 'SingleNestedExpression ""'))))), function($skip, $loc, $0, $1, $2, $3) {
|
|
1451
1454
|
var exp = $2;
|
|
1452
1455
|
if (exp)
|
|
1453
1456
|
return exp;
|
|
1454
1457
|
return $skip;
|
|
1455
1458
|
});
|
|
1456
|
-
function
|
|
1459
|
+
function SingleNestedExpression(state) {
|
|
1457
1460
|
if (state.verbose)
|
|
1458
|
-
console.log("ENTER:", "
|
|
1461
|
+
console.log("ENTER:", "SingleNestedExpression");
|
|
1459
1462
|
if (state.tokenize) {
|
|
1460
|
-
return $TOKEN("
|
|
1463
|
+
return $TOKEN("SingleNestedExpression", state, SingleNestedExpression$0(state));
|
|
1461
1464
|
} else {
|
|
1462
|
-
return
|
|
1465
|
+
return SingleNestedExpression$0(state);
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
var SingleNestedBlockStatement$0 = $TS($S(PushIndent, $E($S(Nested, StatementListItem)), $C($C($N($S(Nested, StatementListItem)), $S(PopIndent, $N($EXPECT($L31, fail, 'SingleNestedBlockStatement ""')))), PopIndent)), function($skip, $loc, $0, $1, $2, $3) {
|
|
1469
|
+
var exp = $2;
|
|
1470
|
+
if (exp)
|
|
1471
|
+
return exp;
|
|
1472
|
+
return $skip;
|
|
1473
|
+
});
|
|
1474
|
+
function SingleNestedBlockStatement(state) {
|
|
1475
|
+
if (state.verbose)
|
|
1476
|
+
console.log("ENTER:", "SingleNestedBlockStatement");
|
|
1477
|
+
if (state.tokenize) {
|
|
1478
|
+
return $TOKEN("SingleNestedBlockStatement", state, SingleNestedBlockStatement$0(state));
|
|
1479
|
+
} else {
|
|
1480
|
+
return SingleNestedBlockStatement$0(state);
|
|
1463
1481
|
}
|
|
1464
1482
|
}
|
|
1465
1483
|
var NestedBlockExpressions$0 = $TS($S(PushIndent, $Q(BlockExpression), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
@@ -2241,14 +2259,33 @@ var require_parser = __commonJS({
|
|
|
2241
2259
|
var KeywordStatement$0 = $S($EXPECT($L107, fail, 'KeywordStatement "break"'), NonIdContinue);
|
|
2242
2260
|
var KeywordStatement$1 = $S($EXPECT($L108, fail, 'KeywordStatement "continue"'), NonIdContinue);
|
|
2243
2261
|
var KeywordStatement$2 = $S($EXPECT($L109, fail, 'KeywordStatement "debugger"'), NonIdContinue);
|
|
2244
|
-
var KeywordStatement$3 = $S($
|
|
2245
|
-
var KeywordStatement$4 = $S($EXPECT($L110, fail, 'KeywordStatement "
|
|
2246
|
-
var KeywordStatement$5 = $S($EXPECT($L111, fail, 'KeywordStatement "throw"'), NonIdContinue, Expression);
|
|
2262
|
+
var KeywordStatement$3 = $S(Return, $E(MaybeNestedExpression));
|
|
2263
|
+
var KeywordStatement$4 = $S($EXPECT($L110, fail, 'KeywordStatement "throw"'), NonIdContinue, Expression);
|
|
2247
2264
|
function KeywordStatement(state) {
|
|
2248
2265
|
if (state.tokenize) {
|
|
2249
|
-
return $TOKEN("KeywordStatement", state, KeywordStatement$0(state) || KeywordStatement$1(state) || KeywordStatement$2(state) || KeywordStatement$3(state) || KeywordStatement$4(state)
|
|
2266
|
+
return $TOKEN("KeywordStatement", state, KeywordStatement$0(state) || KeywordStatement$1(state) || KeywordStatement$2(state) || KeywordStatement$3(state) || KeywordStatement$4(state));
|
|
2267
|
+
} else {
|
|
2268
|
+
return KeywordStatement$0(state) || KeywordStatement$1(state) || KeywordStatement$2(state) || KeywordStatement$3(state) || KeywordStatement$4(state);
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
var MaybeNestedExpression$0 = $S($N(EOS), $Q(TrailingComment), Expression);
|
|
2272
|
+
var MaybeNestedExpression$1 = $S($Y(EOS), SingleNestedExpression);
|
|
2273
|
+
var MaybeNestedExpression$2 = $S($Y(EOS), ObjectLiteral);
|
|
2274
|
+
function MaybeNestedExpression(state) {
|
|
2275
|
+
if (state.tokenize) {
|
|
2276
|
+
return $TOKEN("MaybeNestedExpression", state, MaybeNestedExpression$0(state) || MaybeNestedExpression$1(state) || MaybeNestedExpression$2(state));
|
|
2277
|
+
} else {
|
|
2278
|
+
return MaybeNestedExpression$0(state) || MaybeNestedExpression$1(state) || MaybeNestedExpression$2(state);
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
var Return$0 = $S($EXPECT($L111, fail, 'Return "return"'), NonIdContinue);
|
|
2282
|
+
function Return(state) {
|
|
2283
|
+
if (state.verbose)
|
|
2284
|
+
console.log("ENTER:", "Return");
|
|
2285
|
+
if (state.tokenize) {
|
|
2286
|
+
return $TOKEN("Return", state, Return$0(state));
|
|
2250
2287
|
} else {
|
|
2251
|
-
return
|
|
2288
|
+
return Return$0(state);
|
|
2252
2289
|
}
|
|
2253
2290
|
}
|
|
2254
2291
|
var ImportDeclaration$0 = $T($S($EXPECT($L112, fail, 'ImportDeclaration "import type"'), NonIdContinue, __, ImportClause, __, FromClause), function(value) {
|
|
@@ -3565,7 +3602,9 @@ gen = require_generate();
|
|
|
3565
3602
|
module.exports = {
|
|
3566
3603
|
parse,
|
|
3567
3604
|
compile: function(src, options) {
|
|
3568
|
-
return gen(parse(src
|
|
3605
|
+
return gen(parse(src, {
|
|
3606
|
+
filename: options != null ? options.filename : void 0
|
|
3607
|
+
}), options);
|
|
3569
3608
|
},
|
|
3570
3609
|
generate: gen
|
|
3571
3610
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const { readFile } = require('fs/promises');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { compile } = require("./");
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
name: 'civet',
|
|
7
|
+
setup(build) {
|
|
8
|
+
build.onLoad({
|
|
9
|
+
filter: /\.civet/
|
|
10
|
+
}, async function (args) {
|
|
11
|
+
return readFile(args.path, 'utf8')
|
|
12
|
+
.then(function (source) {
|
|
13
|
+
const filename = path.relative(process.cwd(), args.path);
|
|
14
|
+
return {
|
|
15
|
+
contents: compile(source, { filename, js: true })
|
|
16
|
+
};
|
|
17
|
+
}).catch(function (e) {
|
|
18
|
+
return {
|
|
19
|
+
errors: [{
|
|
20
|
+
text: e.message
|
|
21
|
+
}]
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danielx/civet",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"description": "CoffeeScript style syntax for TypeScript",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"types": "dist/types.d.ts",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist/",
|
|
12
|
+
"esbuild-plugin.js",
|
|
12
13
|
"register.js",
|
|
13
14
|
"register.mjs"
|
|
14
15
|
],
|