@lynxwall/cucumber-tsflow 7.5.5 → 7.7.0

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.
Files changed (107) hide show
  1. package/README.md +287 -234
  2. package/lib/api/convert-configuration.d.ts +1 -0
  3. package/lib/api/convert-configuration.js +2 -0
  4. package/lib/api/convert-configuration.js.map +1 -1
  5. package/lib/api/load-configuration.js +22 -33
  6. package/lib/api/load-configuration.js.map +1 -1
  7. package/lib/api/load-support.d.ts +24 -1
  8. package/lib/api/load-support.js +140 -3
  9. package/lib/api/load-support.js.map +1 -1
  10. package/lib/api/loader-worker.d.ts +25 -0
  11. package/lib/api/loader-worker.js +70 -0
  12. package/lib/api/loader-worker.js.map +1 -0
  13. package/lib/api/parallel-loader.d.ts +31 -0
  14. package/lib/api/parallel-loader.js +169 -0
  15. package/lib/api/parallel-loader.js.map +1 -0
  16. package/lib/api/run-cucumber.js +42 -12
  17. package/lib/api/run-cucumber.js.map +1 -1
  18. package/lib/api/support.js +3 -0
  19. package/lib/api/support.js.map +1 -1
  20. package/lib/api/wrapper.mjs +1 -0
  21. package/lib/bindings/binding-decorator.d.ts +6 -0
  22. package/lib/bindings/binding-decorator.js +14 -0
  23. package/lib/bindings/binding-decorator.js.map +1 -1
  24. package/lib/bindings/binding-registry.d.ts +31 -1
  25. package/lib/bindings/binding-registry.js +95 -47
  26. package/lib/bindings/binding-registry.js.map +1 -1
  27. package/lib/bindings/step-binding.d.ts +37 -0
  28. package/lib/bindings/step-binding.js +23 -0
  29. package/lib/bindings/step-binding.js.map +1 -1
  30. package/lib/bindings/types.js.map +1 -1
  31. package/lib/cli/argv-parser.d.ts +1 -0
  32. package/lib/cli/argv-parser.js +6 -0
  33. package/lib/cli/argv-parser.js.map +1 -1
  34. package/lib/formatter/{step-definition-snippit-syntax → step-definition-snippet-syntax}/tsflow-snippet-syntax.js.map +1 -1
  35. package/lib/index.d.ts +1 -1
  36. package/lib/index.js +1 -1
  37. package/lib/index.js.map +1 -1
  38. package/lib/runtime/coordinator.d.ts +2 -1
  39. package/lib/runtime/coordinator.js +4 -2
  40. package/lib/runtime/coordinator.js.map +1 -1
  41. package/lib/runtime/make-runtime.d.ts +3 -1
  42. package/lib/runtime/make-runtime.js +5 -4
  43. package/lib/runtime/make-runtime.js.map +1 -1
  44. package/lib/runtime/managed-scenario-context.js +2 -32
  45. package/lib/runtime/managed-scenario-context.js.map +1 -1
  46. package/lib/runtime/parallel/adapter.d.ts +4 -1
  47. package/lib/runtime/parallel/adapter.js +10 -2
  48. package/lib/runtime/parallel/adapter.js.map +1 -1
  49. package/lib/runtime/serial/adapter.d.ts +2 -1
  50. package/lib/runtime/serial/adapter.js +13 -3
  51. package/lib/runtime/serial/adapter.js.map +1 -1
  52. package/lib/runtime/test-case-runner.d.ts +4 -1
  53. package/lib/runtime/test-case-runner.js +4 -5
  54. package/lib/runtime/test-case-runner.js.map +1 -1
  55. package/lib/runtime/types.d.ts +2 -0
  56. package/lib/runtime/types.js.map +1 -1
  57. package/lib/runtime/utils.js +0 -6
  58. package/lib/runtime/utils.js.map +1 -1
  59. package/lib/runtime/worker.d.ts +14 -3
  60. package/lib/runtime/worker.js +91 -12
  61. package/lib/runtime/worker.js.map +1 -1
  62. package/lib/snippet.js +1 -1
  63. package/lib/snippet.js.map +1 -1
  64. package/lib/transpilers/esm/vue-sfc-compiler.mjs +14 -333
  65. package/lib/transpilers/esvue.js +6 -9
  66. package/lib/transpilers/esvue.js.map +1 -1
  67. package/lib/transpilers/tsvue-exp.js +6 -9
  68. package/lib/transpilers/tsvue-exp.js.map +1 -1
  69. package/lib/transpilers/tsvue.js +5 -8
  70. package/lib/transpilers/tsvue.js.map +1 -1
  71. package/lib/transpilers/vue-sfc-compiler.d.ts +23 -0
  72. package/lib/transpilers/vue-sfc-compiler.js +242 -0
  73. package/lib/transpilers/vue-sfc-compiler.js.map +1 -0
  74. package/lib/tsconfig.node.tsbuildinfo +1 -1
  75. package/lib/version.d.ts +1 -1
  76. package/lib/version.js +1 -1
  77. package/lib/version.js.map +1 -1
  78. package/package.json +8 -9
  79. package/lib/transpilers/vue-sfc/compiler.d.ts +0 -7
  80. package/lib/transpilers/vue-sfc/compiler.js +0 -22
  81. package/lib/transpilers/vue-sfc/compiler.js.map +0 -1
  82. package/lib/transpilers/vue-sfc/index.d.ts +0 -23
  83. package/lib/transpilers/vue-sfc/index.js +0 -46
  84. package/lib/transpilers/vue-sfc/index.js.map +0 -1
  85. package/lib/transpilers/vue-sfc/main.d.ts +0 -8
  86. package/lib/transpilers/vue-sfc/main.js +0 -258
  87. package/lib/transpilers/vue-sfc/main.js.map +0 -1
  88. package/lib/transpilers/vue-sfc/script.d.ts +0 -5
  89. package/lib/transpilers/vue-sfc/script.js +0 -41
  90. package/lib/transpilers/vue-sfc/script.js.map +0 -1
  91. package/lib/transpilers/vue-sfc/template.d.ts +0 -8
  92. package/lib/transpilers/vue-sfc/template.js +0 -101
  93. package/lib/transpilers/vue-sfc/template.js.map +0 -1
  94. package/lib/transpilers/vue-sfc/types.d.ts +0 -55
  95. package/lib/transpilers/vue-sfc/types.js +0 -3
  96. package/lib/transpilers/vue-sfc/types.js.map +0 -1
  97. package/lib/transpilers/vue-sfc/utils/descriptorCache.d.ts +0 -13
  98. package/lib/transpilers/vue-sfc/utils/descriptorCache.js +0 -68
  99. package/lib/transpilers/vue-sfc/utils/descriptorCache.js.map +0 -1
  100. package/lib/transpilers/vue-sfc/utils/error.d.ts +0 -3
  101. package/lib/transpilers/vue-sfc/utils/error.js +0 -23
  102. package/lib/transpilers/vue-sfc/utils/error.js.map +0 -1
  103. package/lib/transpilers/vue-sfc/utils/query.d.ts +0 -13
  104. package/lib/transpilers/vue-sfc/utils/query.js +0 -36
  105. package/lib/transpilers/vue-sfc/utils/query.js.map +0 -1
  106. /package/lib/formatter/{step-definition-snippit-syntax → step-definition-snippet-syntax}/tsflow-snippet-syntax.d.ts +0 -0
  107. /package/lib/formatter/{step-definition-snippit-syntax → step-definition-snippet-syntax}/tsflow-snippet-syntax.js +0 -0
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  const hooks = require('require-extension-hooks');
7
- const vue_sfc_1 = __importDefault(require("./vue-sfc"));
4
+ const vue_sfc_compiler_1 = require("./vue-sfc-compiler");
8
5
  require('ts-node-maintained').register({
9
6
  compilerOptions: {
10
7
  module: 'nodeNext',
@@ -26,14 +23,14 @@ require('jsdom-global')();
26
23
  global.SVGElement = global.window.SVGElement;
27
24
  hooks('vue').push(function (params) {
28
25
  try {
29
- const transformer = new vue_sfc_1.default({
30
- exclude: ['(?:^|/)node_modules/', '(?:^|/)cucumber-tsflow/lib/']
26
+ const result = (0, vue_sfc_compiler_1.compileVueSFC)(params.content, params.filename, {
27
+ enableStyle: !!global.enableVueStyle,
28
+ format: 'cjs'
31
29
  });
32
- const transformResult = transformer.transformCode(params.content, params.filename);
33
- return transformResult.code;
30
+ return result.code;
34
31
  }
35
32
  catch (err) {
36
- console.log(err);
33
+ console.error(err);
37
34
  }
38
35
  return params.content;
39
36
  });
@@ -1 +1 @@
1
- {"version":3,"file":"tsvue-exp.js","sourceRoot":"","sources":["../../src/transpilers/tsvue-exp.ts"],"names":[],"mappings":";;;;;AAAA,MAAM,KAAK,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AACjD,wDAAuC;AAEvC,OAAO,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC;IACtC,eAAe,EAAE;QAChB,MAAM,EAAE,UAAU;QAClB,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,IAAI;QACb,4BAA4B,EAAE,IAAI;QAClC,eAAe,EAAE,IAAI;QACrB,sBAAsB,EAAE,IAAI;QAC5B,iBAAiB,EAAE,IAAI;QACvB,YAAY,EAAE,IAAI;QAClB,GAAG,EAAE,CAAC,QAAQ,CAAC;KACf;IACD,aAAa,EAAE,IAAI;CACnB,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-maintained').register({\r\n\tcompilerOptions: {\r\n\t\tmodule: 'nodeNext',\r\n\t\ttarget: 'es2022',\r\n\t\tstrict: true,\r\n\t\tallowJs: true,\r\n\t\tallowSyntheticDefaultImports: true,\r\n\t\tesModuleInterop: true,\r\n\t\texperimentalDecorators: true,\r\n\t\tresolveJsonModule: true,\r\n\t\tskipLibCheck: true,\r\n\t\tlib: ['es2022']\r\n\t},\r\n\ttranspileOnly: true\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"]}
1
+ {"version":3,"file":"tsvue-exp.js","sourceRoot":"","sources":["../../src/transpilers/tsvue-exp.ts"],"names":[],"mappings":";;AAAA,MAAM,KAAK,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AACjD,yDAAmD;AAEnD,OAAO,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC;IACtC,eAAe,EAAE;QAChB,MAAM,EAAE,UAAU;QAClB,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,IAAI;QACb,4BAA4B,EAAE,IAAI;QAClC,eAAe,EAAE,IAAI;QACrB,sBAAsB,EAAE,IAAI;QAC5B,iBAAiB,EAAE,IAAI;QACvB,YAAY,EAAE,IAAI;QAClB,GAAG,EAAE,CAAC,QAAQ,CAAC;KACf;IACD,aAAa,EAAE,IAAI;CACnB,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,MAAM,GAAG,IAAA,gCAAa,EAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,EAAE;YAC7D,WAAW,EAAE,CAAC,CAAE,MAAc,CAAC,cAAc;YAC7C,MAAM,EAAE,KAAK;SACb,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,CAAC;IACpB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC;AACvB,CAAC,CAAC,CAAC","sourcesContent":["const hooks = require('require-extension-hooks');\r\nimport { compileVueSFC } from './vue-sfc-compiler';\r\n\r\nrequire('ts-node-maintained').register({\r\n\tcompilerOptions: {\r\n\t\tmodule: 'nodeNext',\r\n\t\ttarget: 'es2022',\r\n\t\tstrict: true,\r\n\t\tallowJs: true,\r\n\t\tallowSyntheticDefaultImports: true,\r\n\t\tesModuleInterop: true,\r\n\t\texperimentalDecorators: true,\r\n\t\tresolveJsonModule: true,\r\n\t\tskipLibCheck: true,\r\n\t\tlib: ['es2022']\r\n\t},\r\n\ttranspileOnly: true\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 result = compileVueSFC(params.content, params.filename, {\r\n\t\t\tenableStyle: !!(global as any).enableVueStyle,\r\n\t\t\tformat: 'cjs'\r\n\t\t});\r\n\t\treturn result.code;\r\n\t} catch (err) {\r\n\t\tconsole.error(err);\r\n\t}\r\n\treturn params.content;\r\n});\r\n"]}
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  const hooks = require('require-extension-hooks');
7
- const vue_sfc_1 = __importDefault(require("./vue-sfc"));
4
+ const vue_sfc_compiler_1 = require("./vue-sfc-compiler");
8
5
  require('ts-node-maintained').register({
9
6
  compilerOptions: {
10
7
  module: 'nodeNext',
@@ -26,11 +23,11 @@ require('jsdom-global')();
26
23
  global.SVGElement = global.window.SVGElement;
27
24
  hooks('vue').push(function (params) {
28
25
  try {
29
- const transformer = new vue_sfc_1.default({
30
- exclude: ['(?:^|/)node_modules/', '(?:^|/)cucumber-tsflow/lib/']
26
+ const result = (0, vue_sfc_compiler_1.compileVueSFC)(params.content, params.filename, {
27
+ enableStyle: !!global.enableVueStyle,
28
+ format: 'cjs'
31
29
  });
32
- const transformResult = transformer.transformCode(params.content, params.filename);
33
- return transformResult.code;
30
+ return result.code;
34
31
  }
35
32
  catch (err) {
36
33
  console.error(err);
@@ -1 +1 @@
1
- {"version":3,"file":"tsvue.js","sourceRoot":"","sources":["../../src/transpilers/tsvue.ts"],"names":[],"mappings":";;;;;AAAA,MAAM,KAAK,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AACjD,wDAAuC;AAEvC,OAAO,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC;IACtC,eAAe,EAAE;QAChB,MAAM,EAAE,UAAU;QAClB,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,IAAI;QACb,4BAA4B,EAAE,IAAI;QAClC,eAAe,EAAE,IAAI;QACrB,sBAAsB,EAAE,KAAK;QAC7B,iBAAiB,EAAE,IAAI;QACvB,YAAY,EAAE,IAAI;QAClB,GAAG,EAAE,CAAC,QAAQ,EAAE,mBAAmB,CAAC;KACpC;IACD,aAAa,EAAE,IAAI;CACnB,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,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,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-maintained').register({\r\n\tcompilerOptions: {\r\n\t\tmodule: 'nodeNext',\r\n\t\ttarget: 'es2022',\r\n\t\tstrict: true,\r\n\t\tallowJs: true,\r\n\t\tallowSyntheticDefaultImports: true,\r\n\t\tesModuleInterop: true,\r\n\t\texperimentalDecorators: false,\r\n\t\tresolveJsonModule: true,\r\n\t\tskipLibCheck: true,\r\n\t\tlib: ['es2022', 'esnext.decorators']\r\n\t},\r\n\ttranspileOnly: true\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.error(err);\r\n\t}\r\n\treturn params.content;\r\n});\r\n"]}
1
+ {"version":3,"file":"tsvue.js","sourceRoot":"","sources":["../../src/transpilers/tsvue.ts"],"names":[],"mappings":";;AAAA,MAAM,KAAK,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AACjD,yDAAmD;AAEnD,OAAO,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC;IACtC,eAAe,EAAE;QAChB,MAAM,EAAE,UAAU;QAClB,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,IAAI;QACb,4BAA4B,EAAE,IAAI;QAClC,eAAe,EAAE,IAAI;QACrB,sBAAsB,EAAE,KAAK;QAC7B,iBAAiB,EAAE,IAAI;QACvB,YAAY,EAAE,IAAI;QAClB,GAAG,EAAE,CAAC,QAAQ,EAAE,mBAAmB,CAAC;KACpC;IACD,aAAa,EAAE,IAAI;CACnB,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,MAAM,GAAG,IAAA,gCAAa,EAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,EAAE;YAC7D,WAAW,EAAE,CAAC,CAAE,MAAc,CAAC,cAAc;YAC7C,MAAM,EAAE,KAAK;SACb,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,CAAC;IACpB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC;AACvB,CAAC,CAAC,CAAC","sourcesContent":["const hooks = require('require-extension-hooks');\r\nimport { compileVueSFC } from './vue-sfc-compiler';\r\n\r\nrequire('ts-node-maintained').register({\r\n\tcompilerOptions: {\r\n\t\tmodule: 'nodeNext',\r\n\t\ttarget: 'es2022',\r\n\t\tstrict: true,\r\n\t\tallowJs: true,\r\n\t\tallowSyntheticDefaultImports: true,\r\n\t\tesModuleInterop: true,\r\n\t\texperimentalDecorators: false,\r\n\t\tresolveJsonModule: true,\r\n\t\tskipLibCheck: true,\r\n\t\tlib: ['es2022', 'esnext.decorators']\r\n\t},\r\n\ttranspileOnly: true\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 result = compileVueSFC(params.content, params.filename, {\r\n\t\t\tenableStyle: !!(global as any).enableVueStyle,\r\n\t\t\tformat: 'cjs'\r\n\t\t});\r\n\t\treturn result.code;\r\n\t} catch (err) {\r\n\t\tconsole.error(err);\r\n\t}\r\n\treturn params.content;\r\n});\r\n"]}
@@ -0,0 +1,23 @@
1
+ export type VueSFCFormat = 'cjs' | 'esm';
2
+ export type VueSFCOptions = {
3
+ /** Whether to compile and inject <style> blocks. Default: false */
4
+ enableStyle?: boolean;
5
+ /** Output module format. Default: 'cjs' */
6
+ format?: VueSFCFormat;
7
+ };
8
+ /**
9
+ * Compile a Vue Single File Component to JavaScript.
10
+ *
11
+ * For CJS format: assembles script + template + styles then runs a single
12
+ * esbuild pass (format: 'cjs') over the complete output with TS stripping.
13
+ *
14
+ * For ESM format: transpiles only the script block (if TypeScript), then
15
+ * assembles the result with the already-valid-JS template and style code.
16
+ *
17
+ * @param source - Raw .vue file content
18
+ * @param filename - Absolute path to the .vue file
19
+ * @param options - Compilation options
20
+ */
21
+ export declare function compileVueSFC(source: string, filename: string, options?: VueSFCOptions): {
22
+ code: string;
23
+ };
@@ -0,0 +1,242 @@
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.compileVueSFC = compileVueSFC;
7
+ const compiler_sfc_1 = require("vue/compiler-sfc");
8
+ const hash_sum_1 = __importDefault(require("hash-sum"));
9
+ const esbuild_1 = require("esbuild");
10
+ const tsflow_logger_1 = require("../utils/tsflow-logger");
11
+ const logger = (0, tsflow_logger_1.createLogger)('vue-sfc');
12
+ /**
13
+ * Compile a Vue Single File Component to JavaScript.
14
+ *
15
+ * For CJS format: assembles script + template + styles then runs a single
16
+ * esbuild pass (format: 'cjs') over the complete output with TS stripping.
17
+ *
18
+ * For ESM format: transpiles only the script block (if TypeScript), then
19
+ * assembles the result with the already-valid-JS template and style code.
20
+ *
21
+ * @param source - Raw .vue file content
22
+ * @param filename - Absolute path to the .vue file
23
+ * @param options - Compilation options
24
+ */
25
+ function compileVueSFC(source, filename, options = {}) {
26
+ const { enableStyle = false, format = 'cjs' } = options;
27
+ logger.checkpoint('compileVueSFC started', { filename, format, enableStyle });
28
+ if (!source)
29
+ throw new Error(`Invalid source for ${filename}: source is ${typeof source}`);
30
+ if (!filename)
31
+ throw new Error('Filename is required for Vue SFC compilation');
32
+ // Parse the SFC
33
+ const { descriptor, errors: parseErrors } = (0, compiler_sfc_1.parse)(source, { filename, sourceMap: true });
34
+ if (parseErrors?.length) {
35
+ const msg = parseErrors.map(e => e.message).join('\n');
36
+ logger.error('SFC parse errors', undefined, { filename, errors: parseErrors });
37
+ throw new Error(`Vue SFC parse errors in ${filename}:\n${msg}`);
38
+ }
39
+ // Generate a stable component ID from the filename
40
+ const id = (0, hash_sum_1.default)(filename);
41
+ const hasScoped = descriptor.styles.some(s => s.scoped);
42
+ logger.checkpoint('SFC parsed', {
43
+ hasScript: !!descriptor.script,
44
+ hasScriptSetup: !!descriptor.scriptSetup,
45
+ hasTemplate: !!descriptor.template,
46
+ styleCount: descriptor.styles?.length,
47
+ hasScoped
48
+ });
49
+ const isTS = descriptor.script?.lang === 'ts' || descriptor.scriptSetup?.lang === 'ts';
50
+ // Read experimentalDecorators from global (set by load-configuration before transpilers run)
51
+ const experimentalDecorators = !!global.experimentalDecorators;
52
+ const tsconfigRaw = {
53
+ compilerOptions: {
54
+ experimentalDecorators,
55
+ ...(experimentalDecorators ? { importsNotUsedAsValues: 'remove' } : {}),
56
+ strict: true
57
+ }
58
+ };
59
+ // ------------------------------------------------------------------
60
+ // Script block
61
+ // ------------------------------------------------------------------
62
+ // Pre-parse template AST so compileScript can resolve bindings accurately
63
+ let templateAst = null;
64
+ if (descriptor.template) {
65
+ try {
66
+ const { ast } = (0, compiler_sfc_1.compileTemplate)({
67
+ source: descriptor.template.content,
68
+ filename,
69
+ id,
70
+ compilerOptions: { mode: 'module', parseOnly: true }
71
+ });
72
+ templateAst = ast;
73
+ }
74
+ catch (e) {
75
+ throw new Error(`Failed to pre-parse template AST in ${filename}: ${e.message}`, { cause: e });
76
+ }
77
+ }
78
+ let rawScriptContent = '';
79
+ let compiledScript;
80
+ if (descriptor.script || descriptor.scriptSetup) {
81
+ try {
82
+ compiledScript = (0, compiler_sfc_1.compileScript)(descriptor, {
83
+ id,
84
+ inlineTemplate: false,
85
+ sourceMap: true,
86
+ genDefaultAs: '_sfc_main',
87
+ templateAst: templateAst,
88
+ resolveComponents: true,
89
+ // Disable asset URL transforms: unit tests don't need asset imports
90
+ templateOptions: { transformAssetUrls: false }
91
+ });
92
+ rawScriptContent = compiledScript.content;
93
+ logger.checkpoint('Script compiled', { contentLength: rawScriptContent.length });
94
+ }
95
+ catch (e) {
96
+ throw new Error(`Failed to compile script in ${filename}: ${e.message}`, { cause: e });
97
+ }
98
+ }
99
+ // For ESM: transpile the script block now (TS → ESM JS).
100
+ // For CJS: keep raw content; the full assembly is transpiled below.
101
+ let scriptCode = rawScriptContent;
102
+ if (format === 'esm' && isTS && rawScriptContent) {
103
+ try {
104
+ const result = (0, esbuild_1.transformSync)(rawScriptContent, {
105
+ loader: 'ts',
106
+ format: 'esm',
107
+ target: 'es2022',
108
+ sourcemap: 'inline',
109
+ tsconfigRaw
110
+ });
111
+ scriptCode = result.code;
112
+ logger.checkpoint('Script transpiled (ESM)', { outputLength: scriptCode.length });
113
+ }
114
+ catch (e) {
115
+ throw new Error(`Failed to transpile TypeScript in ${filename}: ${e.message}`, { cause: e });
116
+ }
117
+ }
118
+ // ------------------------------------------------------------------
119
+ // Template block
120
+ // ------------------------------------------------------------------
121
+ let templateCode = '';
122
+ if (descriptor.template) {
123
+ try {
124
+ const template = (0, compiler_sfc_1.compileTemplate)({
125
+ source: descriptor.template.content,
126
+ filename,
127
+ id,
128
+ scoped: hasScoped,
129
+ compilerOptions: {
130
+ mode: 'module',
131
+ bindingMetadata: compiledScript?.bindings
132
+ },
133
+ // Disable asset URL transforms: unit tests don't need asset imports;
134
+ // CJS has no stub loader for binary assets (e.g. *.jpg → require())
135
+ transformAssetUrls: false
136
+ });
137
+ if (template.errors.length) {
138
+ const msg = template.errors.map(e => (typeof e === 'string' ? e : e.message)).join('\n');
139
+ throw new Error(`Template compilation errors in ${filename}:\n${msg}`);
140
+ }
141
+ templateCode = template.code;
142
+ logger.checkpoint('Template compiled', { outputLength: templateCode.length });
143
+ }
144
+ catch (e) {
145
+ throw new Error(`Failed to compile template in ${filename}: ${e.message}`, { cause: e });
146
+ }
147
+ }
148
+ // ------------------------------------------------------------------
149
+ // Style blocks (optional)
150
+ // ------------------------------------------------------------------
151
+ let styleCode = '';
152
+ if (enableStyle && descriptor.styles.length > 0) {
153
+ const styles = [];
154
+ for (const style of descriptor.styles) {
155
+ try {
156
+ const compiled = (0, compiler_sfc_1.compileStyle)({
157
+ source: style.content,
158
+ filename,
159
+ id,
160
+ scoped: !!style.scoped,
161
+ preprocessLang: style.lang
162
+ });
163
+ const hasPreprocessorError = compiled.errors.length > 0 &&
164
+ compiled.errors.some(e => e.message.includes('sass') ||
165
+ e.message.includes('scss') ||
166
+ e.message.includes('less') ||
167
+ e.message.includes('stylus'));
168
+ if (!hasPreprocessorError && compiled.code) {
169
+ styles.push(compiled.code);
170
+ }
171
+ else if (hasPreprocessorError) {
172
+ logger.warn(`Skipping ${style.lang ?? 'css'} style — preprocessor not available`, { filename });
173
+ }
174
+ }
175
+ catch (e) {
176
+ if (e.message.includes('Cannot find module')) {
177
+ logger.warn(`Skipping style block — missing module`, { filename, error: e.message });
178
+ continue;
179
+ }
180
+ throw new Error(`Failed to compile style in ${filename}: ${e.message}`, { cause: e });
181
+ }
182
+ }
183
+ if (styles.length > 0) {
184
+ styleCode = `
185
+ // Style injection
186
+ if (typeof document !== 'undefined') {
187
+ (function() {
188
+ const styles = ${JSON.stringify(styles)};
189
+ const id = '${id}';
190
+ if (!document.querySelector(\`[data-vite-vue-id="\${id}"]\`)) {
191
+ styles.forEach((css) => {
192
+ const style = document.createElement('style');
193
+ style.setAttribute('data-vite-vue-id', id);
194
+ if (${hasScoped}) { style.setAttribute('data-v-' + id, ''); }
195
+ style.textContent = css;
196
+ document.head.appendChild(style);
197
+ });
198
+ }
199
+ })();
200
+ }
201
+ `;
202
+ }
203
+ }
204
+ // ------------------------------------------------------------------
205
+ // Assemble
206
+ // ------------------------------------------------------------------
207
+ let finalCode = scriptCode;
208
+ if (templateCode) {
209
+ finalCode += '\n' + templateCode;
210
+ finalCode += '\n_sfc_main.render = render;';
211
+ }
212
+ if (hasScoped) {
213
+ finalCode += `\n_sfc_main.__scopeId = 'data-v-${id}';`;
214
+ }
215
+ if (styleCode) {
216
+ finalCode = styleCode + '\n' + finalCode;
217
+ }
218
+ if (!/export\s+default/.test(finalCode)) {
219
+ finalCode += '\nexport default _sfc_main;';
220
+ }
221
+ // ------------------------------------------------------------------
222
+ // CJS: transpile the assembled output in one pass (TS → CJS)
223
+ // ------------------------------------------------------------------
224
+ if (format === 'cjs') {
225
+ try {
226
+ const result = (0, esbuild_1.transformSync)(finalCode, {
227
+ loader: isTS ? 'ts' : 'js',
228
+ format: 'cjs',
229
+ target: 'es2022',
230
+ tsconfigRaw
231
+ });
232
+ finalCode = result.code;
233
+ logger.checkpoint('CJS transpilation complete', { outputLength: finalCode.length });
234
+ }
235
+ catch (e) {
236
+ throw new Error(`Failed to transpile Vue SFC to CJS in ${filename}: ${e.message}`, { cause: e });
237
+ }
238
+ }
239
+ logger.checkpoint('compileVueSFC complete', { filename, outputLength: finalCode.length });
240
+ return { code: finalCode };
241
+ }
242
+ //# sourceMappingURL=vue-sfc-compiler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue-sfc-compiler.js","sourceRoot":"","sources":["../../src/transpilers/vue-sfc-compiler.ts"],"names":[],"mappings":";;;;;AA6BA,sCAoPC;AAjRD,mDAAuF;AACvF,wDAA4B;AAC5B,qCAAwC;AACxC,0DAAsD;AAEtD,MAAM,MAAM,GAAG,IAAA,4BAAY,EAAC,SAAS,CAAC,CAAC;AAWvC;;;;;;;;;;;;GAYG;AACH,SAAgB,aAAa,CAAC,MAAc,EAAE,QAAgB,EAAE,UAAyB,EAAE;IAC1F,MAAM,EAAE,WAAW,GAAG,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAExD,MAAM,CAAC,UAAU,CAAC,uBAAuB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;IAE9E,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,QAAQ,eAAe,OAAO,MAAM,EAAE,CAAC,CAAC;IAC3F,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAE/E,gBAAgB;IAChB,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,oBAAK,EAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAEzF,IAAI,WAAW,EAAE,MAAM,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC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hash-sum';\r\nimport { transformSync } from 'esbuild';\r\nimport { createLogger } from '../utils/tsflow-logger';\r\n\r\nconst logger = createLogger('vue-sfc');\r\n\r\nexport type VueSFCFormat = 'cjs' | 'esm';\r\n\r\nexport type VueSFCOptions = {\r\n\t/** Whether to compile and inject <style> blocks. Default: false */\r\n\tenableStyle?: boolean;\r\n\t/** Output module format. Default: 'cjs' */\r\n\tformat?: VueSFCFormat;\r\n};\r\n\r\n/**\r\n * Compile a Vue Single File Component to JavaScript.\r\n *\r\n * For CJS format: assembles script + template + styles then runs a single\r\n * esbuild pass (format: 'cjs') over the complete output with TS stripping.\r\n *\r\n * For ESM format: transpiles only the script block (if TypeScript), then\r\n * assembles the result with the already-valid-JS template and style code.\r\n *\r\n * @param source - Raw .vue file content\r\n * @param filename - Absolute path to the .vue file\r\n * @param options - Compilation options\r\n */\r\nexport function compileVueSFC(source: string, filename: string, options: VueSFCOptions = {}): { code: string } {\r\n\tconst { enableStyle = false, format = 'cjs' } = options;\r\n\r\n\tlogger.checkpoint('compileVueSFC started', { filename, format, enableStyle });\r\n\r\n\tif (!source) throw new Error(`Invalid source for ${filename}: source is ${typeof source}`);\r\n\tif (!filename) throw new Error('Filename is required for Vue SFC compilation');\r\n\r\n\t// Parse the SFC\r\n\tconst { descriptor, errors: parseErrors } = parse(source, { filename, sourceMap: true });\r\n\r\n\tif (parseErrors?.length) {\r\n\t\tconst msg = parseErrors.map(e => e.message).join('\\n');\r\n\t\tlogger.error('SFC parse errors', undefined, { filename, errors: parseErrors });\r\n\t\tthrow new Error(`Vue SFC parse errors in ${filename}:\\n${msg}`);\r\n\t}\r\n\r\n\t// Generate a stable component ID from the filename\r\n\tconst id = hash(filename);\r\n\tconst hasScoped = descriptor.styles.some(s => s.scoped);\r\n\r\n\tlogger.checkpoint('SFC parsed', {\r\n\t\thasScript: !!descriptor.script,\r\n\t\thasScriptSetup: !!descriptor.scriptSetup,\r\n\t\thasTemplate: !!descriptor.template,\r\n\t\tstyleCount: descriptor.styles?.length,\r\n\t\thasScoped\r\n\t});\r\n\r\n\tconst isTS = descriptor.script?.lang === 'ts' || descriptor.scriptSetup?.lang === 'ts';\r\n\r\n\t// Read experimentalDecorators from global (set by load-configuration before transpilers run)\r\n\tconst experimentalDecorators = !!(global as any).experimentalDecorators;\r\n\tconst tsconfigRaw = {\r\n\t\tcompilerOptions: {\r\n\t\t\texperimentalDecorators,\r\n\t\t\t...(experimentalDecorators ? { importsNotUsedAsValues: 'remove' as const } : {}),\r\n\t\t\tstrict: true\r\n\t\t}\r\n\t};\r\n\r\n\t// ------------------------------------------------------------------\r\n\t// Script block\r\n\t// ------------------------------------------------------------------\r\n\r\n\t// Pre-parse template AST so compileScript can resolve bindings accurately\r\n\tlet templateAst = null;\r\n\tif (descriptor.template) {\r\n\t\ttry {\r\n\t\t\tconst { ast } = compileTemplate({\r\n\t\t\t\tsource: descriptor.template.content,\r\n\t\t\t\tfilename,\r\n\t\t\t\tid,\r\n\t\t\t\tcompilerOptions: { mode: 'module', parseOnly: true } as any\r\n\t\t\t});\r\n\t\t\ttemplateAst = ast;\r\n\t\t} catch (e: any) {\r\n\t\t\tthrow new Error(`Failed to pre-parse template AST in ${filename}: ${e.message}`, { cause: e });\r\n\t\t}\r\n\t}\r\n\r\n\tlet rawScriptContent = '';\r\n\tlet compiledScript: ReturnType<typeof compileScript> | undefined;\r\n\r\n\tif (descriptor.script || descriptor.scriptSetup) {\r\n\t\ttry {\r\n\t\t\tcompiledScript = compileScript(descriptor, {\r\n\t\t\t\tid,\r\n\t\t\t\tinlineTemplate: false,\r\n\t\t\t\tsourceMap: true,\r\n\t\t\t\tgenDefaultAs: '_sfc_main',\r\n\t\t\t\ttemplateAst: templateAst,\r\n\t\t\t\tresolveComponents: true,\r\n\t\t\t\t// Disable asset URL transforms: unit tests don't need asset imports\r\n\t\t\t\ttemplateOptions: { transformAssetUrls: false }\r\n\t\t\t} as any);\r\n\t\t\trawScriptContent = compiledScript.content;\r\n\t\t\tlogger.checkpoint('Script compiled', { contentLength: rawScriptContent.length });\r\n\t\t} catch (e: any) {\r\n\t\t\tthrow new Error(`Failed to compile script in ${filename}: ${e.message}`, { cause: e });\r\n\t\t}\r\n\t}\r\n\r\n\t// For ESM: transpile the script block now (TS → ESM JS).\r\n\t// For CJS: keep raw content; the full assembly is transpiled below.\r\n\tlet scriptCode = rawScriptContent;\r\n\tif (format === 'esm' && isTS && rawScriptContent) {\r\n\t\ttry {\r\n\t\t\tconst result = transformSync(rawScriptContent, {\r\n\t\t\t\tloader: 'ts',\r\n\t\t\t\tformat: 'esm',\r\n\t\t\t\ttarget: 'es2022',\r\n\t\t\t\tsourcemap: 'inline',\r\n\t\t\t\ttsconfigRaw\r\n\t\t\t});\r\n\t\t\tscriptCode = result.code;\r\n\t\t\tlogger.checkpoint('Script transpiled (ESM)', { outputLength: scriptCode.length });\r\n\t\t} catch (e: any) {\r\n\t\t\tthrow new Error(`Failed to transpile TypeScript in ${filename}: ${e.message}`, { cause: e });\r\n\t\t}\r\n\t}\r\n\r\n\t// ------------------------------------------------------------------\r\n\t// Template block\r\n\t// ------------------------------------------------------------------\r\n\r\n\tlet templateCode = '';\r\n\tif (descriptor.template) {\r\n\t\ttry {\r\n\t\t\tconst template = compileTemplate({\r\n\t\t\t\tsource: descriptor.template.content,\r\n\t\t\t\tfilename,\r\n\t\t\t\tid,\r\n\t\t\t\tscoped: hasScoped,\r\n\t\t\t\tcompilerOptions: {\r\n\t\t\t\t\tmode: 'module',\r\n\t\t\t\t\tbindingMetadata: compiledScript?.bindings\r\n\t\t\t\t},\r\n\t\t\t\t// Disable asset URL transforms: unit tests don't need asset imports;\r\n\t\t\t\t// CJS has no stub loader for binary assets (e.g. *.jpg → require())\r\n\t\t\t\ttransformAssetUrls: false\r\n\t\t\t});\r\n\r\n\t\t\tif (template.errors.length) {\r\n\t\t\t\tconst msg = template.errors.map(e => (typeof e === 'string' ? e : e.message)).join('\\n');\r\n\t\t\t\tthrow new Error(`Template compilation errors in ${filename}:\\n${msg}`);\r\n\t\t\t}\r\n\r\n\t\t\ttemplateCode = template.code;\r\n\t\t\tlogger.checkpoint('Template compiled', { outputLength: templateCode.length });\r\n\t\t} catch (e: any) {\r\n\t\t\tthrow new Error(`Failed to compile template in ${filename}: ${e.message}`, { cause: e });\r\n\t\t}\r\n\t}\r\n\r\n\t// ------------------------------------------------------------------\r\n\t// Style blocks (optional)\r\n\t// ------------------------------------------------------------------\r\n\r\n\tlet styleCode = '';\r\n\tif (enableStyle && descriptor.styles.length > 0) {\r\n\t\tconst styles: string[] = [];\r\n\r\n\t\tfor (const style of descriptor.styles) {\r\n\t\t\ttry {\r\n\t\t\t\tconst compiled = compileStyle({\r\n\t\t\t\t\tsource: style.content,\r\n\t\t\t\t\tfilename,\r\n\t\t\t\t\tid,\r\n\t\t\t\t\tscoped: !!style.scoped,\r\n\t\t\t\t\tpreprocessLang: style.lang as any\r\n\t\t\t\t});\r\n\r\n\t\t\t\tconst hasPreprocessorError =\r\n\t\t\t\t\tcompiled.errors.length > 0 &&\r\n\t\t\t\t\tcompiled.errors.some(\r\n\t\t\t\t\t\te =>\r\n\t\t\t\t\t\t\te.message.includes('sass') ||\r\n\t\t\t\t\t\t\te.message.includes('scss') ||\r\n\t\t\t\t\t\t\te.message.includes('less') ||\r\n\t\t\t\t\t\t\te.message.includes('stylus')\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\tif (!hasPreprocessorError && compiled.code) {\r\n\t\t\t\t\tstyles.push(compiled.code);\r\n\t\t\t\t} else if (hasPreprocessorError) {\r\n\t\t\t\t\tlogger.warn(`Skipping ${style.lang ?? 'css'} style — preprocessor not available`, { filename });\r\n\t\t\t\t}\r\n\t\t\t} catch (e: any) {\r\n\t\t\t\tif (e.message.includes('Cannot find module')) {\r\n\t\t\t\t\tlogger.warn(`Skipping style block — missing module`, { filename, error: e.message });\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tthrow new Error(`Failed to compile style in ${filename}: ${e.message}`, { cause: e });\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (styles.length > 0) {\r\n\t\t\tstyleCode = `\r\n// Style injection\r\nif (typeof document !== 'undefined') {\r\n (function() {\r\n const styles = ${JSON.stringify(styles)};\r\n const id = '${id}';\r\n if (!document.querySelector(\\`[data-vite-vue-id=\"\\${id}\"]\\`)) {\r\n styles.forEach((css) => {\r\n const style = document.createElement('style');\r\n style.setAttribute('data-vite-vue-id', id);\r\n if (${hasScoped}) { style.setAttribute('data-v-' + id, ''); }\r\n style.textContent = css;\r\n document.head.appendChild(style);\r\n });\r\n }\r\n })();\r\n}\r\n`;\r\n\t\t}\r\n\t}\r\n\r\n\t// ------------------------------------------------------------------\r\n\t// Assemble\r\n\t// ------------------------------------------------------------------\r\n\r\n\tlet finalCode = scriptCode;\r\n\r\n\tif (templateCode) {\r\n\t\tfinalCode += '\\n' + templateCode;\r\n\t\tfinalCode += '\\n_sfc_main.render = render;';\r\n\t}\r\n\r\n\tif (hasScoped) {\r\n\t\tfinalCode += `\\n_sfc_main.__scopeId = 'data-v-${id}';`;\r\n\t}\r\n\r\n\tif (styleCode) {\r\n\t\tfinalCode = styleCode + '\\n' + finalCode;\r\n\t}\r\n\r\n\tif (!/export\\s+default/.test(finalCode)) {\r\n\t\tfinalCode += '\\nexport default _sfc_main;';\r\n\t}\r\n\r\n\t// ------------------------------------------------------------------\r\n\t// CJS: transpile the assembled output in one pass (TS → CJS)\r\n\t// ------------------------------------------------------------------\r\n\r\n\tif (format === 'cjs') {\r\n\t\ttry {\r\n\t\t\tconst result = transformSync(finalCode, {\r\n\t\t\t\tloader: isTS ? 'ts' : 'js',\r\n\t\t\t\tformat: 'cjs',\r\n\t\t\t\ttarget: 'es2022',\r\n\t\t\t\ttsconfigRaw\r\n\t\t\t});\r\n\t\t\tfinalCode = result.code;\r\n\t\t\tlogger.checkpoint('CJS transpilation complete', { outputLength: finalCode.length });\r\n\t\t} catch (e: any) {\r\n\t\t\tthrow new Error(`Failed to transpile Vue SFC to CJS in ${filename}: ${e.message}`, { cause: e });\r\n\t\t}\r\n\t}\r\n\r\n\tlogger.checkpoint('compileVueSFC complete', { filename, outputLength: finalCode.length });\r\n\r\n\treturn { code: finalCode };\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"root":["../src/behave.ts","../src/index.ts","../src/junitbamboo.ts","../src/snippet.ts","../src/version.ts","../src/api/convert-configuration.ts","../src/api/index.ts","../src/api/load-configuration.ts","../src/api/load-support.ts","../src/api/run-cucumber.ts","../src/api/support.ts","../src/bindings/binding-context.ts","../src/bindings/binding-decorator.ts","../src/bindings/binding-registry.ts","../src/bindings/hook-decorators.ts","../src/bindings/step-binding.ts","../src/bindings/step-decorators.ts","../src/bindings/types.ts","../src/cli/argv-parser.ts","../src/cli/index.ts","../src/cli/run.ts","../src/formatter/behave-json-formatter.ts","../src/formatter/junit-bamboo-formatter.ts","../src/formatter/step-definition-snippit-syntax/tsflow-snippet-syntax.ts","../src/gherkin/configuration.ts","../src/gherkin/gherkin-feature.ts","../src/gherkin/gherkin-manager.ts","../src/gherkin/models.ts","../src/runtime/coordinator.ts","../src/runtime/make-runtime.ts","../src/runtime/managed-scenario-context.ts","../src/runtime/message-collector.ts","../src/runtime/scenario-context.ts","../src/runtime/scenario-info.ts","../src/runtime/test-case-info.ts","../src/runtime/test-case-runner.ts","../src/runtime/types.ts","../src/runtime/utils.ts","../src/runtime/worker.ts","../src/runtime/parallel/adapter.ts","../src/runtime/parallel/run-worker.ts","../src/runtime/parallel/worker.ts","../src/runtime/serial/adapter.ts","../src/transpilers/esbuild-transpiler.ts","../src/transpilers/esbuild.ts","../src/transpilers/esnode.ts","../src/transpilers/esvue.ts","../src/transpilers/tsnode-exp.ts","../src/transpilers/tsnode.ts","../src/transpilers/tsvue-exp.ts","../src/transpilers/tsvue.ts","../src/transpilers/vue-sfc/compiler.ts","../src/transpilers/vue-sfc/index.ts","../src/transpilers/vue-sfc/main.ts","../src/transpilers/vue-sfc/script.ts","../src/transpilers/vue-sfc/template.ts","../src/transpilers/vue-sfc/types.ts","../src/transpilers/vue-sfc/utils/descriptorCache.ts","../src/transpilers/vue-sfc/utils/error.ts","../src/transpilers/vue-sfc/utils/query.ts","../src/types/durations.d.ts","../src/types/global.d.ts","../src/types/lep.d.ts","../src/types/vue-shim.d.ts","../src/utils/helpers.ts","../src/utils/logger.ts","../src/utils/our-callsite.ts","../src/utils/tsflow-logger.ts"],"version":"5.9.2"}
1
+ {"root":["../src/behave.ts","../src/index.ts","../src/junitbamboo.ts","../src/snippet.ts","../src/version.ts","../src/api/convert-configuration.ts","../src/api/index.ts","../src/api/load-configuration.ts","../src/api/load-support.ts","../src/api/loader-worker.ts","../src/api/parallel-loader.ts","../src/api/run-cucumber.ts","../src/api/support.ts","../src/bindings/binding-context.ts","../src/bindings/binding-decorator.ts","../src/bindings/binding-registry.ts","../src/bindings/hook-decorators.ts","../src/bindings/step-binding.ts","../src/bindings/step-decorators.ts","../src/bindings/types.ts","../src/cli/argv-parser.ts","../src/cli/index.ts","../src/cli/run.ts","../src/formatter/behave-json-formatter.ts","../src/formatter/junit-bamboo-formatter.ts","../src/formatter/step-definition-snippet-syntax/tsflow-snippet-syntax.ts","../src/gherkin/configuration.ts","../src/gherkin/gherkin-feature.ts","../src/gherkin/gherkin-manager.ts","../src/gherkin/models.ts","../src/runtime/coordinator.ts","../src/runtime/make-runtime.ts","../src/runtime/managed-scenario-context.ts","../src/runtime/message-collector.ts","../src/runtime/scenario-context.ts","../src/runtime/scenario-info.ts","../src/runtime/test-case-info.ts","../src/runtime/test-case-runner.ts","../src/runtime/types.ts","../src/runtime/utils.ts","../src/runtime/worker.ts","../src/runtime/parallel/adapter.ts","../src/runtime/parallel/run-worker.ts","../src/runtime/parallel/worker.ts","../src/runtime/serial/adapter.ts","../src/transpilers/esbuild-transpiler.ts","../src/transpilers/esbuild.ts","../src/transpilers/esnode.ts","../src/transpilers/esvue.ts","../src/transpilers/tsnode-exp.ts","../src/transpilers/tsnode.ts","../src/transpilers/tsvue-exp.ts","../src/transpilers/tsvue.ts","../src/transpilers/vue-sfc-compiler.ts","../src/types/durations.d.ts","../src/types/global.d.ts","../src/types/lep.d.ts","../src/types/vue-shim.d.ts","../src/utils/helpers.ts","../src/utils/logger.ts","../src/utils/our-callsite.ts","../src/utils/tsflow-logger.ts"],"version":"5.9.2"}
package/lib/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "7.5.5";
1
+ export declare const version = "7.7.0";
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.5.5';
5
+ exports.version = '7.7.0';
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.5.5'\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.7.0'\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lynxwall/cucumber-tsflow",
3
- "description": "Provides 'specflow' like bindings for CucumberJS 12.2.0 in TypeScript 5.9+.",
4
- "version": "7.5.5",
3
+ "description": "Provides 'specflow' like bindings for CucumberJS 12.7.0 in TypeScript 5.9+.",
4
+ "version": "7.7.0",
5
5
  "author": "Lonnie Wall <lynxdev@lynxwall.com>",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -51,13 +51,16 @@
51
51
  "./lib/transpilers/esm/tsnode-loader": "./lib/transpilers/esm/tsnode-loader.mjs",
52
52
  "./lib/transpilers/esm/esnode-loader": "./lib/transpilers/esm/esnode-loader.mjs",
53
53
  "./lib/transpilers/esm/esvue-loader": "./lib/transpilers/esm/esvue-loader.mjs",
54
- "./lib/transpilers/esm/esbuild-transpiler'": "./lib/transpilers/esm/esbuild-transpiler.mjs",
54
+ "./lib/transpilers/esm/esbuild-transpiler": "./lib/transpilers/esm/esbuild-transpiler.mjs",
55
55
  "./lib/transpilers/esm/vue-jsdom-setup": "./lib/transpilers/esm/vue-jsdom-setup.mjs",
56
56
  "./package.json": "./package.json"
57
57
  },
58
58
  "types": "./lib/index.d.ts",
59
+ "engines": {
60
+ "node": ">=22.0.0"
61
+ },
59
62
  "dependencies": {
60
- "@cucumber/cucumber": "~12.2.0",
63
+ "@cucumber/cucumber": "~12.7.0",
61
64
  "@jeanbenitez/logical-expression-parser": "~1.0.0",
62
65
  "@types/node": "~22.13.10",
63
66
  "ansis": "~3.17.0",
@@ -72,22 +75,18 @@
72
75
  "lodash.merge": "~4.6.2",
73
76
  "polyfill-symbol-metadata": "^0.0.2",
74
77
  "require-extension-hooks": "~0.3.3",
75
- "rollup": "~4.52.0",
76
78
  "short-uuid": "~5.2.0",
77
79
  "source-map-support": "~0.5.21",
78
80
  "ts-node-maintained": "~10.9.6",
79
81
  "tsconfig-paths": "~4.2.0",
80
82
  "tslib": "2.8.1",
81
- "typescript": "~5.9.2",
82
- "underscore": "~1.13.7"
83
+ "typescript": "~5.9.2"
83
84
  },
84
85
  "devDependencies": {
85
- "@rollup/pluginutils": "~5.3.0",
86
86
  "@types/debug": "~4.1.12",
87
87
  "@types/hash-sum": "~1.0.2",
88
88
  "@types/lodash.merge": "~4.6.9",
89
89
  "@types/source-map-support": "~0.5.10",
90
- "@types/underscore": "~1.13.0",
91
90
  "genversion": "~3.2.0",
92
91
  "shx": "0.4.0"
93
92
  },
@@ -1,7 +0,0 @@
1
- declare module 'vue/compiler-sfc' {
2
- interface SFCDescriptor {
3
- id: string;
4
- }
5
- }
6
- import type * as _compiler from 'vue/compiler-sfc';
7
- export declare const resolveCompiler: (root: string) => typeof _compiler;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveCompiler = void 0;
4
- const resolveCompiler = (root) => {
5
- // resolve from project root first, then fallback to peer dep (if any)
6
- const compiler = tryRequire('vue/compiler-sfc', root) || tryRequire('vue/compiler-sfc');
7
- if (!compiler) {
8
- throw new Error(`Failed to resolve vue/compiler-sfc.\n` +
9
- `@lynxwall/cucumber-tsflow/vue requires vue (>=3.2.25) ` +
10
- `to be present in the dependency tree.`);
11
- }
12
- return compiler;
13
- };
14
- exports.resolveCompiler = resolveCompiler;
15
- const tryRequire = (id, from) => {
16
- try {
17
- return from ? require(require.resolve(id, { paths: [from] })) : require(id);
18
- // eslint-disable-next-line no-empty
19
- }
20
- catch (e) { }
21
- };
22
- //# sourceMappingURL=compiler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compiler.js","sourceRoot":"","sources":["../../../src/transpilers/vue-sfc/compiler.ts"],"names":[],"mappings":";;;AASO,MAAM,eAAe,GAAG,CAAC,IAAY,EAAoB,EAAE;IACjE,sEAAsE;IACtE,MAAM,QAAQ,GAAG,UAAU,CAAC,kBAAkB,EAAE,IAAI,CAAC,IAAI,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAExF,IAAI,CAAC,QAAQ,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACd,uCAAuC;YACtC,wDAAwD;YACxD,uCAAuC,CACxC,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AAbW,QAAA,eAAe,mBAa1B;AAEF,MAAM,UAAU,GAAG,CAAC,EAAU,EAAE,IAAa,EAAE,EAAE;IAChD,IAAI,CAAC;QACJ,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC5E,oCAAoC;IACrC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;AACf,CAAC,CAAC","sourcesContent":["// extend the descriptor so we can store the scopeId on it\r\ndeclare module 'vue/compiler-sfc' {\r\n\tinterface SFCDescriptor {\r\n\t\tid: string;\r\n\t}\r\n}\r\n\r\nimport type * as _compiler from 'vue/compiler-sfc';\r\n\r\nexport const resolveCompiler = (root: string): typeof _compiler => {\r\n\t// resolve from project root first, then fallback to peer dep (if any)\r\n\tconst compiler = tryRequire('vue/compiler-sfc', root) || tryRequire('vue/compiler-sfc');\r\n\r\n\tif (!compiler) {\r\n\t\tthrow new Error(\r\n\t\t\t`Failed to resolve vue/compiler-sfc.\\n` +\r\n\t\t\t\t`@lynxwall/cucumber-tsflow/vue requires vue (>=3.2.25) ` +\r\n\t\t\t\t`to be present in the dependency tree.`\r\n\t\t);\r\n\t}\r\n\r\n\treturn compiler;\r\n};\r\n\r\nconst tryRequire = (id: string, from?: string) => {\r\n\ttry {\r\n\t\treturn from ? require(require.resolve(id, { paths: [from] })) : require(id);\r\n\t\t// eslint-disable-next-line no-empty\r\n\t} catch (e) {}\r\n};\r\n"]}
@@ -1,23 +0,0 @@
1
- import type { RollupError, RollupLog } from 'rollup';
2
- import type { Options, VueTransformerContext, VueResolvedId } from './types';
3
- export { parseVueRequest, VueQuery } from './utils/query';
4
- declare class VueTransformer implements VueTransformerContext {
5
- private customElementFilter;
6
- private options;
7
- private isSSR;
8
- constructor(rawOptions?: Options);
9
- error: (err: string | RollupError, pos?: number | {
10
- column: number;
11
- line: number;
12
- } | undefined) => void;
13
- resolve: (id: string) => VueResolvedId | null;
14
- warn: (warning: RollupLog | string, pos?: number | {
15
- column: number;
16
- line: number;
17
- } | undefined) => void;
18
- transformCode: (code: string, filename: string) => {
19
- code: string;
20
- map: string;
21
- };
22
- }
23
- export default VueTransformer;
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseVueRequest = void 0;
4
- const pluginutils_1 = require("@rollup/pluginutils");
5
- const compiler_1 = require("./compiler");
6
- const query_1 = require("./utils/query");
7
- const main_1 = require("./main");
8
- var query_2 = require("./utils/query");
9
- Object.defineProperty(exports, "parseVueRequest", { enumerable: true, get: function () { return query_2.parseVueRequest; } });
10
- class VueTransformer {
11
- customElementFilter;
12
- options;
13
- isSSR = (opt) => opt === undefined ? false : typeof opt === 'boolean' ? opt : opt?.ssr === true;
14
- constructor(rawOptions = {}) {
15
- const { include = /\.vue$/, exclude, customElement = /\.ce\.vue$/, reactivityTransform = false } = rawOptions;
16
- this.customElementFilter = typeof customElement === 'boolean' ? () => customElement : (0, pluginutils_1.createFilter)(customElement);
17
- const rootDir = process.cwd();
18
- this.options = {
19
- isProduction: process.env.NODE_ENV === 'production',
20
- compiler: (0, compiler_1.resolveCompiler)(rootDir),
21
- ...rawOptions,
22
- include,
23
- exclude,
24
- customElement,
25
- reactivityTransform,
26
- root: rootDir,
27
- sourceMap: true
28
- };
29
- }
30
- error = (err, pos) => { };
31
- resolve = (id) => {
32
- // serve sub-part requests (*?vue) as virtual modules
33
- if ((0, query_1.parseVueRequest)(id).query.vue) {
34
- return { external: false, id: id };
35
- }
36
- return null;
37
- };
38
- warn = (warning, pos) => { };
39
- transformCode = (code, filename) => {
40
- const ssr = this.isSSR(false);
41
- const result = (0, main_1.transformMain)(code, filename, this.options, this, ssr, this.customElementFilter(filename));
42
- return { code: result?.code, map: result?.map.mappings };
43
- };
44
- }
45
- exports.default = VueTransformer;
46
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transpilers/vue-sfc/index.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;AAEnD,yCAA6C;AAC7C,yCAAgD;AAChD,iCAAuC;AAGvC,uCAA0D;AAAjD,wGAAA,eAAe,OAAA;AAExB,MAAM,cAAc;IACX,mBAAmB,CAA2B;IAC9C,OAAO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A2D,EAAQ,EAAE,GAAE,CAAC,CAAC;IAE9G,aAAa,GAAG,CAAC,IAAY,EAAE,QAAgB,EAAE,EAAE;QACzD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC9B,MAAM,MAAM,GAAG,IAAA,oBAAa,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC1G,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC1D,CAAC,CAAC;CACF;AAED,kBAAe,cAAc,CAAC","sourcesContent":["import { createFilter } from '@rollup/pluginutils';\r\nimport type { RollupError, RollupLog } from 'rollup';\r\nimport { resolveCompiler } from './compiler';\r\nimport { parseVueRequest } from './utils/query';\r\nimport { transformMain } from './main';\r\nimport type { Options, ResolvedOptions, VueTransformerContext, VueResolvedId } from './types';\r\n\r\nexport { parseVueRequest, VueQuery } from './utils/query';\r\n\r\nclass VueTransformer implements VueTransformerContext {\r\n\tprivate customElementFilter: (id: unknown) => boolean;\r\n\tprivate options: ResolvedOptions;\r\n\tprivate isSSR = (opt: { ssr?: boolean } | boolean | undefined) =>\r\n\t\topt === undefined ? false : typeof opt === 'boolean' ? opt : opt?.ssr === true;\r\n\r\n\tconstructor(rawOptions: Options = {}) {\r\n\t\tconst { include = /\\.vue$/, exclude, customElement = /\\.ce\\.vue$/, reactivityTransform = false } = rawOptions;\r\n\t\tthis.customElementFilter = typeof customElement === 'boolean' ? () => customElement : createFilter(customElement);\r\n\r\n\t\tconst rootDir: string = process.cwd();\r\n\t\tthis.options = {\r\n\t\t\tisProduction: process.env.NODE_ENV === 'production',\r\n\t\t\tcompiler: resolveCompiler(rootDir),\r\n\t\t\t...rawOptions,\r\n\t\t\tinclude,\r\n\t\t\texclude,\r\n\t\t\tcustomElement,\r\n\t\t\treactivityTransform,\r\n\t\t\troot: rootDir,\r\n\t\t\tsourceMap: true\r\n\t\t};\r\n\t}\r\n\r\n\tpublic error = (err: string | RollupError, pos?: number | { column: number; line: number } | undefined): void => {};\r\n\r\n\tpublic resolve = (id: string): VueResolvedId | null => {\r\n\t\t// serve sub-part requests (*?vue) as virtual modules\r\n\t\tif (parseVueRequest(id).query.vue) {\r\n\t\t\treturn { external: false, id: id };\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\r\n\tpublic warn = (warning: RollupLog | string, pos?: number | { column: number; line: number } | undefined): void => {};\r\n\r\n\tpublic transformCode = (code: string, filename: string) => {\r\n\t\tconst ssr = this.isSSR(false);\r\n\t\tconst result = transformMain(code, filename, this.options, this, ssr, this.customElementFilter(filename));\r\n\t\treturn { code: result?.code, map: result?.map.mappings };\r\n\t};\r\n}\r\n\r\nexport default VueTransformer;\r\n"]}
@@ -1,8 +0,0 @@
1
- import type { RawSourceMap } from 'source-map';
2
- import { VueTransformerContext, ResolvedOptions } from './types';
3
- export declare const transformMain: (code: string, filename: string, options: ResolvedOptions, transformerContext: VueTransformerContext, ssr: boolean, asCustomElement: boolean) => {
4
- code: string;
5
- map: RawSourceMap | {
6
- mappings: string;
7
- };
8
- };