@danielx/civet 0.5.46 → 0.5.48

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/browser.js CHANGED
@@ -7554,9 +7554,15 @@ ${input.slice(result.pos)}
7554
7554
  throw new Error("Can't use 'by' with 'of' in CoffeeScript for loops");
7555
7555
  }
7556
7556
  if (declaration.own) {
7557
- const indent2 = module.currentIndent.token + " ";
7558
7557
  const hasPropRef = module.getRef("hasProp");
7559
- blockPrefix.push([indent2, "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue\n"]);
7558
+ blockPrefix.push([indent, "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue\n"]);
7559
+ }
7560
+ if (index) {
7561
+ blockPrefix.push([indent, {
7562
+ type: "AssignmentExpression",
7563
+ children: [index, " = ", exp, "[", declaration, "]"],
7564
+ names: index.names
7565
+ }, ";\n"]);
7560
7566
  }
7561
7567
  kind.token = "in";
7562
7568
  } else if (kind.token === "in") {
@@ -7719,13 +7725,15 @@ ${input.slice(result.pos)}
7719
7725
  return result;
7720
7726
  }
7721
7727
  }
7722
- var CoffeeForIndex$0 = $TS($S($Q(TrailingComment), Comma, $Q(TrailingComment), BindingIdentifier), function($skip, $loc, $0, $1, $2, $3, $4) {
7728
+ var CoffeeForIndex$0 = $TS($S($E(_), Comma, $E(_), BindingIdentifier), function($skip, $loc, $0, $1, $2, $3, $4) {
7723
7729
  var ws1 = $1;
7724
7730
  var ws2 = $3;
7725
7731
  var id = $4;
7726
- return Object.assign({}, id, {
7727
- children: [...ws1, ...ws2, ...id.children]
7728
- });
7732
+ ws2 = module.insertTrimmingSpace(ws1, "");
7733
+ return {
7734
+ ...id,
7735
+ children: [...ws1 || [], ...ws2 || [], ...id.children]
7736
+ };
7729
7737
  });
7730
7738
  function CoffeeForIndex(state) {
7731
7739
  let eventData;
@@ -0,0 +1,22 @@
1
+ import {
2
+ plugin
3
+ } from "bun";
4
+ await plugin({
5
+ name: "Civet loader",
6
+ setup: async function(builder) {
7
+ var compile, readFileSync;
8
+ ({ compile } = await import("./main.mjs"));
9
+ ({ readFileSync } = await import("fs"));
10
+ return builder.onLoad({
11
+ filter: /\.civet$/
12
+ }, function({ path }) {
13
+ var contents, source;
14
+ source = readFileSync(path, "utf8");
15
+ contents = compile(source);
16
+ return {
17
+ contents,
18
+ loader: "js"
19
+ };
20
+ });
21
+ }
22
+ });
package/dist/main.js CHANGED
@@ -7553,9 +7553,15 @@ ${input.slice(result.pos)}
7553
7553
  throw new Error("Can't use 'by' with 'of' in CoffeeScript for loops");
7554
7554
  }
7555
7555
  if (declaration.own) {
7556
- const indent2 = module2.currentIndent.token + " ";
7557
7556
  const hasPropRef = module2.getRef("hasProp");
7558
- blockPrefix.push([indent2, "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue\n"]);
7557
+ blockPrefix.push([indent, "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue\n"]);
7558
+ }
7559
+ if (index) {
7560
+ blockPrefix.push([indent, {
7561
+ type: "AssignmentExpression",
7562
+ children: [index, " = ", exp, "[", declaration, "]"],
7563
+ names: index.names
7564
+ }, ";\n"]);
7559
7565
  }
7560
7566
  kind.token = "in";
7561
7567
  } else if (kind.token === "in") {
@@ -7718,13 +7724,15 @@ ${input.slice(result.pos)}
7718
7724
  return result;
7719
7725
  }
7720
7726
  }
7721
- var CoffeeForIndex$0 = $TS($S($Q(TrailingComment), Comma, $Q(TrailingComment), BindingIdentifier), function($skip, $loc, $0, $1, $2, $3, $4) {
7727
+ var CoffeeForIndex$0 = $TS($S($E(_), Comma, $E(_), BindingIdentifier), function($skip, $loc, $0, $1, $2, $3, $4) {
7722
7728
  var ws1 = $1;
7723
7729
  var ws2 = $3;
7724
7730
  var id = $4;
7725
- return Object.assign({}, id, {
7726
- children: [...ws1, ...ws2, ...id.children]
7727
- });
7731
+ ws2 = module2.insertTrimmingSpace(ws1, "");
7732
+ return {
7733
+ ...id,
7734
+ children: [...ws1 || [], ...ws2 || [], ...id.children]
7735
+ };
7728
7736
  });
7729
7737
  function CoffeeForIndex(state) {
7730
7738
  let eventData;
package/dist/main.mjs CHANGED
@@ -7551,9 +7551,15 @@ ${input.slice(result.pos)}
7551
7551
  throw new Error("Can't use 'by' with 'of' in CoffeeScript for loops");
7552
7552
  }
7553
7553
  if (declaration.own) {
7554
- const indent2 = module.currentIndent.token + " ";
7555
7554
  const hasPropRef = module.getRef("hasProp");
7556
- blockPrefix.push([indent2, "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue\n"]);
7555
+ blockPrefix.push([indent, "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue\n"]);
7556
+ }
7557
+ if (index) {
7558
+ blockPrefix.push([indent, {
7559
+ type: "AssignmentExpression",
7560
+ children: [index, " = ", exp, "[", declaration, "]"],
7561
+ names: index.names
7562
+ }, ";\n"]);
7557
7563
  }
7558
7564
  kind.token = "in";
7559
7565
  } else if (kind.token === "in") {
@@ -7716,13 +7722,15 @@ ${input.slice(result.pos)}
7716
7722
  return result;
7717
7723
  }
7718
7724
  }
7719
- var CoffeeForIndex$0 = $TS($S($Q(TrailingComment), Comma, $Q(TrailingComment), BindingIdentifier), function($skip, $loc, $0, $1, $2, $3, $4) {
7725
+ var CoffeeForIndex$0 = $TS($S($E(_), Comma, $E(_), BindingIdentifier), function($skip, $loc, $0, $1, $2, $3, $4) {
7720
7726
  var ws1 = $1;
7721
7727
  var ws2 = $3;
7722
7728
  var id = $4;
7723
- return Object.assign({}, id, {
7724
- children: [...ws1, ...ws2, ...id.children]
7725
- });
7729
+ ws2 = module.insertTrimmingSpace(ws1, "");
7730
+ return {
7731
+ ...id,
7732
+ children: [...ws1 || [], ...ws2 || [], ...id.children]
7733
+ };
7726
7734
  });
7727
7735
  function CoffeeForIndex(state) {
7728
7736
  let eventData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
- "version": "0.5.46",
3
+ "version": "0.5.48",
4
4
  "description": "CoffeeScript style syntax for TypeScript",
5
5
  "main": "dist/main.js",
6
6
  "module": "dist/main.mjs",
@@ -11,6 +11,7 @@
11
11
  },
12
12
  "./esm": "./dist/esm.mjs",
13
13
  "./esbuild-plugin": "./dist/esbuild-plugin.js",
14
+ "./bun-civet": "./dist/bun-civet.mjs",
14
15
  "./register": "./register.js",
15
16
  "./*": "./*",
16
17
  "./dist/*": "./dist/*"