@danielx/civet 0.6.60 → 0.6.61

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/esbuild.js CHANGED
@@ -80,7 +80,7 @@ function implicitCivet(file) {
80
80
  return civet2;
81
81
  return;
82
82
  }
83
- var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
83
+ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) => {
84
84
  if (options.dts)
85
85
  options.emitDeclaration = options.dts;
86
86
  if (options.js)
@@ -92,6 +92,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
92
92
  const sourceMaps = /* @__PURE__ */ new Map();
93
93
  let compilerOptions;
94
94
  let rootDir = process.cwd();
95
+ let esbuildOptions;
95
96
  const tsPromise = transformTS || options.ts === "tsc" ? import("typescript").then((m) => m.default) : null;
96
97
  const getFormatHost = (sys) => {
97
98
  return {
@@ -175,13 +176,20 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
175
176
  );
176
177
  }
177
178
  if (options.emitDeclaration) {
179
+ if (meta.framework === "esbuild" && !esbuildOptions.outdir) {
180
+ console.log("WARNING: Civet unplugin's `emitDeclaration` requires esbuild's `outdir` option to be set;");
181
+ }
182
+ for (const file of fsMap.keys()) {
183
+ const slashed = slash(file);
184
+ if (file !== slashed) {
185
+ fsMap.delete(slashed);
186
+ }
187
+ }
178
188
  for (const file of fsMap.keys()) {
179
189
  const sourceFile = program.getSourceFile(file);
180
190
  program.emit(
181
191
  sourceFile,
182
- async (filePath, content) => {
183
- const dir = import_path.default.dirname(filePath);
184
- await fs.promises.mkdir(dir, { recursive: true });
192
+ (filePath, content) => {
185
193
  const pathFromDistDir = import_path.default.relative(
186
194
  compilerOptions.outDir ?? process.cwd(),
187
195
  filePath
@@ -240,16 +248,16 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
240
248
  js: false,
241
249
  sourceMap: true
242
250
  });
251
+ const resolved = import_path.default.resolve(process.cwd(), id);
243
252
  sourceMaps.set(
244
- import_path.default.resolve(process.cwd(), id),
253
+ resolved,
245
254
  compiledTS.sourceMap
246
255
  );
247
256
  if (transformTS) {
248
- const resolved = import_path.default.resolve(process.cwd(), id);
249
257
  fsMap.set(resolved, compiledTS.code);
250
258
  const slashed = slash(resolved);
251
259
  if (resolved !== slashed)
252
- fsMap.set(slashed, rawCivetSource);
260
+ fsMap.set(slashed, compiledTS.code);
253
261
  }
254
262
  switch (options.ts) {
255
263
  case "esbuild": {
@@ -304,6 +312,11 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
304
312
  transformed = await options.transformOutput(transformed.code, id);
305
313
  return transformed;
306
314
  },
315
+ esbuild: {
316
+ config(options2) {
317
+ esbuildOptions = options2;
318
+ }
319
+ },
307
320
  vite: {
308
321
  config(config) {
309
322
  var _a;
package/dist/rollup.js CHANGED
@@ -80,7 +80,7 @@ function implicitCivet(file) {
80
80
  return civet2;
81
81
  return;
82
82
  }
83
- var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
83
+ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) => {
84
84
  if (options.dts)
85
85
  options.emitDeclaration = options.dts;
86
86
  if (options.js)
@@ -92,6 +92,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
92
92
  const sourceMaps = /* @__PURE__ */ new Map();
93
93
  let compilerOptions;
94
94
  let rootDir = process.cwd();
95
+ let esbuildOptions;
95
96
  const tsPromise = transformTS || options.ts === "tsc" ? import("typescript").then((m) => m.default) : null;
96
97
  const getFormatHost = (sys) => {
97
98
  return {
@@ -175,13 +176,20 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
175
176
  );
176
177
  }
177
178
  if (options.emitDeclaration) {
179
+ if (meta.framework === "esbuild" && !esbuildOptions.outdir) {
180
+ console.log("WARNING: Civet unplugin's `emitDeclaration` requires esbuild's `outdir` option to be set;");
181
+ }
182
+ for (const file of fsMap.keys()) {
183
+ const slashed = slash(file);
184
+ if (file !== slashed) {
185
+ fsMap.delete(slashed);
186
+ }
187
+ }
178
188
  for (const file of fsMap.keys()) {
179
189
  const sourceFile = program.getSourceFile(file);
180
190
  program.emit(
181
191
  sourceFile,
182
- async (filePath, content) => {
183
- const dir = import_path.default.dirname(filePath);
184
- await fs.promises.mkdir(dir, { recursive: true });
192
+ (filePath, content) => {
185
193
  const pathFromDistDir = import_path.default.relative(
186
194
  compilerOptions.outDir ?? process.cwd(),
187
195
  filePath
@@ -240,16 +248,16 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
240
248
  js: false,
241
249
  sourceMap: true
242
250
  });
251
+ const resolved = import_path.default.resolve(process.cwd(), id);
243
252
  sourceMaps.set(
244
- import_path.default.resolve(process.cwd(), id),
253
+ resolved,
245
254
  compiledTS.sourceMap
246
255
  );
247
256
  if (transformTS) {
248
- const resolved = import_path.default.resolve(process.cwd(), id);
249
257
  fsMap.set(resolved, compiledTS.code);
250
258
  const slashed = slash(resolved);
251
259
  if (resolved !== slashed)
252
- fsMap.set(slashed, rawCivetSource);
260
+ fsMap.set(slashed, compiledTS.code);
253
261
  }
254
262
  switch (options.ts) {
255
263
  case "esbuild": {
@@ -304,6 +312,11 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
304
312
  transformed = await options.transformOutput(transformed.code, id);
305
313
  return transformed;
306
314
  },
315
+ esbuild: {
316
+ config(options2) {
317
+ esbuildOptions = options2;
318
+ }
319
+ },
307
320
  vite: {
308
321
  config(config) {
309
322
  var _a;
@@ -47,7 +47,7 @@ function implicitCivet(file) {
47
47
  return civet2;
48
48
  return;
49
49
  }
50
- var civetUnplugin = createUnplugin((options = {}) => {
50
+ var civetUnplugin = createUnplugin((options = {}, meta) => {
51
51
  if (options.dts)
52
52
  options.emitDeclaration = options.dts;
53
53
  if (options.js)
@@ -59,6 +59,7 @@ var civetUnplugin = createUnplugin((options = {}) => {
59
59
  const sourceMaps = /* @__PURE__ */ new Map();
60
60
  let compilerOptions;
61
61
  let rootDir = process.cwd();
62
+ let esbuildOptions;
62
63
  const tsPromise = transformTS || options.ts === "tsc" ? import("typescript").then((m) => m.default) : null;
63
64
  const getFormatHost = (sys) => {
64
65
  return {
@@ -142,13 +143,20 @@ var civetUnplugin = createUnplugin((options = {}) => {
142
143
  );
143
144
  }
144
145
  if (options.emitDeclaration) {
146
+ if (meta.framework === "esbuild" && !esbuildOptions.outdir) {
147
+ console.log("WARNING: Civet unplugin's `emitDeclaration` requires esbuild's `outdir` option to be set;");
148
+ }
149
+ for (const file of fsMap.keys()) {
150
+ const slashed = slash(file);
151
+ if (file !== slashed) {
152
+ fsMap.delete(slashed);
153
+ }
154
+ }
145
155
  for (const file of fsMap.keys()) {
146
156
  const sourceFile = program.getSourceFile(file);
147
157
  program.emit(
148
158
  sourceFile,
149
- async (filePath, content) => {
150
- const dir = path.dirname(filePath);
151
- await fs.promises.mkdir(dir, { recursive: true });
159
+ (filePath, content) => {
152
160
  const pathFromDistDir = path.relative(
153
161
  compilerOptions.outDir ?? process.cwd(),
154
162
  filePath
@@ -207,16 +215,16 @@ var civetUnplugin = createUnplugin((options = {}) => {
207
215
  js: false,
208
216
  sourceMap: true
209
217
  });
218
+ const resolved = path.resolve(process.cwd(), id);
210
219
  sourceMaps.set(
211
- path.resolve(process.cwd(), id),
220
+ resolved,
212
221
  compiledTS.sourceMap
213
222
  );
214
223
  if (transformTS) {
215
- const resolved = path.resolve(process.cwd(), id);
216
224
  fsMap.set(resolved, compiledTS.code);
217
225
  const slashed = slash(resolved);
218
226
  if (resolved !== slashed)
219
- fsMap.set(slashed, rawCivetSource);
227
+ fsMap.set(slashed, compiledTS.code);
220
228
  }
221
229
  switch (options.ts) {
222
230
  case "esbuild": {
@@ -271,6 +279,11 @@ var civetUnplugin = createUnplugin((options = {}) => {
271
279
  transformed = await options.transformOutput(transformed.code, id);
272
280
  return transformed;
273
281
  },
282
+ esbuild: {
283
+ config(options2) {
284
+ esbuildOptions = options2;
285
+ }
286
+ },
274
287
  vite: {
275
288
  config(config) {
276
289
  var _a;
package/dist/unplugin.js CHANGED
@@ -79,7 +79,7 @@ function implicitCivet(file) {
79
79
  return civet2;
80
80
  return;
81
81
  }
82
- var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
82
+ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) => {
83
83
  if (options.dts)
84
84
  options.emitDeclaration = options.dts;
85
85
  if (options.js)
@@ -91,6 +91,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
91
91
  const sourceMaps = /* @__PURE__ */ new Map();
92
92
  let compilerOptions;
93
93
  let rootDir = process.cwd();
94
+ let esbuildOptions;
94
95
  const tsPromise = transformTS || options.ts === "tsc" ? import("typescript").then((m) => m.default) : null;
95
96
  const getFormatHost = (sys) => {
96
97
  return {
@@ -174,13 +175,20 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
174
175
  );
175
176
  }
176
177
  if (options.emitDeclaration) {
178
+ if (meta.framework === "esbuild" && !esbuildOptions.outdir) {
179
+ console.log("WARNING: Civet unplugin's `emitDeclaration` requires esbuild's `outdir` option to be set;");
180
+ }
181
+ for (const file of fsMap.keys()) {
182
+ const slashed = slash(file);
183
+ if (file !== slashed) {
184
+ fsMap.delete(slashed);
185
+ }
186
+ }
177
187
  for (const file of fsMap.keys()) {
178
188
  const sourceFile = program.getSourceFile(file);
179
189
  program.emit(
180
190
  sourceFile,
181
- async (filePath, content) => {
182
- const dir = import_path.default.dirname(filePath);
183
- await fs.promises.mkdir(dir, { recursive: true });
191
+ (filePath, content) => {
184
192
  const pathFromDistDir = import_path.default.relative(
185
193
  compilerOptions.outDir ?? process.cwd(),
186
194
  filePath
@@ -239,16 +247,16 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
239
247
  js: false,
240
248
  sourceMap: true
241
249
  });
250
+ const resolved = import_path.default.resolve(process.cwd(), id);
242
251
  sourceMaps.set(
243
- import_path.default.resolve(process.cwd(), id),
252
+ resolved,
244
253
  compiledTS.sourceMap
245
254
  );
246
255
  if (transformTS) {
247
- const resolved = import_path.default.resolve(process.cwd(), id);
248
256
  fsMap.set(resolved, compiledTS.code);
249
257
  const slashed = slash(resolved);
250
258
  if (resolved !== slashed)
251
- fsMap.set(slashed, rawCivetSource);
259
+ fsMap.set(slashed, compiledTS.code);
252
260
  }
253
261
  switch (options.ts) {
254
262
  case "esbuild": {
@@ -303,6 +311,11 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
303
311
  transformed = await options.transformOutput(transformed.code, id);
304
312
  return transformed;
305
313
  },
314
+ esbuild: {
315
+ config(options2) {
316
+ esbuildOptions = options2;
317
+ }
318
+ },
306
319
  vite: {
307
320
  config(config) {
308
321
  var _a;
package/dist/vite.js CHANGED
@@ -80,7 +80,7 @@ function implicitCivet(file) {
80
80
  return civet2;
81
81
  return;
82
82
  }
83
- var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
83
+ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) => {
84
84
  if (options.dts)
85
85
  options.emitDeclaration = options.dts;
86
86
  if (options.js)
@@ -92,6 +92,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
92
92
  const sourceMaps = /* @__PURE__ */ new Map();
93
93
  let compilerOptions;
94
94
  let rootDir = process.cwd();
95
+ let esbuildOptions;
95
96
  const tsPromise = transformTS || options.ts === "tsc" ? import("typescript").then((m) => m.default) : null;
96
97
  const getFormatHost = (sys) => {
97
98
  return {
@@ -175,13 +176,20 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
175
176
  );
176
177
  }
177
178
  if (options.emitDeclaration) {
179
+ if (meta.framework === "esbuild" && !esbuildOptions.outdir) {
180
+ console.log("WARNING: Civet unplugin's `emitDeclaration` requires esbuild's `outdir` option to be set;");
181
+ }
182
+ for (const file of fsMap.keys()) {
183
+ const slashed = slash(file);
184
+ if (file !== slashed) {
185
+ fsMap.delete(slashed);
186
+ }
187
+ }
178
188
  for (const file of fsMap.keys()) {
179
189
  const sourceFile = program.getSourceFile(file);
180
190
  program.emit(
181
191
  sourceFile,
182
- async (filePath, content) => {
183
- const dir = import_path.default.dirname(filePath);
184
- await fs.promises.mkdir(dir, { recursive: true });
192
+ (filePath, content) => {
185
193
  const pathFromDistDir = import_path.default.relative(
186
194
  compilerOptions.outDir ?? process.cwd(),
187
195
  filePath
@@ -240,16 +248,16 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
240
248
  js: false,
241
249
  sourceMap: true
242
250
  });
251
+ const resolved = import_path.default.resolve(process.cwd(), id);
243
252
  sourceMaps.set(
244
- import_path.default.resolve(process.cwd(), id),
253
+ resolved,
245
254
  compiledTS.sourceMap
246
255
  );
247
256
  if (transformTS) {
248
- const resolved = import_path.default.resolve(process.cwd(), id);
249
257
  fsMap.set(resolved, compiledTS.code);
250
258
  const slashed = slash(resolved);
251
259
  if (resolved !== slashed)
252
- fsMap.set(slashed, rawCivetSource);
260
+ fsMap.set(slashed, compiledTS.code);
253
261
  }
254
262
  switch (options.ts) {
255
263
  case "esbuild": {
@@ -304,6 +312,11 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
304
312
  transformed = await options.transformOutput(transformed.code, id);
305
313
  return transformed;
306
314
  },
315
+ esbuild: {
316
+ config(options2) {
317
+ esbuildOptions = options2;
318
+ }
319
+ },
307
320
  vite: {
308
321
  config(config) {
309
322
  var _a;
package/dist/webpack.js CHANGED
@@ -80,7 +80,7 @@ function implicitCivet(file) {
80
80
  return civet2;
81
81
  return;
82
82
  }
83
- var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
83
+ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) => {
84
84
  if (options.dts)
85
85
  options.emitDeclaration = options.dts;
86
86
  if (options.js)
@@ -92,6 +92,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
92
92
  const sourceMaps = /* @__PURE__ */ new Map();
93
93
  let compilerOptions;
94
94
  let rootDir = process.cwd();
95
+ let esbuildOptions;
95
96
  const tsPromise = transformTS || options.ts === "tsc" ? import("typescript").then((m) => m.default) : null;
96
97
  const getFormatHost = (sys) => {
97
98
  return {
@@ -175,13 +176,20 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
175
176
  );
176
177
  }
177
178
  if (options.emitDeclaration) {
179
+ if (meta.framework === "esbuild" && !esbuildOptions.outdir) {
180
+ console.log("WARNING: Civet unplugin's `emitDeclaration` requires esbuild's `outdir` option to be set;");
181
+ }
182
+ for (const file of fsMap.keys()) {
183
+ const slashed = slash(file);
184
+ if (file !== slashed) {
185
+ fsMap.delete(slashed);
186
+ }
187
+ }
178
188
  for (const file of fsMap.keys()) {
179
189
  const sourceFile = program.getSourceFile(file);
180
190
  program.emit(
181
191
  sourceFile,
182
- async (filePath, content) => {
183
- const dir = import_path.default.dirname(filePath);
184
- await fs.promises.mkdir(dir, { recursive: true });
192
+ (filePath, content) => {
185
193
  const pathFromDistDir = import_path.default.relative(
186
194
  compilerOptions.outDir ?? process.cwd(),
187
195
  filePath
@@ -240,16 +248,16 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
240
248
  js: false,
241
249
  sourceMap: true
242
250
  });
251
+ const resolved = import_path.default.resolve(process.cwd(), id);
243
252
  sourceMaps.set(
244
- import_path.default.resolve(process.cwd(), id),
253
+ resolved,
245
254
  compiledTS.sourceMap
246
255
  );
247
256
  if (transformTS) {
248
- const resolved = import_path.default.resolve(process.cwd(), id);
249
257
  fsMap.set(resolved, compiledTS.code);
250
258
  const slashed = slash(resolved);
251
259
  if (resolved !== slashed)
252
- fsMap.set(slashed, rawCivetSource);
260
+ fsMap.set(slashed, compiledTS.code);
253
261
  }
254
262
  switch (options.ts) {
255
263
  case "esbuild": {
@@ -304,6 +312,11 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
304
312
  transformed = await options.transformOutput(transformed.code, id);
305
313
  return transformed;
306
314
  },
315
+ esbuild: {
316
+ config(options2) {
317
+ esbuildOptions = options2;
318
+ }
319
+ },
307
320
  vite: {
308
321
  config(config) {
309
322
  var _a;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
3
  "type": "commonjs",
4
- "version": "0.6.60",
4
+ "version": "0.6.61",
5
5
  "description": "CoffeeScript style syntax for TypeScript",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/main.mjs",
@@ -67,7 +67,7 @@
67
67
  "dependencies": {
68
68
  "@cspotcode/source-map-support": "^0.8.1",
69
69
  "@typescript/vfs": "^1.5.0",
70
- "unplugin": "^1.4.0"
70
+ "unplugin": "^1.6.0"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@danielx/civet": "0.6.59",