@danielx/civet 0.6.63 → 0.6.65

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
@@ -6348,11 +6348,15 @@ ${input.slice(result.pos)}
6348
6348
  var PropertyAccess$0 = $TS($S(AccessStart, $C(TemplateLiteral, StringLiteral, IntegerLiteral)), function($skip, $loc, $0, $1, $2) {
6349
6349
  var dot = $1;
6350
6350
  var literal = $2;
6351
- dot = replaceNodes(
6352
- deepCopy(dot),
6353
- (node) => node.token === ".",
6354
- (node) => ({ token: "[", $loc: node.$loc })
6355
- );
6351
+ if (gatherRecursive(dot, (node) => node.token === "?").length) {
6352
+ dot = [...dot, "["];
6353
+ } else {
6354
+ dot = replaceNodes(
6355
+ deepCopy(dot),
6356
+ (node) => node.token === ".",
6357
+ (node) => ({ ...node, token: "[" })
6358
+ );
6359
+ }
6356
6360
  return {
6357
6361
  type: "Index",
6358
6362
  children: [
@@ -14682,6 +14686,7 @@ ${input.slice(result.pos)}
14682
14686
  expressionizeTypeIf,
14683
14687
  forRange,
14684
14688
  gatherBindingCode,
14689
+ gatherRecursive,
14685
14690
  getIndentLevel,
14686
14691
  getTrimmingSpace,
14687
14692
  hasAwait,
package/dist/esbuild.js CHANGED
@@ -178,6 +178,29 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
178
178
  getFormatHost(ts.sys)
179
179
  )
180
180
  );
181
+ if (options.typecheck) {
182
+ let failures = [];
183
+ if (typeof options.typecheck === "string") {
184
+ if (options.typecheck.includes("error"))
185
+ failures.push(1 /* Error */);
186
+ if (options.typecheck.includes("warning"))
187
+ failures.push(0 /* Warning */);
188
+ if (options.typecheck.includes("suggestion"))
189
+ failures.push(2 /* Suggestion */);
190
+ if (options.typecheck.includes("message"))
191
+ failures.push(3 /* Message */);
192
+ if (options.typecheck.includes("all")) {
193
+ failures = { includes: () => true };
194
+ }
195
+ } else {
196
+ failures.push(1 /* Error */);
197
+ }
198
+ const count = diagnostics.filter((d) => failures.includes(d.category)).length;
199
+ if (count) {
200
+ const reason = count === diagnostics.length ? count : `${count} out of ${diagnostics.length}`;
201
+ throw new Error(`Aborting build because of ${reason} TypeScript diagnostic${diagnostics.length > 1 ? "s" : ""} above`);
202
+ }
203
+ }
181
204
  }
182
205
  if (options.emitDeclaration) {
183
206
  if (meta.framework === "esbuild" && !esbuildOptions.outdir) {
package/dist/main.js CHANGED
@@ -6340,11 +6340,15 @@ var require_parser = __commonJS({
6340
6340
  var PropertyAccess$0 = $TS($S(AccessStart, $C(TemplateLiteral, StringLiteral, IntegerLiteral)), function($skip, $loc, $0, $1, $2) {
6341
6341
  var dot = $1;
6342
6342
  var literal = $2;
6343
- dot = replaceNodes(
6344
- deepCopy(dot),
6345
- (node) => node.token === ".",
6346
- (node) => ({ token: "[", $loc: node.$loc })
6347
- );
6343
+ if (gatherRecursive(dot, (node) => node.token === "?").length) {
6344
+ dot = [...dot, "["];
6345
+ } else {
6346
+ dot = replaceNodes(
6347
+ deepCopy(dot),
6348
+ (node) => node.token === ".",
6349
+ (node) => ({ ...node, token: "[" })
6350
+ );
6351
+ }
6348
6352
  return {
6349
6353
  type: "Index",
6350
6354
  children: [
@@ -14674,6 +14678,7 @@ var require_parser = __commonJS({
14674
14678
  expressionizeTypeIf,
14675
14679
  forRange,
14676
14680
  gatherBindingCode,
14681
+ gatherRecursive,
14677
14682
  getIndentLevel,
14678
14683
  getTrimmingSpace,
14679
14684
  hasAwait,
package/dist/main.mjs CHANGED
@@ -6338,11 +6338,15 @@ var require_parser = __commonJS({
6338
6338
  var PropertyAccess$0 = $TS($S(AccessStart, $C(TemplateLiteral, StringLiteral, IntegerLiteral)), function($skip, $loc, $0, $1, $2) {
6339
6339
  var dot = $1;
6340
6340
  var literal = $2;
6341
- dot = replaceNodes(
6342
- deepCopy(dot),
6343
- (node) => node.token === ".",
6344
- (node) => ({ token: "[", $loc: node.$loc })
6345
- );
6341
+ if (gatherRecursive(dot, (node) => node.token === "?").length) {
6342
+ dot = [...dot, "["];
6343
+ } else {
6344
+ dot = replaceNodes(
6345
+ deepCopy(dot),
6346
+ (node) => node.token === ".",
6347
+ (node) => ({ ...node, token: "[" })
6348
+ );
6349
+ }
6346
6350
  return {
6347
6351
  type: "Index",
6348
6352
  children: [
@@ -14672,6 +14676,7 @@ var require_parser = __commonJS({
14672
14676
  expressionizeTypeIf,
14673
14677
  forRange,
14674
14678
  gatherBindingCode,
14679
+ gatherRecursive,
14675
14680
  getIndentLevel,
14676
14681
  getTrimmingSpace,
14677
14682
  hasAwait,
package/dist/rollup.js CHANGED
@@ -178,6 +178,29 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
178
178
  getFormatHost(ts.sys)
179
179
  )
180
180
  );
181
+ if (options.typecheck) {
182
+ let failures = [];
183
+ if (typeof options.typecheck === "string") {
184
+ if (options.typecheck.includes("error"))
185
+ failures.push(1 /* Error */);
186
+ if (options.typecheck.includes("warning"))
187
+ failures.push(0 /* Warning */);
188
+ if (options.typecheck.includes("suggestion"))
189
+ failures.push(2 /* Suggestion */);
190
+ if (options.typecheck.includes("message"))
191
+ failures.push(3 /* Message */);
192
+ if (options.typecheck.includes("all")) {
193
+ failures = { includes: () => true };
194
+ }
195
+ } else {
196
+ failures.push(1 /* Error */);
197
+ }
198
+ const count = diagnostics.filter((d) => failures.includes(d.category)).length;
199
+ if (count) {
200
+ const reason = count === diagnostics.length ? count : `${count} out of ${diagnostics.length}`;
201
+ throw new Error(`Aborting build because of ${reason} TypeScript diagnostic${diagnostics.length > 1 ? "s" : ""} above`);
202
+ }
203
+ }
181
204
  }
182
205
  if (options.emitDeclaration) {
183
206
  if (meta.framework === "esbuild" && !esbuildOptions.outdir) {
@@ -145,6 +145,29 @@ var civetUnplugin = createUnplugin((options = {}, meta) => {
145
145
  getFormatHost(ts.sys)
146
146
  )
147
147
  );
148
+ if (options.typecheck) {
149
+ let failures = [];
150
+ if (typeof options.typecheck === "string") {
151
+ if (options.typecheck.includes("error"))
152
+ failures.push(1 /* Error */);
153
+ if (options.typecheck.includes("warning"))
154
+ failures.push(0 /* Warning */);
155
+ if (options.typecheck.includes("suggestion"))
156
+ failures.push(2 /* Suggestion */);
157
+ if (options.typecheck.includes("message"))
158
+ failures.push(3 /* Message */);
159
+ if (options.typecheck.includes("all")) {
160
+ failures = { includes: () => true };
161
+ }
162
+ } else {
163
+ failures.push(1 /* Error */);
164
+ }
165
+ const count = diagnostics.filter((d) => failures.includes(d.category)).length;
166
+ if (count) {
167
+ const reason = count === diagnostics.length ? count : `${count} out of ${diagnostics.length}`;
168
+ throw new Error(`Aborting build because of ${reason} TypeScript diagnostic${diagnostics.length > 1 ? "s" : ""} above`);
169
+ }
170
+ }
148
171
  }
149
172
  if (options.emitDeclaration) {
150
173
  if (meta.framework === "esbuild" && !esbuildOptions.outdir) {
@@ -6,7 +6,7 @@ type PluginOptions = {
6
6
  outputExtension?: string;
7
7
  transformOutput?: (code: string, id: string) => TransformResult | Promise<TransformResult>;
8
8
  emitDeclaration?: boolean;
9
- typecheck?: boolean;
9
+ typecheck?: boolean | string;
10
10
  ts?: 'civet' | 'esbuild' | 'tsc' | 'preserve';
11
11
  /** @deprecated Use "ts" option instead */
12
12
  js?: boolean;
@@ -6,7 +6,7 @@ type PluginOptions = {
6
6
  outputExtension?: string;
7
7
  transformOutput?: (code: string, id: string) => TransformResult | Promise<TransformResult>;
8
8
  emitDeclaration?: boolean;
9
- typecheck?: boolean;
9
+ typecheck?: boolean | string;
10
10
  ts?: 'civet' | 'esbuild' | 'tsc' | 'preserve';
11
11
  /** @deprecated Use "ts" option instead */
12
12
  js?: boolean;
package/dist/unplugin.js CHANGED
@@ -177,6 +177,29 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
177
177
  getFormatHost(ts.sys)
178
178
  )
179
179
  );
180
+ if (options.typecheck) {
181
+ let failures = [];
182
+ if (typeof options.typecheck === "string") {
183
+ if (options.typecheck.includes("error"))
184
+ failures.push(1 /* Error */);
185
+ if (options.typecheck.includes("warning"))
186
+ failures.push(0 /* Warning */);
187
+ if (options.typecheck.includes("suggestion"))
188
+ failures.push(2 /* Suggestion */);
189
+ if (options.typecheck.includes("message"))
190
+ failures.push(3 /* Message */);
191
+ if (options.typecheck.includes("all")) {
192
+ failures = { includes: () => true };
193
+ }
194
+ } else {
195
+ failures.push(1 /* Error */);
196
+ }
197
+ const count = diagnostics.filter((d) => failures.includes(d.category)).length;
198
+ if (count) {
199
+ const reason = count === diagnostics.length ? count : `${count} out of ${diagnostics.length}`;
200
+ throw new Error(`Aborting build because of ${reason} TypeScript diagnostic${diagnostics.length > 1 ? "s" : ""} above`);
201
+ }
202
+ }
180
203
  }
181
204
  if (options.emitDeclaration) {
182
205
  if (meta.framework === "esbuild" && !esbuildOptions.outdir) {
package/dist/vite.js CHANGED
@@ -178,6 +178,29 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
178
178
  getFormatHost(ts.sys)
179
179
  )
180
180
  );
181
+ if (options.typecheck) {
182
+ let failures = [];
183
+ if (typeof options.typecheck === "string") {
184
+ if (options.typecheck.includes("error"))
185
+ failures.push(1 /* Error */);
186
+ if (options.typecheck.includes("warning"))
187
+ failures.push(0 /* Warning */);
188
+ if (options.typecheck.includes("suggestion"))
189
+ failures.push(2 /* Suggestion */);
190
+ if (options.typecheck.includes("message"))
191
+ failures.push(3 /* Message */);
192
+ if (options.typecheck.includes("all")) {
193
+ failures = { includes: () => true };
194
+ }
195
+ } else {
196
+ failures.push(1 /* Error */);
197
+ }
198
+ const count = diagnostics.filter((d) => failures.includes(d.category)).length;
199
+ if (count) {
200
+ const reason = count === diagnostics.length ? count : `${count} out of ${diagnostics.length}`;
201
+ throw new Error(`Aborting build because of ${reason} TypeScript diagnostic${diagnostics.length > 1 ? "s" : ""} above`);
202
+ }
203
+ }
181
204
  }
182
205
  if (options.emitDeclaration) {
183
206
  if (meta.framework === "esbuild" && !esbuildOptions.outdir) {
package/dist/webpack.js CHANGED
@@ -178,6 +178,29 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
178
178
  getFormatHost(ts.sys)
179
179
  )
180
180
  );
181
+ if (options.typecheck) {
182
+ let failures = [];
183
+ if (typeof options.typecheck === "string") {
184
+ if (options.typecheck.includes("error"))
185
+ failures.push(1 /* Error */);
186
+ if (options.typecheck.includes("warning"))
187
+ failures.push(0 /* Warning */);
188
+ if (options.typecheck.includes("suggestion"))
189
+ failures.push(2 /* Suggestion */);
190
+ if (options.typecheck.includes("message"))
191
+ failures.push(3 /* Message */);
192
+ if (options.typecheck.includes("all")) {
193
+ failures = { includes: () => true };
194
+ }
195
+ } else {
196
+ failures.push(1 /* Error */);
197
+ }
198
+ const count = diagnostics.filter((d) => failures.includes(d.category)).length;
199
+ if (count) {
200
+ const reason = count === diagnostics.length ? count : `${count} out of ${diagnostics.length}`;
201
+ throw new Error(`Aborting build because of ${reason} TypeScript diagnostic${diagnostics.length > 1 ? "s" : ""} above`);
202
+ }
203
+ }
181
204
  }
182
205
  if (options.emitDeclaration) {
183
206
  if (meta.framework === "esbuild" && !esbuildOptions.outdir) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
3
  "type": "commonjs",
4
- "version": "0.6.63",
4
+ "version": "0.6.65",
5
5
  "description": "CoffeeScript style syntax for TypeScript",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/main.mjs",
@@ -76,7 +76,6 @@
76
76
  "@types/assert": "^1.5.6",
77
77
  "@types/mocha": "^9.1.1",
78
78
  "@types/node": "^20.5.1",
79
- "axios": "^1.2.2",
80
79
  "c8": "^7.12.0",
81
80
  "esbuild": "0.16.17",
82
81
  "marked": "^4.2.4",