@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/rollup.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(
@@ -67,6 +67,7 @@ var rawPlugin = (options = {}, meta) => {
67
67
  let compilerOptions, compilerOptionsWithSourceMap;
68
68
  let rootDir = process.cwd();
69
69
  let esbuildOptions;
70
+ let configErrors;
70
71
  const tsPromise = transformTS || options.ts === "tsc" ? import("typescript").then((m) => m.default) : null;
71
72
  const getFormatHost = (sys) => {
72
73
  return {
@@ -107,12 +108,13 @@ var rawPlugin = (options = {}, meta) => {
107
108
  ts.sys,
108
109
  process.cwd()
109
110
  );
111
+ configErrors = configContents.errors;
110
112
  compilerOptions = {
111
113
  ...configContents.options,
112
114
  target: ts.ScriptTarget.ESNext,
113
115
  composite: false
114
116
  };
115
- compilerOptions.jsx ?? (compilerOptions.jsx = "preserve");
117
+ compilerOptions.jsx ?? (compilerOptions.jsx = ts.JsxEmit.Preserve);
116
118
  compilerOptionsWithSourceMap = {
117
119
  ...compilerOptions,
118
120
  sourceMap: true
@@ -133,6 +135,31 @@ var rawPlugin = (options = {}, meta) => {
133
135
  return systemFileExists(filename.slice(0, -4));
134
136
  };
135
137
  system.readFile = (filename, encoding = "utf-8") => {
138
+ if (path.basename(filename) === "package.json") {
139
+ let recurse2 = function(node) {
140
+ if (node && typeof node === "object") {
141
+ for (const key in node) {
142
+ const value = node[key];
143
+ if (typeof value === "string") {
144
+ if (value.endsWith(".civet")) {
145
+ node[key] = value + ".tsx";
146
+ modified = true;
147
+ }
148
+ } else if (value) {
149
+ recurse2(value);
150
+ }
151
+ }
152
+ }
153
+ };
154
+ var recurse = recurse2;
155
+ const json = systemReadFile(filename);
156
+ if (!json)
157
+ return json;
158
+ const parsed = JSON.parse(json);
159
+ let modified = false;
160
+ recurse2(parsed.imports);
161
+ return modified ? JSON.stringify(parsed) : json;
162
+ }
136
163
  if (!filename.endsWith(".civet.tsx"))
137
164
  return systemReadFile(filename);
138
165
  if (fsMap.has(filename))
@@ -183,6 +210,9 @@ var rawPlugin = (options = {}, meta) => {
183
210
  start: range.start
184
211
  };
185
212
  });
213
+ if (configErrors?.length) {
214
+ diagnostics.unshift(...configErrors);
215
+ }
186
216
  if (diagnostics.length > 0) {
187
217
  console.error(
188
218
  ts.formatDiagnosticsWithColorAndContext(
package/dist/unplugin.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(
package/dist/vite.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(
package/dist/webpack.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(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
3
  "type": "commonjs",
4
- "version": "0.7.12",
4
+ "version": "0.7.14",
5
5
  "description": "CoffeeScript style syntax for TypeScript",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/main.mjs",
@@ -64,13 +64,14 @@
64
64
  "docs:build": "yarn build && vitepress build civet.dev",
65
65
  "docs:preview": "yarn build && vitepress preview civet.dev",
66
66
  "prepublishOnly": "yarn build && yarn test",
67
- "test": "bash ./build/test.sh"
67
+ "test": "bash ./build/test.sh",
68
+ "test:self": "yarn build && mocha --config .mocharc-self.json"
68
69
  },
69
70
  "author": "Daniel X. Moore",
70
71
  "license": "MIT",
71
72
  "dependencies": {
72
73
  "@cspotcode/source-map-support": "^0.8.1",
73
- "@typescript/vfs": "^1.5.0",
74
+ "@typescript/vfs": "^1.5.3",
74
75
  "unplugin": "^1.6.0"
75
76
  },
76
77
  "devDependencies": {
@@ -89,7 +90,7 @@
89
90
  "ts-node": "^10.9.1",
90
91
  "tslib": "^2.4.0",
91
92
  "tsup": "^7.2.0",
92
- "typescript": "^5.4.5",
93
+ "typescript": "^5.5.2",
93
94
  "vite": "^4.4.12",
94
95
  "vitepress": "^1.0.0-alpha.35",
95
96
  "vscode-languageserver": "^8.1.0",
@@ -97,7 +98,13 @@
97
98
  "vue": "^3.2.45"
98
99
  },
99
100
  "peerDependencies": {
100
- "typescript": "^4.5 || ^5.0"
101
+ "typescript": "^4.5 || ^5.0",
102
+ "yaml": "^2.4.5"
103
+ },
104
+ "peerDependenciesMeta": {
105
+ "yaml": {
106
+ "optional": true
107
+ }
101
108
  },
102
109
  "c8": {
103
110
  "all": true,
@@ -122,19 +129,5 @@
122
129
  "source/bun-civet.civet"
123
130
  ]
124
131
  },
125
- "mocha": {
126
- "extension": [
127
- "civet",
128
- "coffee"
129
- ],
130
- "loader": [
131
- "@danielx/hera/esm",
132
- "./node_modules/@danielx/civet/dist/esm.mjs"
133
- ],
134
- "reporter": "dot",
135
- "recursive": true,
136
- "spec": [
137
- "test"
138
- ]
139
- }
132
+ "packageManager": "yarn@1.22.21+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72"
140
133
  }