@danielx/civet 0.7.12 → 0.7.14

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/astro.js CHANGED
@@ -100,6 +100,7 @@ var rawPlugin = (options = {}, meta) => {
100
100
  let compilerOptions, compilerOptionsWithSourceMap;
101
101
  let rootDir = process.cwd();
102
102
  let esbuildOptions;
103
+ let configErrors;
103
104
  const tsPromise = transformTS || options.ts === "tsc" ? import("typescript").then((m) => m.default) : null;
104
105
  const getFormatHost = (sys) => {
105
106
  return {
@@ -140,12 +141,13 @@ var rawPlugin = (options = {}, meta) => {
140
141
  ts.sys,
141
142
  process.cwd()
142
143
  );
144
+ configErrors = configContents.errors;
143
145
  compilerOptions = {
144
146
  ...configContents.options,
145
147
  target: ts.ScriptTarget.ESNext,
146
148
  composite: false
147
149
  };
148
- compilerOptions.jsx ?? (compilerOptions.jsx = "preserve");
150
+ compilerOptions.jsx ?? (compilerOptions.jsx = ts.JsxEmit.Preserve);
149
151
  compilerOptionsWithSourceMap = {
150
152
  ...compilerOptions,
151
153
  sourceMap: true
@@ -166,6 +168,31 @@ var rawPlugin = (options = {}, meta) => {
166
168
  return systemFileExists(filename.slice(0, -4));
167
169
  };
168
170
  system.readFile = (filename, encoding = "utf-8") => {
171
+ if (import_path.default.basename(filename) === "package.json") {
172
+ let recurse2 = function(node) {
173
+ if (node && typeof node === "object") {
174
+ for (const key in node) {
175
+ const value = node[key];
176
+ if (typeof value === "string") {
177
+ if (value.endsWith(".civet")) {
178
+ node[key] = value + ".tsx";
179
+ modified = true;
180
+ }
181
+ } else if (value) {
182
+ recurse2(value);
183
+ }
184
+ }
185
+ }
186
+ };
187
+ var recurse = recurse2;
188
+ const json = systemReadFile(filename);
189
+ if (!json)
190
+ return json;
191
+ const parsed = JSON.parse(json);
192
+ let modified = false;
193
+ recurse2(parsed.imports);
194
+ return modified ? JSON.stringify(parsed) : json;
195
+ }
169
196
  if (!filename.endsWith(".civet.tsx"))
170
197
  return systemReadFile(filename);
171
198
  if (fsMap.has(filename))
@@ -216,6 +243,9 @@ var rawPlugin = (options = {}, meta) => {
216
243
  start: range.start
217
244
  };
218
245
  });
246
+ if (configErrors?.length) {
247
+ diagnostics.unshift(...configErrors);
248
+ }
219
249
  if (diagnostics.length > 0) {
220
250
  console.error(
221
251
  ts.formatDiagnosticsWithColorAndContext(