@lynxwall/cucumber-tsflow 7.3.1 → 7.3.2

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.
@@ -212,6 +212,42 @@ export async function loadVue(url, context, nextLoad) {
212
212
  };
213
213
  }
214
214
 
215
+ // Common load handlers
216
+ export async function loadJson(url, context, nextLoad) {
217
+ const result = await nextLoad(url, {
218
+ ...context,
219
+ format: 'json',
220
+ importAttributes: { type: 'json' }
221
+ });
222
+
223
+ return {
224
+ ...result,
225
+ format: 'json',
226
+ shortCircuit: true
227
+ };
228
+ }
229
+
230
+ // loader-utils.mjs - Add a simple common file handler
231
+ export function handleCommonFileTypes(url, context, nextLoad, loaderName) {
232
+ // Handle assets
233
+ const ext = path.extname(url).toLowerCase();
234
+ if (ASSET_EXTENSIONS.includes(ext)) {
235
+ return loadAsset(url);
236
+ }
237
+
238
+ // Handle JSON
239
+ if (url.endsWith('.json')) {
240
+ try {
241
+ return loadJson(url, context, nextLoad);
242
+ } catch (error) {
243
+ console.error(`>>> ${loaderName}: Failed to compile ${url}:`, error);
244
+ throw new Error(`Failed to compile ${url}: ${error.message}`);
245
+ }
246
+ }
247
+
248
+ return null; // Not a common file type
249
+ }
250
+
215
251
  /**
216
252
  * Resolves module specifiers with support for TypeScript paths, extensions, and more
217
253
  * @param {string} specifier - The module specifier to resolve
@@ -321,11 +357,9 @@ export function createEsbuildLoader(options = {}) {
321
357
  },
322
358
 
323
359
  load: async (url, context, nextLoad) => {
324
- // Handle asset files
325
- const ext = path.extname(url).toLowerCase();
326
- if (ASSET_EXTENSIONS.includes(ext)) {
327
- return loadAsset(url);
328
- }
360
+ // Check common file types first
361
+ const commonResult = await handleCommonFileTypes(url, context, nextLoad);
362
+ if (commonResult) return commonResult;
329
363
 
330
364
  // Handle Vue files if enabled
331
365
  if (handleVue && url.endsWith('.vue')) {
@@ -37,8 +37,7 @@
37
37
  * preprocessor packages to be installed. Missing preprocessors will be skipped
38
38
  * with a warning rather than failing the compilation.
39
39
  */
40
- import path from 'path';
41
- import { ASSET_EXTENSIONS, resolveSpecifier, loadAsset, loadVue } from './loader-utils.mjs';
40
+ import { resolveSpecifier, loadVue, handleCommonFileTypes } from './loader-utils.mjs';
42
41
 
43
42
  // Cache for the TypeScript loader
44
43
  let tsLoader;
@@ -65,11 +64,9 @@ async function getTsLoader() {
65
64
  }
66
65
 
67
66
  export async function load(url, context, nextLoad) {
68
- // Handle asset files that Vue compiler turns into imports
69
- const ext = path.extname(url).toLowerCase();
70
- if (ASSET_EXTENSIONS.includes(ext)) {
71
- return loadAsset(url);
72
- }
67
+ // Check common file types first
68
+ const commonResult = await handleCommonFileTypes(url, context, nextLoad);
69
+ if (commonResult) return commonResult;
73
70
 
74
71
  // Only process .vue files directly
75
72
  if (url.endsWith('.vue')) {
package/lib/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "7.3.1";
1
+ export declare const version = "7.3.2";
package/lib/version.js CHANGED
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // Generated by genversion.
5
- exports.version = '7.3.1';
5
+ exports.version = '7.3.2';
6
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,OAAO,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '7.3.1'\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,OAAO,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '7.3.2'\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lynxwall/cucumber-tsflow",
3
3
  "description": "Provides 'specflow' like bindings for CucumberJS 11.2.0 in TypeScript 5.8+.",
4
- "version": "7.3.1",
4
+ "version": "7.3.2",
5
5
  "author": "Lonnie Wall <lynxdev@lynxwall.com>",
6
6
  "license": "MIT",
7
7
  "keywords": [