@teleporthq/teleport-plugin-next-workflows 0.43.64 → 0.43.65
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/__tests__/custom-node-page-route-rewrite.test.ts +109 -0
- package/__tests__/resolve-handler-entry-name.test.ts +25 -0
- package/dist/cjs/nodes/analytics/commerce-tracking.d.ts +38 -2
- package/dist/cjs/nodes/analytics/commerce-tracking.d.ts.map +1 -1
- package/dist/cjs/nodes/analytics/commerce-tracking.js +41 -26
- package/dist/cjs/nodes/analytics/commerce-tracking.js.map +1 -1
- package/dist/cjs/nodes/cart/cart-add-item.d.ts.map +1 -1
- package/dist/cjs/nodes/cart/cart-add-item.js +3 -1
- package/dist/cjs/nodes/cart/cart-add-item.js.map +1 -1
- package/dist/cjs/nodes/types.d.ts.map +1 -1
- package/dist/cjs/nodes/types.js +19 -0
- package/dist/cjs/nodes/types.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/cjs/workflow-project-plugin.d.ts.map +1 -1
- package/dist/cjs/workflow-project-plugin.js +39 -30
- package/dist/cjs/workflow-project-plugin.js.map +1 -1
- package/dist/esm/nodes/analytics/commerce-tracking.d.ts +38 -2
- package/dist/esm/nodes/analytics/commerce-tracking.d.ts.map +1 -1
- package/dist/esm/nodes/analytics/commerce-tracking.js +41 -26
- package/dist/esm/nodes/analytics/commerce-tracking.js.map +1 -1
- package/dist/esm/nodes/cart/cart-add-item.d.ts.map +1 -1
- package/dist/esm/nodes/cart/cart-add-item.js +3 -1
- package/dist/esm/nodes/cart/cart-add-item.js.map +1 -1
- package/dist/esm/nodes/types.d.ts.map +1 -1
- package/dist/esm/nodes/types.js +19 -0
- package/dist/esm/nodes/types.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/workflow-project-plugin.d.ts.map +1 -1
- package/dist/esm/workflow-project-plugin.js +39 -30
- package/dist/esm/workflow-project-plugin.js.map +1 -1
- package/package.json +4 -4
- package/src/nodes/analytics/commerce-tracking.ts +37 -21
- package/src/nodes/cart/cart-add-item.ts +3 -1
- package/src/nodes/types.ts +23 -0
- package/src/workflow-project-plugin.ts +37 -29
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { NextWorkflowProjectPlugin } from '../src/workflow-project-plugin'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `runBefore` rewrites every `navigation-go-to-page` node's `config.pageId`
|
|
5
|
+
* from a UIDL page id to the real Next.js route. It used to walk only
|
|
6
|
+
* `workflows.workflows`, so the same node inside a shared CUSTOM NODE reached
|
|
7
|
+
* the generated `custom-nodes.js` still holding the raw page id.
|
|
8
|
+
*
|
|
9
|
+
* The runtime then fell through to `targetPage.staticUrl`, which is the
|
|
10
|
+
* mapper's best guess: it is `/home` for the home page even though Next serves
|
|
11
|
+
* it at `/`, and it keeps pointing at a page that has since been deleted. Both
|
|
12
|
+
* end on a 404, and only when the navigation came from a custom node.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const goToPage = (id: string, pageId: string, targetPage?: Record<string, unknown>) => ({
|
|
16
|
+
id,
|
|
17
|
+
type: 'navigation-go-to-page',
|
|
18
|
+
config: { pageId, ...(targetPage ? { targetPage } : {}) },
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const structure = (uidl: unknown): any => ({
|
|
22
|
+
uidl,
|
|
23
|
+
strategy: { pages: { options: {} } },
|
|
24
|
+
files: new Map(),
|
|
25
|
+
dependencies: {},
|
|
26
|
+
devDependencies: {},
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const projectUidl = (): any => ({
|
|
30
|
+
name: 'Store',
|
|
31
|
+
globals: { settings: { title: 'Store' }, env: {} },
|
|
32
|
+
root: {
|
|
33
|
+
name: 'Root',
|
|
34
|
+
stateDefinitions: {
|
|
35
|
+
route: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
defaultValue: 'Home',
|
|
38
|
+
values: [
|
|
39
|
+
{ value: 'Home', pageId: 'TQ_home' },
|
|
40
|
+
{ value: 'products-list', pageId: 'TQ_products', pageOptions: { navLink: '/menu' } },
|
|
41
|
+
{ value: '404 - Not Found', pageOptions: { fallback: true } },
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
node: { type: 'element', content: { elementType: 'container', children: [] } },
|
|
46
|
+
},
|
|
47
|
+
components: {},
|
|
48
|
+
workflows: {
|
|
49
|
+
workflows: {
|
|
50
|
+
wf1: {
|
|
51
|
+
id: 'wf1',
|
|
52
|
+
name: 'Go home',
|
|
53
|
+
trigger: { type: 'event-element-clicked', scope: 'page', nodeId: 't1' },
|
|
54
|
+
nodes: [goToPage('n1', 'TQ_home', { pageId: 'TQ_home', staticUrl: '/home' })],
|
|
55
|
+
edges: [],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
customNodes: {
|
|
59
|
+
cn1: {
|
|
60
|
+
id: 'cn1',
|
|
61
|
+
name: 'Require login',
|
|
62
|
+
nodes: [
|
|
63
|
+
goToPage('n2', 'TQ_home', { pageId: 'TQ_home', staticUrl: '/home' }),
|
|
64
|
+
goToPage('n3', 'TQ_products', { pageId: 'TQ_products', staticUrl: '/products-list' }),
|
|
65
|
+
],
|
|
66
|
+
edges: [],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
describe('runBefore — navigation-go-to-page page ids inside custom nodes', () => {
|
|
73
|
+
it('rewrites custom-node page ids to the real route, like workflow nodes', async () => {
|
|
74
|
+
const uidl = projectUidl()
|
|
75
|
+
await new NextWorkflowProjectPlugin().runBefore(structure(uidl))
|
|
76
|
+
|
|
77
|
+
const customNodes = uidl.workflows.customNodes.cn1.nodes
|
|
78
|
+
// The home page's staticUrl is '/home', but Next serves it at '/'. Leaving
|
|
79
|
+
// the raw id made the runtime prefer staticUrl and 404.
|
|
80
|
+
expect(customNodes[0].config.pageId).toBe('/')
|
|
81
|
+
expect(customNodes[1].config.pageId).toBe('/menu')
|
|
82
|
+
// Unchanged behaviour for the workflow that already worked.
|
|
83
|
+
expect(uidl.workflows.workflows.wf1.nodes[0].config.pageId).toBe('/')
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
// The reported scenario: every page was deleted while e-commerce stayed on,
|
|
87
|
+
// so the route map is empty and the custom node still points at a page id
|
|
88
|
+
// that resolves to nothing. It gets the same default-route treatment a
|
|
89
|
+
// workflow node has always had, instead of shipping the raw id.
|
|
90
|
+
it('sends a custom-node reference to a deleted page to the default route', async () => {
|
|
91
|
+
const uidl = projectUidl()
|
|
92
|
+
uidl.root.stateDefinitions.route = {
|
|
93
|
+
type: 'string',
|
|
94
|
+
defaultValue: '404 - Not Found',
|
|
95
|
+
values: [{ value: '404 - Not Found', pageOptions: { fallback: true } }],
|
|
96
|
+
}
|
|
97
|
+
uidl.workflows.customNodes.cn1.nodes = [goToPage('n4', 'TQ_deleted')]
|
|
98
|
+
await new NextWorkflowProjectPlugin().runBefore(structure(uidl))
|
|
99
|
+
|
|
100
|
+
expect(uidl.workflows.customNodes.cn1.nodes[0].config.pageId).toBe('/')
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
it('does not throw for a project that has custom nodes but no workflows', async () => {
|
|
104
|
+
const uidl = projectUidl()
|
|
105
|
+
delete uidl.workflows.workflows
|
|
106
|
+
await expect(new NextWorkflowProjectPlugin().runBefore(structure(uidl))).resolves.toBeDefined()
|
|
107
|
+
expect(uidl.workflows.customNodes.cn1.nodes[0].config.pageId).toBe('/')
|
|
108
|
+
})
|
|
109
|
+
})
|
|
@@ -80,6 +80,31 @@ async function zzz(config, context) { return one_param_helper(config); }
|
|
|
80
80
|
)
|
|
81
81
|
})
|
|
82
82
|
|
|
83
|
+
/**
|
|
84
|
+
* The shipped break this guards: a helper read back through
|
|
85
|
+
* `helper.toString()` had that read as its ONLY reference, so a consumer's
|
|
86
|
+
* minifier inlined the declaration and dropped the name. The concatenated
|
|
87
|
+
* handler then carried `function(e){...}` in STATEMENT position, and
|
|
88
|
+
* `next build` of the generated project failed with SWC's "Expected ident"
|
|
89
|
+
* in utils/workflows/node-handlers-client.js — visible only in a minified
|
|
90
|
+
* build, so nothing reading the unminified source could catch it.
|
|
91
|
+
*/
|
|
92
|
+
it('rejects a helper that a minifier left anonymous in statement position', () => {
|
|
93
|
+
const source = `async function cart_add_item(config) { trackCommerceStep({ name: 'add_to_cart' }); }
|
|
94
|
+
function(e){try{const t=globalThis.tpTrackCommerce;"function"==typeof t&&t(e.name,e.detail)}catch(e){}}`
|
|
95
|
+
expect(() => resolveHandlerEntryName(source, 'cart-add-item')).toThrow(
|
|
96
|
+
/anonymous function where a statement is expected/
|
|
97
|
+
)
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it('accepts an anonymous function that is an expression, not a statement', () => {
|
|
101
|
+
// `wrapWithGuard`'s re-declaration guard and any inline callback keep the
|
|
102
|
+
// `function` keyword off the start of a line — those are valid and common.
|
|
103
|
+
const source = `var util = typeof util !== 'undefined' ? util : function (val) { return val; };
|
|
104
|
+
async function my_node_type(config, context) { return [config].map(function (c) { return c; }); }`
|
|
105
|
+
expect(resolveHandlerEntryName(source, 'my-node-type')).toBe('my_node_type')
|
|
106
|
+
})
|
|
107
|
+
|
|
83
108
|
// Full-registry regression: every node type's generateHandler()/
|
|
84
109
|
// generateServerHandler() output must resolve to a real, callable function
|
|
85
110
|
// both normally AND after its entry function's declared name is renamed
|
|
@@ -32,8 +32,44 @@
|
|
|
32
32
|
* definition travels with it. `assertHandlerHasNoModuleRefs` fails the build if
|
|
33
33
|
* a module reference ever creeps back in.
|
|
34
34
|
*/
|
|
35
|
-
/**
|
|
36
|
-
|
|
35
|
+
/**
|
|
36
|
+
* ⛔ A STRING LITERAL, not `someFunction.toString()`. Not a style choice.
|
|
37
|
+
*
|
|
38
|
+
* The helper used to be a real TypeScript function read back through
|
|
39
|
+
* `.toString()`. Its ONLY reference was that read, so when a consumer bundles
|
|
40
|
+
* and minifies this package (teleport-gui's browser packer worker, webpack +
|
|
41
|
+
* Terser) the minifier inlined the single-use declaration into the call site
|
|
42
|
+
* and dropped the now-pointless name:
|
|
43
|
+
*
|
|
44
|
+
* COMMERCE_TRACKING_HELPER_SOURCE = function(e){ ... }.toString()
|
|
45
|
+
*
|
|
46
|
+
* The emitted text was therefore an ANONYMOUS function expression, and every
|
|
47
|
+
* consumer of this constant appends it as a STATEMENT after a handler. A
|
|
48
|
+
* statement-position `function(e){…}` is not parseable, so `next build` of the
|
|
49
|
+
* generated project died in `utils/workflows/node-handlers-client.js` with
|
|
50
|
+
* SWC's "Expected ident" — for any store with an add-to-cart or
|
|
51
|
+
* remove-from-cart workflow, and only in a minified build, so no local run and
|
|
52
|
+
* no source-reading test could see it.
|
|
53
|
+
*
|
|
54
|
+
* A string literal is immune: a minifier never rewrites the contents of one.
|
|
55
|
+
* It also keeps the emitted name EXACTLY `trackCommerceStep`, which is the name
|
|
56
|
+
* every caller's ambient `declare function` leaves in its serialized body, so
|
|
57
|
+
* no bundler-name aliasing is needed either.
|
|
58
|
+
*
|
|
59
|
+
* ⛔ EXACTLY ONE PARAMETER, for the same reason the arity mattered before:
|
|
60
|
+
* `resolveHandlerEntryName` identifies a minified handler's entry point by
|
|
61
|
+
* ARITY, preferring a 2-param declaration because every real entry is
|
|
62
|
+
* `(config, context)`. A 2-param helper concatenated after a 1-param entry
|
|
63
|
+
* would WIN, and the generated workflow would call the tracking helper where it
|
|
64
|
+
* meant to call add-to-cart. One object parameter keeps the helper out of that
|
|
65
|
+
* contest. `resolve-handler-entry-name.test.ts` checks every registered node
|
|
66
|
+
* type against exactly this, and is what caught it.
|
|
67
|
+
*
|
|
68
|
+
* Declared with `function` (not `var f = function`) so that concatenating it
|
|
69
|
+
* after a handler stays a plain, re-declarable statement in whatever scope the
|
|
70
|
+
* emitters splice it into.
|
|
71
|
+
*/
|
|
72
|
+
export declare const COMMERCE_TRACKING_HELPER_SOURCE = "function trackCommerceStep(step) {\n try {\n var tracker = globalThis.tpTrackCommerce;\n if (typeof tracker === 'function') {\n tracker(step.name, step.detail);\n }\n } catch (err) {\n /* analytics must never break a cart or a checkout */\n }\n}";
|
|
37
73
|
/**
|
|
38
74
|
* Fails the BUILD when a serialized handler still references a module namespace.
|
|
39
75
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commerce-tracking.d.ts","sourceRoot":"","sources":["../../../../src/nodes/analytics/commerce-tracking.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;
|
|
1
|
+
{"version":3,"file":"commerce-tracking.d.ts","sourceRoot":"","sources":["../../../../src/nodes/analytics/commerce-tracking.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,+BAA+B,8QAS1C,CAAA;AAQF;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAWrF"}
|
|
@@ -36,37 +36,52 @@
|
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.assertHandlerHasNoModuleRefs = exports.COMMERCE_TRACKING_HELPER_SOURCE = void 0;
|
|
38
38
|
/**
|
|
39
|
-
* ⛔
|
|
39
|
+
* ⛔ A STRING LITERAL, not `someFunction.toString()`. Not a style choice.
|
|
40
40
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* where it meant to call add-to-cart.
|
|
41
|
+
* The helper used to be a real TypeScript function read back through
|
|
42
|
+
* `.toString()`. Its ONLY reference was that read, so when a consumer bundles
|
|
43
|
+
* and minifies this package (teleport-gui's browser packer worker, webpack +
|
|
44
|
+
* Terser) the minifier inlined the single-use declaration into the call site
|
|
45
|
+
* and dropped the now-pointless name:
|
|
47
46
|
*
|
|
48
|
-
*
|
|
49
|
-
* positional fallback then correctly picks the entry, which is emitted first.
|
|
50
|
-
* `resolve-handler-entry-name.test.ts` checks every registered node type against
|
|
51
|
-
* exactly this, and is what caught it.
|
|
47
|
+
* COMMERCE_TRACKING_HELPER_SOURCE = function(e){ ... }.toString()
|
|
52
48
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
49
|
+
* The emitted text was therefore an ANONYMOUS function expression, and every
|
|
50
|
+
* consumer of this constant appends it as a STATEMENT after a handler. A
|
|
51
|
+
* statement-position `function(e){…}` is not parseable, so `next build` of the
|
|
52
|
+
* generated project died in `utils/workflows/node-handlers-client.js` with
|
|
53
|
+
* SWC's "Expected ident" — for any store with an add-to-cart or
|
|
54
|
+
* remove-from-cart workflow, and only in a minified build, so no local run and
|
|
55
|
+
* no source-reading test could see it.
|
|
56
|
+
*
|
|
57
|
+
* A string literal is immune: a minifier never rewrites the contents of one.
|
|
58
|
+
* It also keeps the emitted name EXACTLY `trackCommerceStep`, which is the name
|
|
59
|
+
* every caller's ambient `declare function` leaves in its serialized body, so
|
|
60
|
+
* no bundler-name aliasing is needed either.
|
|
61
|
+
*
|
|
62
|
+
* ⛔ EXACTLY ONE PARAMETER, for the same reason the arity mattered before:
|
|
63
|
+
* `resolveHandlerEntryName` identifies a minified handler's entry point by
|
|
64
|
+
* ARITY, preferring a 2-param declaration because every real entry is
|
|
65
|
+
* `(config, context)`. A 2-param helper concatenated after a 1-param entry
|
|
66
|
+
* would WIN, and the generated workflow would call the tracking helper where it
|
|
67
|
+
* meant to call add-to-cart. One object parameter keeps the helper out of that
|
|
68
|
+
* contest. `resolve-handler-entry-name.test.ts` checks every registered node
|
|
69
|
+
* type against exactly this, and is what caught it.
|
|
70
|
+
*
|
|
71
|
+
* Declared with `function` (not `var f = function`) so that concatenating it
|
|
72
|
+
* after a handler stays a plain, re-declarable statement in whatever scope the
|
|
73
|
+
* emitters splice it into.
|
|
55
74
|
*/
|
|
56
|
-
function trackCommerceStep(step) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
tracker(step.name, step.detail);
|
|
62
|
-
}
|
|
75
|
+
exports.COMMERCE_TRACKING_HELPER_SOURCE = `function trackCommerceStep(step) {
|
|
76
|
+
try {
|
|
77
|
+
var tracker = globalThis.tpTrackCommerce;
|
|
78
|
+
if (typeof tracker === 'function') {
|
|
79
|
+
tracker(step.name, step.detail);
|
|
63
80
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
/** ES5 source of the helper, for concatenating after a serialized handler. */
|
|
69
|
-
exports.COMMERCE_TRACKING_HELPER_SOURCE = trackCommerceStep.toString();
|
|
81
|
+
} catch (err) {
|
|
82
|
+
/* analytics must never break a cart or a checkout */
|
|
83
|
+
}
|
|
84
|
+
}`;
|
|
70
85
|
/**
|
|
71
86
|
* Matches the two shapes TypeScript's CJS emit produces for a cross-module
|
|
72
87
|
* call — `(0, ns_1.fn)(…)` and a bare `ns_1.fn(…)`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commerce-tracking.js","sourceRoot":"","sources":["../../../../src/nodes/analytics/commerce-tracking.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;;;AAEH
|
|
1
|
+
{"version":3,"file":"commerce-tracking.js","sourceRoot":"","sources":["../../../../src/nodes/analytics/commerce-tracking.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;;;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACU,QAAA,+BAA+B,GAAG;;;;;;;;;EAS7C,CAAA;AAEF;;;GAGG;AACH,MAAM,gBAAgB,GAAG,6BAA6B,CAAA;AAEtD;;;;;;;GAOG;AACH,SAAgB,4BAA4B,CAAC,MAAc,EAAE,QAAgB;IAC3E,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAA;IAC5C,IAAI,KAAK,EAAE;QACT,MAAM,IAAI,KAAK,CACb,QAAQ,QAAQ,8CAA8C,KAAK,CAAC,CAAC,CAAC,KAAK;YACzE,6EAA6E;YAC7E,8EAA8E;YAC9E,iCAAiC,CACpC,CAAA;KACF;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAXD,oEAWC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart-add-item.d.ts","sourceRoot":"","sources":["../../../../src/nodes/cart/cart-add-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAmB,MAAM,UAAU,CAAA;AAmJhE,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"cart-add-item.d.ts","sourceRoot":"","sources":["../../../../src/nodes/cart/cart-add-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAmB,MAAM,UAAU,CAAA;AAmJhE,eAAO,MAAM,WAAW,EAAE,oBAazB,CAAA"}
|
|
@@ -138,7 +138,9 @@ exports.cartAddItem = {
|
|
|
138
138
|
executionEnv: 'client',
|
|
139
139
|
generateHandler() {
|
|
140
140
|
// The helper is concatenated rather than imported: the handler ships as a
|
|
141
|
-
// serialized function body with no module scope.
|
|
141
|
+
// serialized function body with no module scope. It is a string literal
|
|
142
|
+
// rather than a `.toString()` so a consumer's minifier cannot strip its
|
|
143
|
+
// declaration name. See `commerce-tracking.ts`.
|
|
142
144
|
return (0, commerce_tracking_1.assertHandlerHasNoModuleRefs)((0, types_1.handlerToString)(cart_add_item) + '\n' + commerce_tracking_1.COMMERCE_TRACKING_HELPER_SOURCE, 'cart-add-item');
|
|
143
145
|
},
|
|
144
146
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart-add-item.js","sourceRoot":"","sources":["../../../../src/nodes/cart/c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G,MAAM,CAErD;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/nodes/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AAE/F,wBAAgB,eAAe,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,CAErD;AAkCD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAwEhF;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAA;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,eAAe,IAAI,MAAM,CAAA;IACzB,qBAAqB,CAAC,IAAI,MAAM,CAAA;CACjC;AAED,MAAM,WAAW,2BAA4B,SAAQ,oBAAoB;IACvE,YAAY,EAAE,MAAM,EAAE,CAAA;CACvB"}
|
package/dist/cjs/nodes/types.js
CHANGED
|
@@ -5,6 +5,19 @@ function handlerToString(fn) {
|
|
|
5
5
|
return fn.toString();
|
|
6
6
|
}
|
|
7
7
|
exports.handlerToString = handlerToString;
|
|
8
|
+
// A `function` keyword opening a line with no name after it: an anonymous
|
|
9
|
+
// function EXPRESSION sitting where the emitters splice a STATEMENT, which
|
|
10
|
+
// makes the whole generated handler file unparseable ("Expected ident" from
|
|
11
|
+
// SWC when the generated project builds).
|
|
12
|
+
//
|
|
13
|
+
// A minifier produces exactly this when it inlines a single-use function into
|
|
14
|
+
// the `.toString()` that reads it — `export const SRC = helper.toString()`
|
|
15
|
+
// becomes `export const SRC = function(e){…}.toString()`, and the name is gone
|
|
16
|
+
// because nothing referenced it. It is invisible to every test that reads the
|
|
17
|
+
// unminified source, and only a consumer's production bundle (teleport-gui's
|
|
18
|
+
// packer worker) is minified, so it reaches a shopper's build untouched.
|
|
19
|
+
// `commerce-tracking.ts` explains the shape a helper must use instead.
|
|
20
|
+
const ANONYMOUS_FUNCTION_STATEMENT = /(?:^|\n)[ \t]*(?:async[ \t]+)?function[ \t]*\(/;
|
|
8
21
|
// Resolves the name a handler's entry function is ACTUALLY declared with in
|
|
9
22
|
// `source`, rather than assuming it always equals the
|
|
10
23
|
// `nodeType.replace(/-/g, '_')` convention name.
|
|
@@ -24,6 +37,12 @@ exports.handlerToString = handlerToString;
|
|
|
24
37
|
// of a string literal — so the convention name is still correct for those;
|
|
25
38
|
// this only needs to look further when it's genuinely absent from `source`.
|
|
26
39
|
function resolveHandlerEntryName(source, nodeType) {
|
|
40
|
+
if (ANONYMOUS_FUNCTION_STATEMENT.test(source)) {
|
|
41
|
+
throw new Error(`The "${nodeType}" handler contains an anonymous function where a statement is ` +
|
|
42
|
+
'expected, so the generated handler file would not parse. A minifier that inlined ' +
|
|
43
|
+
'a single-use function into the `.toString()` reading it produces this; build the ' +
|
|
44
|
+
'emitted source from a string literal instead (see commerce-tracking.ts).');
|
|
45
|
+
}
|
|
27
46
|
const conventionName = nodeType.replace(/-/g, '_');
|
|
28
47
|
const conventionNameUsed = new RegExp(`(?:^|[^\\w$])${conventionName}\\s*\\(`).test(source);
|
|
29
48
|
if (conventionNameUsed) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/nodes/types.ts"],"names":[],"mappings":";;;AAEA,SAAgB,eAAe,CAAC,EAAa;IAC3C,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAA;AACtB,CAAC;AAFD,0CAEC;AAED,4EAA4E;AAC5E,sDAAsD;AACtD,iDAAiD;AACjD,EAAE;AACF,qEAAqE;AACrE,0EAA0E;AAC1E,4EAA4E;AAC5E,8EAA8E;AAC9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