@danielx/civet 0.11.5 → 0.11.6

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.
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -26,12 +27,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
27
  ));
27
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
29
 
29
- // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\esbuild-plugin.civet.jsx
30
- var esbuild_plugin_civet_exports = {};
31
- __export(esbuild_plugin_civet_exports, {
32
- default: () => esbuild_plugin_civet_default
30
+ // source/esbuild-plugin.civet
31
+ var esbuild_plugin_exports = {};
32
+ __export(esbuild_plugin_exports, {
33
+ default: () => esbuild_plugin_default
33
34
  });
34
- module.exports = __toCommonJS(esbuild_plugin_civet_exports);
35
+ module.exports = __toCommonJS(esbuild_plugin_exports);
35
36
  var import_promises = require("fs/promises");
36
37
  var import_path = __toESM(require("path"));
37
38
  var import_main = require("./main.js");
@@ -126,5 +127,5 @@ var civet = function(options = {}) {
126
127
  };
127
128
  var defaultPlugin = civet();
128
129
  civet.setup = defaultPlugin.setup;
129
- var esbuild_plugin_civet_default = civet;
130
+ var esbuild_plugin_default = civet;
130
131
  module.exports = module.exports.default;
package/dist/esm.mjs CHANGED
@@ -1,11 +1,11 @@
1
- // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\esm.civet.jsx
1
+ // source/esm.civet
2
2
  import { readFile } from "fs/promises";
3
3
  import { dirname } from "path";
4
4
  import { pathToFileURL, fileURLToPath } from "url";
5
- import { compile, SourceMap } from "./main.mjs";
5
+ import { compile } from "./main.mjs";
6
6
  import { findConfig, loadConfig } from "./config.mjs";
7
7
  var baseURL = pathToFileURL(process.cwd() + "/").href;
8
- var extensionsRegex = /\.civet$/;
8
+ var extensionsRegex = /\.civet(?:$|[?#])/;
9
9
  var globalOptions = {};
10
10
  function initialize(options = {}) {
11
11
  return globalOptions = options;
@@ -35,7 +35,7 @@ async function load(url, context, next) {
35
35
  }
36
36
  const options = {
37
37
  filename: path,
38
- sourceMap: true,
38
+ inlineMap: true,
39
39
  js: true
40
40
  };
41
41
  if (globalOptions.parseOptions) {
@@ -44,24 +44,18 @@ async function load(url, context, next) {
44
44
  if (loadedConfig?.parseOptions) {
45
45
  options.parseOptions = { ...options.parseOptions, ...loadedConfig.parseOptions };
46
46
  }
47
- let tsSource, sourceMap;
47
+ let code;
48
48
  try {
49
- ({ code: tsSource, sourceMap } = await compile(source, options));
49
+ code = await compile(source, options);
50
50
  } catch (e) {
51
51
  console.error(`Civet failed to compile ${url}:`, e);
52
52
  throw e;
53
53
  }
54
- const transpiledUrl = url + ".tsx";
55
- const result = await next(transpiledUrl, {
56
- // ts-node won't transpile unless this is module
57
- // can't use commonjs since we don't rewrite imports
54
+ return {
55
+ shortCircuit: true,
58
56
  format: "module",
59
- // NOTE: Setting the source in the context makes it available when ts-node uses defaultLoad
60
- source: tsSource
61
- });
62
- result.responseURL = (result.responseURL ?? transpiledUrl).replace(/.tsx$/, "");
63
- result.source = SourceMap.remap(result.source, sourceMap, url, result.responseURL);
64
- return result;
57
+ source: code
58
+ };
65
59
  }
66
60
  return next(url, context);
67
61
  }