@danielx/civet 0.3.1 → 0.3.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/README.md CHANGED
@@ -147,6 +147,7 @@ Things Added that CoffeeScript didn't
147
147
  - Convenience for ES6+ Features
148
148
  - `<` as `extends` shorthand
149
149
  - `@#id` -> `this.#id` shorthand for private identifiers
150
+ - `import` shorthand `x from "./x"` -> `import x from "./x"`
150
151
  - ClassStaticBlock
151
152
  - `get`/`set` method definitions
152
153
  - Private identifiers `#id`
package/dist/browser.js CHANGED
@@ -548,6 +548,7 @@ var Civet = (() => {
548
548
  MaybeNestedExpression,
549
549
  Return,
550
550
  ImportDeclaration,
551
+ ImpliedImport,
551
552
  Import,
552
553
  ImportClause,
553
554
  NameSpaceImport,
@@ -1306,9 +1307,9 @@ var Civet = (() => {
1306
1307
  return SpacedApplication$0(state);
1307
1308
  }
1308
1309
  }
1309
- var ApplicationStart$0 = $TS($S($E(OptionalShorthand), $TEXT($P(_)), $N(AdditionalReservedWords)), function($skip, $loc, $0, $1, $2, $3) {
1310
+ var ApplicationStart$0 = $TS($S($E(OptionalShorthand), $N(EOS), $TEXT($P(_)), $N(AdditionalReservedWords)), function($skip, $loc, $0, $1, $2, $3, $4) {
1310
1311
  var opt = $1;
1311
- var spacing = $2;
1312
+ var spacing = $3;
1312
1313
  return [opt, "(", spacing.replace(/^ /, "")];
1313
1314
  });
1314
1315
  function ApplicationStart(state) {
@@ -2499,11 +2500,24 @@ var Civet = (() => {
2499
2500
  });
2500
2501
  var ImportDeclaration$1 = $S(Import, __, ImportClause, __, FromClause);
2501
2502
  var ImportDeclaration$2 = $S(Import, __, ModuleSpecifier);
2503
+ var ImportDeclaration$3 = $S(ImpliedImport, ImportClause, __, FromClause);
2502
2504
  function ImportDeclaration(state) {
2503
2505
  if (state.tokenize) {
2504
- return $TOKEN("ImportDeclaration", state, ImportDeclaration$0(state) || ImportDeclaration$1(state) || ImportDeclaration$2(state));
2506
+ return $TOKEN("ImportDeclaration", state, ImportDeclaration$0(state) || ImportDeclaration$1(state) || ImportDeclaration$2(state) || ImportDeclaration$3(state));
2505
2507
  } else {
2506
- return ImportDeclaration$0(state) || ImportDeclaration$1(state) || ImportDeclaration$2(state);
2508
+ return ImportDeclaration$0(state) || ImportDeclaration$1(state) || ImportDeclaration$2(state) || ImportDeclaration$3(state);
2509
+ }
2510
+ }
2511
+ var ImpliedImport$0 = $T($EXPECT($L32, fail, 'ImpliedImport ""'), function(value) {
2512
+ return "import ";
2513
+ });
2514
+ function ImpliedImport(state) {
2515
+ if (state.verbose)
2516
+ console.log("ENTER:", "ImpliedImport");
2517
+ if (state.tokenize) {
2518
+ return $TOKEN("ImpliedImport", state, ImpliedImport$0(state));
2519
+ } else {
2520
+ return ImpliedImport$0(state);
2507
2521
  }
2508
2522
  }
2509
2523
  var Import$0 = $TS($S($EXPECT($L24, fail, 'Import "import"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
@@ -3767,8 +3781,7 @@ var Civet = (() => {
3767
3781
  if (spacing) {
3768
3782
  str = str.replaceAll(spacing[0], "\n");
3769
3783
  }
3770
- str = str.replace(/^(\r?\n|\n)/, "");
3771
- str = str.replace(/(\r?\n|\n)$/, "");
3784
+ str = str.replace(/^(\r?\n|\n)/, "").replace(/(\r?\n|\n)[ \t]*$/, "").replace(/(`|\$)/g, "\\$1");
3772
3785
  return str;
3773
3786
  };
3774
3787
  return $0;