@lynxwall/cucumber-tsflow 7.2.0 → 7.3.1
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/README.md +59 -35
- package/lib/api/load-configuration.js +60 -16
- package/lib/api/load-configuration.js.map +1 -1
- package/lib/bindings/binding-context.d.ts +40 -4
- package/lib/bindings/binding-context.js +50 -6
- package/lib/bindings/binding-context.js.map +1 -1
- package/lib/bindings/binding-decorator.js +32 -9
- package/lib/bindings/binding-decorator.js.map +1 -1
- package/lib/bindings/binding-registry.js +10 -0
- package/lib/bindings/binding-registry.js.map +1 -1
- package/lib/bindings/hook-decorators.js +4 -3
- package/lib/bindings/hook-decorators.js.map +1 -1
- package/lib/bindings/step-decorators.js +12 -9
- package/lib/bindings/step-decorators.js.map +1 -1
- package/lib/cli/argv-parser.js +1 -2
- package/lib/cli/argv-parser.js.map +1 -1
- package/lib/runtime/parallel/worker.js +1 -1
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/test-case-runner.d.ts +2 -1
- package/lib/runtime/test-case-runner.js +8 -5
- package/lib/runtime/test-case-runner.js.map +1 -1
- package/lib/transpilers/esbuild-transpiler.d.ts +1 -1
- package/lib/transpilers/esbuild-transpiler.js.map +1 -1
- package/lib/transpilers/esbuild.js.map +1 -1
- package/lib/transpilers/esm/esbuild-transpiler-cjs.js +2174 -0
- package/lib/transpilers/esm/esbuild-transpiler.mjs +19 -0
- package/lib/transpilers/esm/esbuild.mjs +141 -0
- package/lib/transpilers/esm/esmbuild-transpiler.d.ts +4 -0
- package/lib/transpilers/esm/esmbuild-transpiler.js +19 -0
- package/lib/transpilers/esm/esmbuild-transpiler.js.map +1 -0
- package/lib/transpilers/esm/esmbuild.d.ts +12 -0
- package/lib/transpilers/esm/esmbuild.js +72 -0
- package/lib/transpilers/esm/esmbuild.js.map +1 -0
- package/lib/transpilers/esm/esmnode.d.ts +1 -0
- package/lib/transpilers/esm/esmnode.js +8 -0
- package/lib/transpilers/esm/esmnode.js.map +1 -0
- package/lib/transpilers/esm/esmvue.d.ts +1 -0
- package/lib/transpilers/esm/esmvue.js +29 -0
- package/lib/transpilers/esm/esmvue.js.map +1 -0
- package/lib/transpilers/esm/esnode-loader.mjs +9 -0
- package/lib/transpilers/esm/esvue-loader.mjs +9 -0
- package/lib/transpilers/esm/loader-utils.mjs +356 -0
- package/lib/transpilers/esm/tsnode-esm.d.ts +1 -0
- package/lib/transpilers/esm/tsnode-esm.js +25 -0
- package/lib/transpilers/esm/tsnode-esm.js.map +1 -0
- package/lib/transpilers/esm/tsnode-exp-esm.d.ts +1 -0
- package/lib/transpilers/esm/tsnode-exp-esm.js +19 -0
- package/lib/transpilers/esm/tsnode-exp-esm.js.map +1 -0
- package/lib/transpilers/esm/tsnode-loader.mjs +107 -0
- package/lib/transpilers/esm/tsnode-service.mjs +40 -0
- package/lib/transpilers/esm/tsvue-esm.d.ts +1 -0
- package/lib/transpilers/esm/tsvue-esm.js +40 -0
- package/lib/transpilers/esm/tsvue-esm.js.map +1 -0
- package/lib/transpilers/esm/tsvue-exp-esm.d.ts +1 -0
- package/lib/transpilers/esm/tsvue-exp-esm.js +40 -0
- package/lib/transpilers/esm/tsvue-exp-esm.js.map +1 -0
- package/lib/transpilers/esm/vue-jsdom-setup.mjs +19 -0
- package/lib/transpilers/esm/vue-loader.mjs +113 -0
- package/lib/transpilers/esm/vue-sfc-compiler.mjs +216 -0
- package/lib/transpilers/esnode.js +1 -1
- package/lib/transpilers/esnode.js.map +1 -1
- package/lib/transpilers/esvue.js +1 -1
- package/lib/transpilers/esvue.js.map +1 -1
- package/lib/transpilers/tsnode-exp.js +1 -1
- package/lib/transpilers/tsnode-exp.js.map +1 -1
- package/lib/transpilers/tsnode.js +1 -1
- package/lib/transpilers/tsnode.js.map +1 -1
- package/lib/transpilers/tsvue-exp.js +1 -1
- package/lib/transpilers/tsvue-exp.js.map +1 -1
- package/lib/transpilers/tsvue.js +2 -2
- package/lib/transpilers/tsvue.js.map +1 -1
- package/lib/transpilers/vue-sfc/index.js.map +1 -1
- package/lib/tsconfig.node.tsbuildinfo +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +27 -17
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// This file gets transpiled to CJS via scripts/build-esm-transpiler-cjs as part of the build
|
|
2
|
+
|
|
3
|
+
import { transpileCode } from './esbuild.mjs';
|
|
4
|
+
|
|
5
|
+
export function create(_createOptions) {
|
|
6
|
+
return {
|
|
7
|
+
transpile(input, options) {
|
|
8
|
+
const result = transpileCode(input, options.fileName);
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
outputText: result.output,
|
|
12
|
+
sourceMapText: result.sourceMap
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Also export as default in case ts-node expects that
|
|
19
|
+
export default { create };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { transformSync } from 'esbuild';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { loadConfig } from 'tsconfig-paths';
|
|
4
|
+
import { pathToFileURL } from 'url';
|
|
5
|
+
|
|
6
|
+
export const defaultOptions = {
|
|
7
|
+
debug: true
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// Cache for tsconfig data
|
|
11
|
+
let tsconfigCache = null;
|
|
12
|
+
|
|
13
|
+
function loadTsConfigPaths() {
|
|
14
|
+
if (tsconfigCache) return tsconfigCache;
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const configLoaderResult = loadConfig(process.cwd());
|
|
18
|
+
if (configLoaderResult.resultType === 'success') {
|
|
19
|
+
tsconfigCache = {
|
|
20
|
+
absoluteBaseUrl: configLoaderResult.absoluteBaseUrl,
|
|
21
|
+
paths: configLoaderResult.paths
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error('Failed to load tsconfig for aliases:', error);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return tsconfigCache || { paths: {} };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Add this function to handle path replacements
|
|
32
|
+
function rewritePathMappings(code) {
|
|
33
|
+
const { absoluteBaseUrl, paths } = loadTsConfigPaths();
|
|
34
|
+
|
|
35
|
+
if (!paths || !absoluteBaseUrl) return code;
|
|
36
|
+
|
|
37
|
+
let modifiedCode = code;
|
|
38
|
+
|
|
39
|
+
// Process each path mapping
|
|
40
|
+
for (const [pattern, replacements] of Object.entries(paths)) {
|
|
41
|
+
// Convert @fixtures/* to a regex pattern
|
|
42
|
+
const searchPattern = pattern.replace('/*', '');
|
|
43
|
+
const replacementPath = replacements[0].replace('/*', '');
|
|
44
|
+
|
|
45
|
+
// Create regex to match imports/exports
|
|
46
|
+
const regex = new RegExp(`(from\\s+['"])${searchPattern}(/[^'"]+)?(['"])`, 'g');
|
|
47
|
+
|
|
48
|
+
modifiedCode = modifiedCode.replace(regex, (match, prefix, subPath, suffix) => {
|
|
49
|
+
// If subPath is provided, remove leading slash
|
|
50
|
+
const pathSuffix = subPath ? subPath.substring(1) : '';
|
|
51
|
+
// Calculate the absolute path
|
|
52
|
+
const absolutePath = path.resolve(absoluteBaseUrl, replacementPath, pathSuffix);
|
|
53
|
+
// Convert to file URL for ESM
|
|
54
|
+
const fileUrl = pathToFileURL(absolutePath).href;
|
|
55
|
+
|
|
56
|
+
return `${prefix}${fileUrl}${suffix}`;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return modifiedCode;
|
|
61
|
+
}
|
|
62
|
+
const commonOptions = {
|
|
63
|
+
format: 'esm',
|
|
64
|
+
logLevel: 'info',
|
|
65
|
+
target: ['es2022'],
|
|
66
|
+
minify: false,
|
|
67
|
+
sourcemap: 'external',
|
|
68
|
+
platform: 'node'
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
if (process.env.CUCUMBER_EXPERIMENTAL_DECORATORS === 'true') {
|
|
72
|
+
commonOptions.tsconfigRaw = {
|
|
73
|
+
compilerOptions: {
|
|
74
|
+
experimentalDecorators: true,
|
|
75
|
+
importsNotUsedAsValues: 'remove',
|
|
76
|
+
strict: true
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
} else {
|
|
80
|
+
commonOptions.tsconfigRaw = {
|
|
81
|
+
compilerOptions: {
|
|
82
|
+
importsNotUsedAsValues: 'remove',
|
|
83
|
+
strict: true
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const loaders = {
|
|
89
|
+
'.js': 'js',
|
|
90
|
+
'.mjs': 'js',
|
|
91
|
+
'.cjs': 'js',
|
|
92
|
+
'.jsx': 'jsx',
|
|
93
|
+
'.ts': 'ts',
|
|
94
|
+
'.tsx': 'tsx',
|
|
95
|
+
'.json': 'json'
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const supports = filename => {
|
|
99
|
+
// Don't transpile TypeScript files - they're handled by TypeScript compiler
|
|
100
|
+
if (filename.endsWith('.ts') || filename.endsWith('.tsx')) return false;
|
|
101
|
+
|
|
102
|
+
// Don't transpile cucumber-tsflow's lib files - they're CommonJS
|
|
103
|
+
if (filename.includes('cucumber-tsflow/lib') || filename.includes('cucumber-tsflow\\lib')) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Don't transpile node_modules
|
|
108
|
+
if (filename.includes('node_modules')) return false;
|
|
109
|
+
|
|
110
|
+
// Only transpile files in the test project
|
|
111
|
+
if (!filename.includes('cucumber-tsflow-specs')) return false;
|
|
112
|
+
|
|
113
|
+
return path.extname(filename) in loaders;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const getLoaders = options => {
|
|
117
|
+
const ret = { ...loaders };
|
|
118
|
+
if (typeof options.esbuild?.loader === 'object') {
|
|
119
|
+
for (const [e, l] of Object.entries(options.esbuild.loader)) ret[e] = l;
|
|
120
|
+
}
|
|
121
|
+
return ret;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// In esbuild.mjs
|
|
125
|
+
export const transpileCode = (code, filename, ext, _options) => {
|
|
126
|
+
const options = { ...defaultOptions, ..._options };
|
|
127
|
+
const loadersMap = getLoaders(options);
|
|
128
|
+
const loaderExt = ext != undefined ? ext : path.extname(filename);
|
|
129
|
+
|
|
130
|
+
// Rewrite path mappings before transpiling
|
|
131
|
+
let processedCode = rewritePathMappings(code);
|
|
132
|
+
|
|
133
|
+
const ret = transformSync(processedCode, {
|
|
134
|
+
...commonOptions,
|
|
135
|
+
...(options.esbuild || {}),
|
|
136
|
+
loader: loadersMap[loaderExt],
|
|
137
|
+
sourcefile: filename
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
return { output: ret.code, sourceMap: ret.map };
|
|
141
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EsmbuildTranspiler = void 0;
|
|
4
|
+
const esmbuild_1 = require("./esmbuild");
|
|
5
|
+
const create = (_createOptions) => {
|
|
6
|
+
return new EsmbuildTranspiler();
|
|
7
|
+
};
|
|
8
|
+
class EsmbuildTranspiler {
|
|
9
|
+
transpile = (input, options) => {
|
|
10
|
+
const result = (0, esmbuild_1.transpileCode)(input, options.fileName);
|
|
11
|
+
return {
|
|
12
|
+
outputText: result.output,
|
|
13
|
+
sourceMapText: result.sourceMap
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
exports.EsmbuildTranspiler = EsmbuildTranspiler;
|
|
18
|
+
exports.create = create;
|
|
19
|
+
//# sourceMappingURL=esmbuild-transpiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esmbuild-transpiler.js","sourceRoot":"","sources":["../../../src/transpilers/esm/esmbuild-transpiler.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAE3C,MAAM,MAAM,GAAG,CAAC,cAAuC,EAAc,EAAE;IACtE,OAAO,IAAI,kBAAkB,EAAE,CAAC;AACjC,CAAC,CAAC;AAEF,MAAa,kBAAkB;IAC9B,SAAS,GAAG,CAAC,KAAa,EAAE,OAAyB,EAAmB,EAAE;QACzE,MAAM,MAAM,GAAG,IAAA,wBAAa,EAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEtD,OAAO;YACN,UAAU,EAAE,MAAM,CAAC,MAAM;YACzB,aAAa,EAAE,MAAM,CAAC,SAAS;SACZ,CAAC;IACtB,CAAC,CAAC;CACF;AATD,gDASC;AAED,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC","sourcesContent":["import { CreateTranspilerOptions, TranspileOptions, Transpiler, TranspileOutput } from 'ts-node';\r\nimport { transpileCode } from './esmbuild';\r\n\r\nconst create = (_createOptions: CreateTranspilerOptions): Transpiler => {\r\n\treturn new EsmbuildTranspiler();\r\n};\r\n\r\nexport class EsmbuildTranspiler implements Transpiler {\r\n\ttranspile = (input: string, options: TranspileOptions): TranspileOutput => {\r\n\t\tconst result = transpileCode(input, options.fileName);\r\n\r\n\t\treturn {\r\n\t\t\toutputText: result.output,\r\n\t\t\tsourceMapText: result.sourceMap\r\n\t\t} as TranspileOutput;\r\n\t};\r\n}\r\n\r\nexports.create = create;\r\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Loader, CommonOptions, TransformOptions, BuildOptions } from 'esbuild';
|
|
2
|
+
export type TranspileOptions = {
|
|
3
|
+
debug: boolean;
|
|
4
|
+
esbuild?: CommonOptions & TransformOptions & BuildOptions;
|
|
5
|
+
};
|
|
6
|
+
export type TranspileResults = {
|
|
7
|
+
output: string;
|
|
8
|
+
sourceMap?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const loaders: Record<string, Loader>;
|
|
11
|
+
export declare const supports: (filename: string) => boolean;
|
|
12
|
+
export declare const transpileCode: (code: string, filename: string, ext?: string, _options?: Partial<TranspileOptions>) => TranspileResults;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.transpileCode = exports.supports = exports.loaders = void 0;
|
|
7
|
+
const esbuild_1 = require("esbuild");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const defaultOptions = {
|
|
10
|
+
debug: true
|
|
11
|
+
};
|
|
12
|
+
const commonOptions = {
|
|
13
|
+
format: 'esm',
|
|
14
|
+
logLevel: 'info',
|
|
15
|
+
target: [`esnext`],
|
|
16
|
+
minify: false,
|
|
17
|
+
sourcemap: 'external'
|
|
18
|
+
};
|
|
19
|
+
if (global.experimentalDecorators) {
|
|
20
|
+
commonOptions.tsconfigRaw = {
|
|
21
|
+
compilerOptions: {
|
|
22
|
+
experimentalDecorators: true,
|
|
23
|
+
importsNotUsedAsValues: 'remove',
|
|
24
|
+
strict: true
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
commonOptions.tsconfigRaw = {
|
|
30
|
+
compilerOptions: {
|
|
31
|
+
importsNotUsedAsValues: 'remove',
|
|
32
|
+
strict: true
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
exports.loaders = {
|
|
37
|
+
'.js': 'js',
|
|
38
|
+
'.mjs': 'js',
|
|
39
|
+
'.cjs': 'js',
|
|
40
|
+
'.jsx': 'jsx',
|
|
41
|
+
'.ts': 'ts',
|
|
42
|
+
'.tsx': 'tsx',
|
|
43
|
+
'.json': 'json'
|
|
44
|
+
};
|
|
45
|
+
const supports = (filename) => {
|
|
46
|
+
if (filename.includes('node_modules') || filename.includes('cucumber-tsflow/lib'))
|
|
47
|
+
return false;
|
|
48
|
+
return path_1.default.extname(filename) in exports.loaders;
|
|
49
|
+
};
|
|
50
|
+
exports.supports = supports;
|
|
51
|
+
const getLoaders = (options) => {
|
|
52
|
+
const ret = { ...exports.loaders };
|
|
53
|
+
if (typeof options.esbuild?.loader == 'object') {
|
|
54
|
+
for (const [e, l] of Object.entries(options.esbuild.loader))
|
|
55
|
+
ret[e] = l;
|
|
56
|
+
}
|
|
57
|
+
return ret;
|
|
58
|
+
};
|
|
59
|
+
const transpileCode = (code, filename, ext, _options) => {
|
|
60
|
+
const options = { ...defaultOptions, ..._options };
|
|
61
|
+
const loaders = getLoaders(options);
|
|
62
|
+
const loaderExt = ext != undefined ? ext : path_1.default.extname(filename);
|
|
63
|
+
const ret = (0, esbuild_1.transformSync)(code, {
|
|
64
|
+
...commonOptions,
|
|
65
|
+
...options.esbuild,
|
|
66
|
+
loader: loaders[loaderExt],
|
|
67
|
+
sourcefile: filename
|
|
68
|
+
});
|
|
69
|
+
return { output: ret.code, sourceMap: ret.map };
|
|
70
|
+
};
|
|
71
|
+
exports.transpileCode = transpileCode;
|
|
72
|
+
//# sourceMappingURL=esmbuild.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esmbuild.js","sourceRoot":"","sources":["../../../src/transpilers/esm/esmbuild.ts"],"names":[],"mappings":";;;;;;AAAA,qCAA+F;AAC/F,gDAAwB;AAMxB,MAAM,cAAc,GAAqB;IACxC,KAAK,EAAE,IAAI;CACX,CAAC;AAEF,MAAM,aAAa,GAAkB;IACpC,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE,CAAC,QAAQ,CAAC;IAClB,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,UAAU;CACrB,CAAC;AAEF,IAAI,MAAM,CAAC,sBAAsB,EAAE,CAAC;IACnC,aAAa,CAAC,WAAW,GAAG;QAC3B,eAAe,EAAE;YAChB,sBAAsB,EAAE,IAAI;YAC5B,sBAAsB,EAAE,QAAQ;YAChC,MAAM,EAAE,IAAI;SACZ;KACD,CAAC;AACH,CAAC;KAAM,CAAC;IACP,aAAa,CAAC,WAAW,GAAG;QAC3B,eAAe,EAAE;YAChB,sBAAsB,EAAE,QAAQ;YAChC,MAAM,EAAE,IAAI;SACZ;KACD,CAAC;AACH,CAAC;AAOY,QAAA,OAAO,GAA2B;IAC9C,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,MAAM;CACf,CAAC;AAEK,MAAM,QAAQ,GAAG,CAAC,QAAgB,EAAE,EAAE;IAC5C,IAAI,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,qBAAqB,CAAC;QAAE,OAAO,KAAK,CAAC;IAChG,OAAO,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,eAAO,CAAC;AAC1C,CAAC,CAAC;AAHW,QAAA,QAAQ,YAGnB;AAEF,MAAM,UAAU,GAAG,CAAC,OAAyB,EAAE,EAAE;IAChD,MAAM,GAAG,GAAG,EAAE,GAAG,eAAO,EAAE,CAAC;IAC3B,IAAI,OAAO,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,CAAC;QAChD,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAW,CAAC;IACnF,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC,CAAC;AAEK,MAAM,aAAa,GAAG,CAC5B,IAAY,EACZ,QAAgB,EAChB,GAAY,EACZ,QAAoC,EACjB,EAAE;IACrB,MAAM,OAAO,GAAqB,EAAE,GAAG,cAAc,EAAE,GAAG,QAAQ,EAAE,CAAC;IACrE,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAElE,MAAM,GAAG,GAAG,IAAA,uBAAa,EAAC,IAAI,EAAE;QAC/B,GAAG,aAAa;QAChB,GAAI,OAAO,CAAC,OAAwC;QACpD,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC;QAC1B,UAAU,EAAE,QAAQ;KACpB,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;AACjD,CAAC,CAAC;AAjBW,QAAA,aAAa,iBAiBxB","sourcesContent":["import { Loader, transformSync, CommonOptions, TransformOptions, BuildOptions } from 'esbuild';\r\nimport path from 'path';\r\n\r\nexport type TranspileOptions = {\r\n\tdebug: boolean;\r\n\tesbuild?: CommonOptions & TransformOptions & BuildOptions;\r\n};\r\nconst defaultOptions: TranspileOptions = {\r\n\tdebug: true\r\n};\r\n\r\nconst commonOptions: CommonOptions = {\r\n\tformat: 'esm',\r\n\tlogLevel: 'info',\r\n\ttarget: [`esnext`],\r\n\tminify: false,\r\n\tsourcemap: 'external'\r\n};\r\n\r\nif (global.experimentalDecorators) {\r\n\tcommonOptions.tsconfigRaw = {\r\n\t\tcompilerOptions: {\r\n\t\t\texperimentalDecorators: true,\r\n\t\t\timportsNotUsedAsValues: 'remove',\r\n\t\t\tstrict: true\r\n\t\t}\r\n\t};\r\n} else {\r\n\tcommonOptions.tsconfigRaw = {\r\n\t\tcompilerOptions: {\r\n\t\t\timportsNotUsedAsValues: 'remove',\r\n\t\t\tstrict: true\r\n\t\t}\r\n\t};\r\n}\r\n\r\nexport type TranspileResults = {\r\n\toutput: string;\r\n\tsourceMap?: string;\r\n};\r\n\r\nexport const loaders: Record<string, Loader> = {\r\n\t'.js': 'js',\r\n\t'.mjs': 'js',\r\n\t'.cjs': 'js',\r\n\t'.jsx': 'jsx',\r\n\t'.ts': 'ts',\r\n\t'.tsx': 'tsx',\r\n\t'.json': 'json'\r\n};\r\n\r\nexport const supports = (filename: string) => {\r\n\tif (filename.includes('node_modules') || filename.includes('cucumber-tsflow/lib')) return false;\r\n\treturn path.extname(filename) in loaders;\r\n};\r\n\r\nconst getLoaders = (options: TranspileOptions) => {\r\n\tconst ret = { ...loaders };\r\n\tif (typeof options.esbuild?.loader == 'object') {\r\n\t\tfor (const [e, l] of Object.entries(options.esbuild.loader)) ret[e] = l as Loader;\r\n\t}\r\n\treturn ret;\r\n};\r\n\r\nexport const transpileCode = (\r\n\tcode: string,\r\n\tfilename: string,\r\n\text?: string,\r\n\t_options?: Partial<TranspileOptions>\r\n): TranspileResults => {\r\n\tconst options: TranspileOptions = { ...defaultOptions, ..._options };\r\n\tconst loaders = getLoaders(options);\r\n\tconst loaderExt = ext != undefined ? ext : path.extname(filename);\r\n\r\n\tconst ret = transformSync(code, {\r\n\t\t...commonOptions,\r\n\t\t...(options.esbuild as TransformOptions | undefined),\r\n\t\tloader: loaders[loaderExt],\r\n\t\tsourcefile: filename\r\n\t});\r\n\treturn { output: ret.code, sourceMap: ret.map };\r\n};\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require('ts-node/esm').register({
|
|
4
|
+
transpileOnly: true,
|
|
5
|
+
transpiler: '@lynxwall/cucumber-tsflow/lib/transpilers/esm/esmbuild-transpiler'
|
|
6
|
+
});
|
|
7
|
+
require('tsconfig-paths').register();
|
|
8
|
+
//# sourceMappingURL=esmnode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esmnode.js","sourceRoot":"","sources":["../../../src/transpilers/esm/esmnode.ts"],"names":[],"mappings":";;AAAA,OAAO,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC;IAC/B,aAAa,EAAE,IAAI;IACnB,UAAU,EAAE,mEAAmE;CAC/E,CAAC,CAAC;AAEH,OAAO,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE,CAAC","sourcesContent":["require('ts-node/esm').register({\r\n\ttranspileOnly: true,\r\n\ttranspiler: '@lynxwall/cucumber-tsflow/lib/transpilers/esm/esmbuild-transpiler'\r\n});\r\n\r\nrequire('tsconfig-paths').register();\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const hooks = require('require-extension-hooks');
|
|
7
|
+
const vue_sfc_1 = __importDefault(require("../vue-sfc"));
|
|
8
|
+
require('ts-node/esm').register({
|
|
9
|
+
transpileOnly: true,
|
|
10
|
+
transpiler: '@lynxwall/cucumber-tsflow/lib/transpilers/esm/esmbuild-transpiler'
|
|
11
|
+
});
|
|
12
|
+
require('tsconfig-paths').register();
|
|
13
|
+
// Register jsdom globally and set SVGElement on global
|
|
14
|
+
require('jsdom-global')();
|
|
15
|
+
global.SVGElement = global.window.SVGElement;
|
|
16
|
+
hooks('vue').push(function (params) {
|
|
17
|
+
try {
|
|
18
|
+
const transformer = new vue_sfc_1.default({
|
|
19
|
+
exclude: ['(?:^|/)node_modules/', '(?:^|/)cucumber-tsflow/lib/']
|
|
20
|
+
});
|
|
21
|
+
const transformResult = transformer.transformCode(params.content, params.filename);
|
|
22
|
+
return transformResult.code;
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
console.log(err);
|
|
26
|
+
}
|
|
27
|
+
return params.content;
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=esmvue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esmvue.js","sourceRoot":"","sources":["../../../src/transpilers/esm/esmvue.ts"],"names":[],"mappings":";;;;;AAAA,MAAM,KAAK,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AACjD,yDAAwC;AAExC,OAAO,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC;IAC/B,aAAa,EAAE,IAAI;IACnB,UAAU,EAAE,mEAAmE;CAC/E,CAAC,CAAC;AAEH,OAAO,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE,CAAC;AAErC,uDAAuD;AACvD,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;AACzB,MAAc,CAAC,UAAU,GAAI,MAAc,CAAC,MAAM,CAAC,UAAU,CAAC;AAE/D,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,UAAU,MAAW;IACtC,IAAI,CAAC;QACJ,MAAM,WAAW,GAAG,IAAI,iBAAc,CAAC;YACtC,OAAO,EAAE,CAAC,sBAAsB,EAAE,6BAA6B,CAAC;SAChE,CAAC,CAAC;QACH,MAAM,eAAe,GAAG,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEnF,OAAO,eAAe,CAAC,IAAI,CAAC;IAC7B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC;AACvB,CAAC,CAAC,CAAC","sourcesContent":["const hooks = require('require-extension-hooks');\r\nimport VueTransformer from '../vue-sfc';\r\n\r\nrequire('ts-node/esm').register({\r\n\ttranspileOnly: true,\r\n\ttranspiler: '@lynxwall/cucumber-tsflow/lib/transpilers/esm/esmbuild-transpiler'\r\n});\r\n\r\nrequire('tsconfig-paths').register();\r\n\r\n// Register jsdom globally and set SVGElement on global\r\nrequire('jsdom-global')();\r\n(global as any).SVGElement = (global as any).window.SVGElement;\r\n\r\nhooks('vue').push(function (params: any) {\r\n\ttry {\r\n\t\tconst transformer = new VueTransformer({\r\n\t\t\texclude: ['(?:^|/)node_modules/', '(?:^|/)cucumber-tsflow/lib/']\r\n\t\t});\r\n\t\tconst transformResult = transformer.transformCode(params.content, params.filename);\r\n\r\n\t\treturn transformResult.code;\r\n\t} catch (err) {\r\n\t\tconsole.log(err);\r\n\t}\r\n\treturn params.content;\r\n});\r\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createEsbuildLoader } from './loader-utils.mjs';
|
|
2
|
+
|
|
3
|
+
// Create and export the loader with default options
|
|
4
|
+
const loader = createEsbuildLoader({
|
|
5
|
+
loaderName: 'esnode-loader',
|
|
6
|
+
handleVue: false
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const { resolve, load, getFormat, transformSource } = loader;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createEsbuildLoader } from './loader-utils.mjs';
|
|
2
|
+
|
|
3
|
+
// Create and export the loader with Vue support
|
|
4
|
+
const loader = createEsbuildLoader({
|
|
5
|
+
loaderName: 'esvue-loader',
|
|
6
|
+
handleVue: true
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const { resolve, load, getFormat, transformSource } = loader;
|