@aws/nx-plugin 0.89.0 → 0.90.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/package.json +1 -1
- package/sdk/utils/ast.d.ts +2 -1
- package/sdk/utils/ast.js +4 -2
- package/sdk/utils/ast.js.map +1 -1
- package/src/connection/generator.d.ts +2 -2
- package/src/connection/generator.js +13 -13
- package/src/connection/generator.js.map +1 -1
- package/src/connection/serve-local.js +1 -1
- package/src/connection/serve-local.js.map +1 -1
- package/src/mcp-server/generator-info.d.ts +8 -4
- package/src/mcp-server/generator-info.js +63 -15
- package/src/mcp-server/generator-info.js.map +1 -1
- package/src/preset/__snapshots__/generator.spec.ts.snap +1 -3
- package/src/py/strands-agent/mcp-connection/generator.js +9 -9
- package/src/py/strands-agent/mcp-connection/generator.js.map +1 -1
- package/src/smithy/ts/api/generator.js +2 -2
- package/src/smithy/ts/api/generator.js.map +1 -1
- package/src/trpc/backend/generator.js +1 -1
- package/src/trpc/backend/generator.js.map +1 -1
- package/src/trpc/react/generator.js +4 -4
- package/src/trpc/react/generator.js.map +1 -1
- package/src/ts/lambda-function/generator.js +1 -1
- package/src/ts/lambda-function/generator.js.map +1 -1
- package/src/ts/lib/eslint.d.ts +1 -1
- package/src/ts/lib/eslint.js +23 -36
- package/src/ts/lib/eslint.js.map +1 -1
- package/src/ts/lib/generator.js +4 -7
- package/src/ts/lib/generator.js.map +1 -1
- package/src/ts/lib/grit/eslint-dependency-checks-warn.grit +1 -0
- package/src/ts/lib/grit/vitest-pass-with-no-tests.grit +7 -0
- package/src/ts/lib/ts-project-utils.js +1 -1
- package/src/ts/lib/ts-project-utils.js.map +1 -1
- package/src/ts/lib/vitest.d.ts +1 -1
- package/src/ts/lib/vitest.js +4 -16
- package/src/ts/lib/vitest.js.map +1 -1
- package/src/ts/mcp-server/generator.js +1 -1
- package/src/ts/mcp-server/generator.js.map +1 -1
- package/src/ts/nx-generator/generator.d.ts +1 -1
- package/src/ts/nx-generator/generator.js +1 -1
- package/src/ts/nx-generator/generator.js.map +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +29 -17
- package/src/ts/react-website/app/generator.js +14 -50
- package/src/ts/react-website/app/generator.js.map +1 -1
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.ux-provider.spec.ts.snap +5 -7
- package/src/ts/react-website/cognito-auth/generator.js +5 -25
- package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
- package/src/ts/react-website/cognito-auth/grit/app-layout-use-auth.grit +10 -0
- package/src/ts/react-website/cognito-auth/grit/cognito-auth-wrapper.grit +3 -0
- package/src/ts/react-website/cognito-auth/utils.js +4 -4
- package/src/ts/react-website/cognito-auth/utils.js.map +1 -1
- package/src/ts/react-website/runtime-config/generator.js +2 -2
- package/src/ts/react-website/runtime-config/generator.js.map +1 -1
- package/src/ts/strands-agent/generator.js +1 -1
- package/src/ts/strands-agent/generator.js.map +1 -1
- package/src/ts/strands-agent/mcp-connection/generator.js +2 -2
- package/src/ts/strands-agent/mcp-connection/generator.js.map +1 -1
- package/src/utils/agent-connection/agent-connection.js +4 -4
- package/src/utils/agent-connection/agent-connection.js.map +1 -1
- package/src/utils/ast/website.js +63 -120
- package/src/utils/ast/website.js.map +1 -1
- package/src/utils/ast.d.ts +5 -25
- package/src/utils/ast.js +29 -160
- package/src/utils/ast.js.map +1 -1
- package/src/utils/bundle/bundle.d.ts +1 -1
- package/src/utils/bundle/bundle.js +26 -71
- package/src/utils/bundle/bundle.js.map +1 -1
- package/src/utils/commands.d.ts +33 -0
- package/src/utils/commands.js +55 -0
- package/src/utils/commands.js.map +1 -0
- package/src/utils/config/__snapshots__/utils.spec.ts.snap +88 -0
- package/src/utils/config/utils.d.ts +2 -1
- package/src/utils/config/utils.js +47 -29
- package/src/utils/config/utils.js.map +1 -1
- package/src/utils/connection/open-api/react.js +4 -4
- package/src/utils/connection/open-api/react.js.map +1 -1
- package/src/utils/generators.d.ts +13 -0
- package/src/utils/generators.js +26 -0
- package/src/utils/generators.js.map +1 -0
- package/src/utils/metrics.js +6 -6
- package/src/utils/metrics.js.map +1 -1
- package/src/utils/nx.d.ts +4 -10
- package/src/utils/nx.js +5 -19
- package/src/utils/nx.js.map +1 -1
- package/src/utils/pkg-manager.d.ts +2 -22
- package/src/utils/pkg-manager.js +2 -7
- package/src/utils/pkg-manager.js.map +1 -1
- package/src/utils/shared-shadcn.js +8 -15
- package/src/utils/shared-shadcn.js.map +1 -1
- package/src/utils/bundle/__snapshots__/bundle.spec.ts.snap +0 -46
package/src/utils/ast/website.js
CHANGED
|
@@ -5,131 +5,74 @@ exports.addHookResultToRouterProviderContext = void 0;
|
|
|
5
5
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
6
|
* SPDX-License-Identifier: Apache-2.0
|
|
7
7
|
*/
|
|
8
|
-
const typescript_1 = require("typescript");
|
|
9
8
|
const ast_1 = require("../ast");
|
|
10
9
|
const addHookResultToRouterProviderContext = async (tree, mainTsxPath, { hook, module, contextProp }) => {
|
|
11
|
-
//
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const hasRouterProviderComponent = (0, ast_1.query)(tree, mainTsxPath, routerProviderComponentSelector).length > 0;
|
|
20
|
-
if (!hasRouterProviderContext ||
|
|
21
|
-
!hasRouter ||
|
|
22
|
-
!hasApp ||
|
|
23
|
-
!hasRouterProviderComponent) {
|
|
10
|
+
// All 4 patterns must exist for this transform to apply
|
|
11
|
+
const checks = await Promise.all([
|
|
12
|
+
(0, ast_1.matchGritQL)(tree, mainTsxPath, '`RouterProviderContext`'),
|
|
13
|
+
(0, ast_1.matchGritQL)(tree, mainTsxPath, '`createRouter($_)`'),
|
|
14
|
+
(0, ast_1.matchGritQL)(tree, mainTsxPath, '`const App = $_`'),
|
|
15
|
+
(0, ast_1.matchGritQL)(tree, mainTsxPath, '`<RouterProvider $_ />`'),
|
|
16
|
+
]);
|
|
17
|
+
if (checks.some((c) => !c)) {
|
|
24
18
|
return;
|
|
25
19
|
}
|
|
26
20
|
await (0, ast_1.addDestructuredImport)(tree, mainTsxPath, [hook], module);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
//
|
|
43
|
-
(0, ast_1.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
});
|
|
83
|
-
if (!hasHookCall) {
|
|
84
|
-
// Prepend the following statement: `const <contextProp> = <hook>();`
|
|
85
|
-
const newStatements = [
|
|
86
|
-
typescript_1.factory.createVariableStatement(undefined, typescript_1.factory.createVariableDeclarationList([
|
|
87
|
-
typescript_1.factory.createVariableDeclaration(typescript_1.factory.createIdentifier(contextProp), undefined, undefined, typescript_1.factory.createCallExpression(typescript_1.factory.createIdentifier(hook), undefined, [])),
|
|
88
|
-
], typescript_1.NodeFlags.Const)),
|
|
89
|
-
// Add existing statements or create return statement for expression body
|
|
90
|
-
...(isBlockBody
|
|
91
|
-
? existingStatements
|
|
92
|
-
: [typescript_1.factory.createReturnStatement(node.body)]),
|
|
93
|
-
];
|
|
94
|
-
return typescript_1.factory.createArrowFunction(node.modifiers, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, typescript_1.factory.createBlock(newStatements, true));
|
|
95
|
-
}
|
|
96
|
-
return node;
|
|
97
|
-
});
|
|
98
|
-
// Add the context prop to the RouterProvider context prop, eg: <RouterProvider router={router} context={{ ...existing, <contextProp> }} />;
|
|
99
|
-
(0, ast_1.replace)(tree, mainTsxPath, routerProviderComponentSelector, (node) => {
|
|
100
|
-
// Find existing context attribute
|
|
101
|
-
const existingContextAttr = node.attributes.properties.find((attr) => attr.kind === typescript_1.SyntaxKind.JsxAttribute &&
|
|
102
|
-
attr.name &&
|
|
103
|
-
attr.name.kind === typescript_1.SyntaxKind.Identifier &&
|
|
104
|
-
attr.name.text === 'context');
|
|
105
|
-
// Get existing context properties if they exist
|
|
106
|
-
const existingContextProps = existingContextAttr &&
|
|
107
|
-
existingContextAttr.initializer &&
|
|
108
|
-
existingContextAttr.initializer.kind === typescript_1.SyntaxKind.JsxExpression &&
|
|
109
|
-
existingContextAttr.initializer.expression &&
|
|
110
|
-
existingContextAttr.initializer.expression.kind ===
|
|
111
|
-
typescript_1.SyntaxKind.ObjectLiteralExpression
|
|
112
|
-
? existingContextAttr.initializer
|
|
113
|
-
.expression.properties
|
|
114
|
-
: [];
|
|
115
|
-
// Create new context attribute with existing props plus the new context prop
|
|
116
|
-
const newContextAttr = typescript_1.factory.createJsxAttribute(typescript_1.factory.createIdentifier('context'), typescript_1.factory.createJsxExpression(undefined, typescript_1.factory.createObjectLiteralExpression([
|
|
117
|
-
// Add existing properties
|
|
118
|
-
...existingContextProps,
|
|
119
|
-
// Add the new context prop as shorthand property assignment
|
|
120
|
-
typescript_1.factory.createShorthandPropertyAssignment(typescript_1.factory.createIdentifier(contextProp)),
|
|
121
|
-
])));
|
|
122
|
-
// Create new JSX self-closing element with all existing attributes except 'context', plus the new context attribute
|
|
123
|
-
return typescript_1.factory.createJsxSelfClosingElement(node.tagName, node.typeArguments, typescript_1.factory.createJsxAttributes([
|
|
124
|
-
// Include all existing attributes except 'context'
|
|
125
|
-
...node.attributes.properties.filter((attr) => !(attr.kind === typescript_1.SyntaxKind.JsxAttribute &&
|
|
126
|
-
attr.name &&
|
|
127
|
-
attr.name.kind === typescript_1.SyntaxKind.Identifier &&
|
|
128
|
-
attr.name.text === 'context')),
|
|
129
|
-
// Add the new context attribute
|
|
130
|
-
newContextAttr,
|
|
131
|
-
]));
|
|
132
|
-
});
|
|
21
|
+
// 1. Add property to RouterProviderContext type
|
|
22
|
+
// 'some' checks direct members only (not nested), so a nested 'auth' won't block adding a top-level one.
|
|
23
|
+
// Type members use ; as terminators, so += with leading \n handles separation.
|
|
24
|
+
await (0, ast_1.applyGritQL)(tree, mainTsxPath, `or {
|
|
25
|
+
\`type RouterProviderContext = {}\` => \`type RouterProviderContext = {
|
|
26
|
+
${contextProp}?: ReturnType<typeof ${hook}>;
|
|
27
|
+
}\`,
|
|
28
|
+
\`type RouterProviderContext = { $members }\` where {
|
|
29
|
+
$members <: not some \`${contextProp}?: $_\`,
|
|
30
|
+
$members += \`
|
|
31
|
+
${contextProp}?: ReturnType<typeof ${hook}>\`
|
|
32
|
+
}
|
|
33
|
+
}`);
|
|
34
|
+
// 2. Add context property to createRouter config
|
|
35
|
+
// 'some' checks direct properties of the createRouter argument object only.
|
|
36
|
+
// Use += for multi-prop objects, => rewrite for single-prop.
|
|
37
|
+
await (0, ast_1.applyGritQL)(tree, mainTsxPath, `\`createRouter({ $props })\` where {
|
|
38
|
+
$props <: not some \`context: $_\`,
|
|
39
|
+
$props += \`context: { ${contextProp}: undefined }\`
|
|
40
|
+
}`);
|
|
41
|
+
// If context already exists, add the new prop to it.
|
|
42
|
+
// Handle empty context: {} via nested contains => rewrite, scoped to createRouter.
|
|
43
|
+
await (0, ast_1.applyGritQL)(tree, mainTsxPath, `\`createRouter({ $props })\` where {
|
|
44
|
+
$props <: contains \`context: {}\` => \`context: { ${contextProp}: undefined }\`
|
|
45
|
+
}`);
|
|
46
|
+
// Handle non-empty context via rewrite (the context object may be single-prop
|
|
47
|
+
// from the first hook call, where += concatenates without comma)
|
|
48
|
+
await (0, ast_1.applyGritQL)(tree, mainTsxPath, `\`context: { $cprops }\` => \`context: { $cprops, ${contextProp}: undefined }\` where {
|
|
49
|
+
$cprops <: within \`createRouter($_)\`,
|
|
50
|
+
$cprops <: not some \`${contextProp}: $_\`
|
|
51
|
+
}`);
|
|
52
|
+
// 3. Add hook call to App component body
|
|
53
|
+
// Block body: 'some' checks direct statements.
|
|
54
|
+
// Expression body: 'contains' to also prevent matching block bodies.
|
|
55
|
+
await (0, ast_1.applyGritQL)(tree, mainTsxPath, `or {
|
|
56
|
+
\`const App = () => { $body }\` => raw\`const App = () => {
|
|
57
|
+
const ${contextProp} = ${hook}();
|
|
58
|
+
$body
|
|
59
|
+
}\` where { $body <: not some \`const ${contextProp} = ${hook}()\` },
|
|
60
|
+
\`const App = () => $expr\` => raw\`const App = () => {
|
|
61
|
+
const ${contextProp} = ${hook}();
|
|
62
|
+
return $expr;
|
|
63
|
+
}\` where { $expr <: not contains \`${hook}()\` }
|
|
64
|
+
}`);
|
|
65
|
+
// 4. Add context prop to RouterProvider JSX element
|
|
66
|
+
// 'some' checks direct JSX attributes only.
|
|
67
|
+
await (0, ast_1.applyGritQL)(tree, mainTsxPath, `or {
|
|
68
|
+
\`<RouterProvider $attrs context={{}} />\` => \`<RouterProvider $attrs context={{ ${contextProp} }} />\`,
|
|
69
|
+
\`<RouterProvider $attrs context={{ $cprops }} />\` => \`<RouterProvider $attrs context={{ $cprops, ${contextProp} }} />\` where {
|
|
70
|
+
$cprops <: not some \`${contextProp}\`
|
|
71
|
+
},
|
|
72
|
+
\`<RouterProvider $attrs />\` => \`<RouterProvider $attrs context={{ ${contextProp} }} />\` where {
|
|
73
|
+
$attrs <: not some \`context\`
|
|
74
|
+
}
|
|
75
|
+
}`);
|
|
133
76
|
};
|
|
134
77
|
exports.addHookResultToRouterProviderContext = addHookResultToRouterProviderContext;
|
|
135
78
|
//# sourceMappingURL=website.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"website.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/utils/ast/website.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"website.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/utils/ast/website.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,gCAAyE;AASlE,MAAM,oCAAoC,GAAG,KAAK,EACvD,IAAU,EACV,WAAmB,EACnB,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAA6C,EACxE,EAAE;IACF,wDAAwD;IACxD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC/B,IAAA,iBAAW,EAAC,IAAI,EAAE,WAAW,EAAE,yBAAyB,CAAC;QACzD,IAAA,iBAAW,EAAC,IAAI,EAAE,WAAW,EAAE,oBAAoB,CAAC;QACpD,IAAA,iBAAW,EAAC,IAAI,EAAE,WAAW,EAAE,kBAAkB,CAAC;QAClD,IAAA,iBAAW,EAAC,IAAI,EAAE,WAAW,EAAE,yBAAyB,CAAC;KAC1D,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3B,OAAO;IACT,CAAC;IAED,MAAM,IAAA,2BAAqB,EAAC,IAAI,EAAE,WAAW,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IAE/D,gDAAgD;IAChD,4GAA4G;IAC5G,kFAAkF;IAClF,MAAM,IAAA,iBAAW,EACf,IAAI,EACJ,WAAW,EACX;;IAEA,WAAW,wBAAwB,IAAI;;;iCAGV,WAAW;;EAE1C,WAAW,wBAAwB,IAAI;;MAEnC,CACH,CAAC;IAEF,iDAAiD;IACjD,+EAA+E;IAC/E,gEAAgE;IAChE,MAAM,IAAA,iBAAW,EACf,IAAI,EACJ,WAAW,EACX;;+BAE2B,WAAW;MACpC,CACH,CAAC;IAEF,qDAAqD;IACrD,mFAAmF;IACnF,MAAM,IAAA,iBAAW,EACf,IAAI,EACJ,WAAW,EACX;2DACuD,WAAW;MAChE,CACH,CAAC;IACF,8EAA8E;IAC9E,iEAAiE;IACjE,MAAM,IAAA,iBAAW,EACf,IAAI,EACJ,WAAW,EACX,qDAAqD,WAAW;;8BAEtC,WAAW;MACnC,CACH,CAAC;IAEF,yCAAyC;IACzC,kDAAkD;IAClD,wEAAwE;IACxE,MAAM,IAAA,iBAAW,EACf,IAAI,EACJ,WAAW,EACX;;UAEM,WAAW,MAAM,IAAI;;wCAES,WAAW,MAAM,IAAI;;UAEnD,WAAW,MAAM,IAAI;;sCAEO,IAAI;MACpC,CACH,CAAC;IAEF,oDAAoD;IACpD,+CAA+C;IAC/C,MAAM,IAAA,iBAAW,EACf,IAAI,EACJ,WAAW,EACX;0FACsF,WAAW;4GACO,WAAW;gCACvF,WAAW;;6EAEkC,WAAW;;;MAGlF,CACH,CAAC;AACJ,CAAC,CAAC;AAtGW,QAAA,oCAAoC,wCAsG/C"}
|
package/src/utils/ast.d.ts
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { Tree } from '@nx/devkit';
|
|
6
|
-
import ts, { JsxChild, JsxClosingElement, JsxOpeningElement, Node } from 'typescript';
|
|
7
6
|
export declare const addDestructuredImport: (tree: Tree, filePath: string, variableNames: string[], from: string) => Promise<void>;
|
|
8
7
|
/**
|
|
9
8
|
* Adds an `import <variableName> from '<from>'; statement to the beginning of the file,
|
|
@@ -16,35 +15,16 @@ export declare const addSingleImport: (tree: Tree, filePath: string, variableNam
|
|
|
16
15
|
*/
|
|
17
16
|
export declare const addStarExport: (tree: Tree, filePath: string, from: string) => Promise<void>;
|
|
18
17
|
/**
|
|
19
|
-
*
|
|
18
|
+
* Return whether or not the given identifier is exported in the source file.
|
|
19
|
+
* Checks for both `export { Identifier }` and `export type Identifier = ...`.
|
|
20
20
|
*/
|
|
21
|
-
export declare const
|
|
22
|
-
/**
|
|
23
|
-
* Replace nodes matching a given selector if present, otherwise leaves the code unchanged
|
|
24
|
-
*/
|
|
25
|
-
export declare const replaceIfExists: (tree: Tree, filePath: string, selector: string, transformer: (node: Node) => Node) => void;
|
|
26
|
-
export declare const prependStatements: (tree: Tree, filePath: string, statements: ts.Statement[]) => void;
|
|
27
|
-
export declare const appendStatements: (tree: Tree, filePath: string, statements: ts.Statement[]) => void;
|
|
28
|
-
/**
|
|
29
|
-
* Query a typescript file in the tree using tsquery
|
|
30
|
-
*/
|
|
31
|
-
export declare const query: (tree: Tree, filePath: string, selector: string) => Node[];
|
|
32
|
-
export declare const createJsxElementFromIdentifier: (identifier: string, children: readonly JsxChild[]) => ts.JsxElement;
|
|
33
|
-
export declare const createJsxElement: (openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement) => ts.JsxElement;
|
|
34
|
-
/**
|
|
35
|
-
* Convert a given json object to its AST representation
|
|
36
|
-
*/
|
|
37
|
-
export declare const jsonToAst: (obj: unknown) => Node;
|
|
38
|
-
/**
|
|
39
|
-
* Return whether or not the given identifier is exported in the source file
|
|
40
|
-
*/
|
|
41
|
-
export declare const hasExportDeclaration: (source: string, identifierName: string) => boolean;
|
|
21
|
+
export declare const hasExportDeclaration: (source: string, identifierName: string) => Promise<boolean>;
|
|
42
22
|
/**
|
|
43
23
|
* Apply a GritQL pattern to a file in the Nx tree.
|
|
44
24
|
*/
|
|
45
|
-
export declare const
|
|
25
|
+
export declare const applyGritQL: (tree: Tree, filePath: string, pattern: string) => Promise<boolean>;
|
|
46
26
|
/**
|
|
47
27
|
* Check whether a GritQL pattern matches anywhere in a file.
|
|
48
28
|
* Returns true if the pattern matches at least once.
|
|
49
29
|
*/
|
|
50
|
-
export declare const
|
|
30
|
+
export declare const matchGritQL: (tree: Tree, filePath: string, pattern: string) => Promise<boolean>;
|
package/src/utils/ast.js
CHANGED
|
@@ -1,34 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
6
|
-
const typescript_1 = tslib_1.__importStar(require("typescript"));
|
|
3
|
+
exports.matchGritQL = exports.applyGritQL = exports.hasExportDeclaration = exports.addStarExport = exports.addSingleImport = exports.addDestructuredImport = void 0;
|
|
7
4
|
const gritql_1 = require("@getgrit/gritql");
|
|
8
5
|
const assertFilePath = (tree, filePath) => {
|
|
9
6
|
if (!tree.exists(filePath)) {
|
|
10
7
|
throw new Error(`No file located at ${filePath}`);
|
|
11
8
|
}
|
|
12
9
|
};
|
|
13
|
-
const updateFile = (tree, filePath, doUpdate) => {
|
|
14
|
-
assertFilePath(tree, filePath);
|
|
15
|
-
const contents = tree.read(filePath)?.toString() ?? '';
|
|
16
|
-
const updatedContents = doUpdate(contents);
|
|
17
|
-
if (updatedContents !== contents) {
|
|
18
|
-
tree.write(filePath, updatedContents);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const createOrUpdateFile = (tree, filePath, doUpdate) => {
|
|
22
|
-
const contents = tree.read(filePath)?.toString();
|
|
23
|
-
const updatedContents = doUpdate(contents);
|
|
24
|
-
if (updatedContents !== contents) {
|
|
25
|
-
tree.write(filePath, updatedContents);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
10
|
const addDestructuredImport = async (tree, filePath, variableNames, from) => {
|
|
29
11
|
assertFilePath(tree, filePath);
|
|
30
12
|
// Check if there's an existing import from this module
|
|
31
|
-
const hasExistingImport = await (0, exports.
|
|
13
|
+
const hasExistingImport = await (0, exports.matchGritQL)(tree, filePath, `\`import { $_ } from '${from}'\``);
|
|
32
14
|
if (hasExistingImport) {
|
|
33
15
|
// For each new variable, use GritQL rewrite to add it if not already present
|
|
34
16
|
for (const variableName of variableNames) {
|
|
@@ -36,7 +18,7 @@ const addDestructuredImport = async (tree, filePath, variableNames, from) => {
|
|
|
36
18
|
? variableName.split(' as ')[1]
|
|
37
19
|
: variableName;
|
|
38
20
|
// Use rewrite (=>) which correctly handles comma-separated import specifier lists
|
|
39
|
-
await (0, exports.
|
|
21
|
+
await (0, exports.applyGritQL)(tree, filePath, `\`import { $imports } from '${from}'\` => \`import { $imports, ${variableName} } from '${from}'\` where { $imports <: not contains \`${localName}\` }`);
|
|
40
22
|
}
|
|
41
23
|
}
|
|
42
24
|
else {
|
|
@@ -54,7 +36,7 @@ exports.addDestructuredImport = addDestructuredImport;
|
|
|
54
36
|
const addSingleImport = async (tree, filePath, variableName, from) => {
|
|
55
37
|
assertFilePath(tree, filePath);
|
|
56
38
|
// Check if default import already exists using GritQL
|
|
57
|
-
const alreadyImported = await (0, exports.
|
|
39
|
+
const alreadyImported = await (0, exports.matchGritQL)(tree, filePath, `\`import ${variableName} from '${from}'\``);
|
|
58
40
|
if (alreadyImported) {
|
|
59
41
|
return;
|
|
60
42
|
}
|
|
@@ -75,7 +57,7 @@ const addStarExport = async (tree, filePath, from) => {
|
|
|
75
57
|
return;
|
|
76
58
|
}
|
|
77
59
|
// Check if already exported using GritQL
|
|
78
|
-
const alreadyExported = await (0, exports.
|
|
60
|
+
const alreadyExported = await (0, exports.matchGritQL)(tree, filePath, `\`export * from '${from}'\``);
|
|
79
61
|
if (alreadyExported) {
|
|
80
62
|
return;
|
|
81
63
|
}
|
|
@@ -84,149 +66,36 @@ const addStarExport = async (tree, filePath, from) => {
|
|
|
84
66
|
};
|
|
85
67
|
exports.addStarExport = addStarExport;
|
|
86
68
|
/**
|
|
87
|
-
*
|
|
69
|
+
* Return whether or not the given identifier is exported in the source file.
|
|
70
|
+
* Checks for both `export { Identifier }` and `export type Identifier = ...`.
|
|
88
71
|
*/
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
exports.replace = replace;
|
|
104
|
-
/**
|
|
105
|
-
* Replace nodes matching a given selector if present, otherwise leaves the code unchanged
|
|
106
|
-
*/
|
|
107
|
-
const replaceIfExists = (tree, filePath, selector, transformer) => (0, exports.replace)(tree, filePath, selector, transformer, false);
|
|
108
|
-
exports.replaceIfExists = replaceIfExists;
|
|
109
|
-
/**
|
|
110
|
-
* Apply a transform to the given code using the transformer.
|
|
111
|
-
* Equivalent to tsquery.map, except that this preserves existing code formatting where possible
|
|
112
|
-
*/
|
|
113
|
-
const applyTransform = (code, selector, transformer) => {
|
|
114
|
-
const sourceFile = (0, tsquery_1.ast)(code);
|
|
115
|
-
const transforms = [];
|
|
116
|
-
const printer = typescript_1.default.createPrinter({
|
|
117
|
-
removeComments: true,
|
|
118
|
-
});
|
|
119
|
-
tsquery_1.tsquery.map(sourceFile, selector, (node) => {
|
|
120
|
-
const newNode = transformer(node);
|
|
121
|
-
if (newNode !== node && newNode) {
|
|
122
|
-
transforms.push({
|
|
123
|
-
start: node.getStart(sourceFile, true),
|
|
124
|
-
end: node.getEnd(),
|
|
125
|
-
newText: printer.printNode(typescript_1.default.EmitHint.Unspecified, newNode, sourceFile),
|
|
72
|
+
const hasExportDeclaration = async (source, identifierName) => {
|
|
73
|
+
const patterns = [
|
|
74
|
+
`\`export type ${identifierName} = $_\``,
|
|
75
|
+
`\`export { ${identifierName} }\``,
|
|
76
|
+
`\`export type { ${identifierName} } from $_\``,
|
|
77
|
+
];
|
|
78
|
+
for (const pattern of patterns) {
|
|
79
|
+
try {
|
|
80
|
+
const q = new gritql_1.QueryBuilder(`$p => $p where { $p <: ${pattern} }`);
|
|
81
|
+
const result = await q.applyToFile({
|
|
82
|
+
path: 'check.ts',
|
|
83
|
+
content: source,
|
|
126
84
|
});
|
|
85
|
+
if (result !== null)
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
// Pattern didn't match, try next
|
|
127
90
|
}
|
|
128
|
-
return newNode;
|
|
129
|
-
});
|
|
130
|
-
let newCode = code;
|
|
131
|
-
let offset = 0;
|
|
132
|
-
transforms.forEach((transform) => {
|
|
133
|
-
newCode =
|
|
134
|
-
newCode.substring(0, transform.start + offset) +
|
|
135
|
-
transform.newText +
|
|
136
|
-
newCode.substring(transform.end + offset);
|
|
137
|
-
offset = newCode.length - code.length;
|
|
138
|
-
});
|
|
139
|
-
return newCode;
|
|
140
|
-
};
|
|
141
|
-
const insertStatements = (isPrepend, code, statements) => {
|
|
142
|
-
const sourceFile = (0, tsquery_1.ast)(code);
|
|
143
|
-
const printer = typescript_1.default.createPrinter();
|
|
144
|
-
const newText = statements
|
|
145
|
-
.map((s) => printer.printNode(typescript_1.default.EmitHint.Unspecified, s, sourceFile))
|
|
146
|
-
.join('\n');
|
|
147
|
-
if (isPrepend) {
|
|
148
|
-
return newText + '\n' + code;
|
|
149
|
-
}
|
|
150
|
-
return code + '\n' + newText;
|
|
151
|
-
};
|
|
152
|
-
const appendStatementsToCodeText = (code, statements) => {
|
|
153
|
-
return insertStatements(false, code, statements);
|
|
154
|
-
};
|
|
155
|
-
const prependStatementsToCodeText = (code, statements) => {
|
|
156
|
-
return insertStatements(true, code, statements);
|
|
157
|
-
};
|
|
158
|
-
const prependStatements = (tree, filePath, statements) => {
|
|
159
|
-
updateFile(tree, filePath, (contents) => {
|
|
160
|
-
return prependStatementsToCodeText(contents, statements);
|
|
161
|
-
});
|
|
162
|
-
};
|
|
163
|
-
exports.prependStatements = prependStatements;
|
|
164
|
-
const appendStatements = (tree, filePath, statements) => {
|
|
165
|
-
updateFile(tree, filePath, (contents) => {
|
|
166
|
-
return appendStatementsToCodeText(contents, statements);
|
|
167
|
-
});
|
|
168
|
-
};
|
|
169
|
-
exports.appendStatements = appendStatements;
|
|
170
|
-
/**
|
|
171
|
-
* Query a typescript file in the tree using tsquery
|
|
172
|
-
*/
|
|
173
|
-
const query = (tree, filePath, selector) => {
|
|
174
|
-
assertFilePath(tree, filePath);
|
|
175
|
-
const source = tree.read(filePath).toString();
|
|
176
|
-
return tsquery_1.tsquery.query((0, tsquery_1.ast)(source), selector);
|
|
177
|
-
};
|
|
178
|
-
exports.query = query;
|
|
179
|
-
const createJsxElementFromIdentifier = (identifier, children) => typescript_1.factory.createJsxElement(typescript_1.factory.createJsxOpeningElement(typescript_1.factory.createIdentifier(identifier), undefined, typescript_1.factory.createJsxAttributes([])), children, typescript_1.factory.createJsxClosingElement(typescript_1.factory.createIdentifier(identifier)));
|
|
180
|
-
exports.createJsxElementFromIdentifier = createJsxElementFromIdentifier;
|
|
181
|
-
const createJsxElement = (openingElement, children, closingElement) => typescript_1.factory.createJsxElement(openingElement, children, closingElement);
|
|
182
|
-
exports.createJsxElement = createJsxElement;
|
|
183
|
-
/**
|
|
184
|
-
* Convert a given json object to its AST representation
|
|
185
|
-
*/
|
|
186
|
-
const jsonToAst = (obj) => {
|
|
187
|
-
if (obj === null) {
|
|
188
|
-
return typescript_1.factory.createNull();
|
|
189
|
-
}
|
|
190
|
-
if (obj === undefined) {
|
|
191
|
-
return typescript_1.factory.createIdentifier('undefined');
|
|
192
|
-
}
|
|
193
|
-
if (typeof obj === 'string') {
|
|
194
|
-
return typescript_1.factory.createStringLiteral(obj);
|
|
195
|
-
}
|
|
196
|
-
if (typeof obj === 'number') {
|
|
197
|
-
return typescript_1.factory.createNumericLiteral(obj);
|
|
198
|
-
}
|
|
199
|
-
if (typeof obj === 'boolean') {
|
|
200
|
-
return obj ? typescript_1.factory.createTrue() : typescript_1.factory.createFalse();
|
|
201
|
-
}
|
|
202
|
-
if (Array.isArray(obj)) {
|
|
203
|
-
return typescript_1.factory.createArrayLiteralExpression(obj.map((item) => (0, exports.jsonToAst)(item)));
|
|
204
|
-
}
|
|
205
|
-
if (typeof obj === 'object') {
|
|
206
|
-
return typescript_1.factory.createObjectLiteralExpression(Object.entries(obj).map(([key, value]) => {
|
|
207
|
-
// Check if the key is a valid identifier
|
|
208
|
-
const isValidIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key);
|
|
209
|
-
return typescript_1.factory.createPropertyAssignment(isValidIdentifier
|
|
210
|
-
? typescript_1.factory.createIdentifier(key)
|
|
211
|
-
: typescript_1.factory.createStringLiteral(key), (0, exports.jsonToAst)(value));
|
|
212
|
-
}));
|
|
213
91
|
}
|
|
214
|
-
|
|
215
|
-
};
|
|
216
|
-
exports.jsonToAst = jsonToAst;
|
|
217
|
-
/**
|
|
218
|
-
* Return whether or not the given identifier is exported in the source file
|
|
219
|
-
*/
|
|
220
|
-
const hasExportDeclaration = (source, identifierName) => {
|
|
221
|
-
const sourceFile = (0, tsquery_1.ast)(source);
|
|
222
|
-
return (tsquery_1.tsquery.query(sourceFile, `ExportDeclaration:has(ExportSpecifier:has(Identifier[name="${identifierName}"]))`).length > 0 ||
|
|
223
|
-
tsquery_1.tsquery.query(sourceFile, `TypeAliasDeclaration:has(ExportKeyword):has(Identifier[name="${identifierName}"])`).length > 0);
|
|
92
|
+
return false;
|
|
224
93
|
};
|
|
225
94
|
exports.hasExportDeclaration = hasExportDeclaration;
|
|
226
95
|
/**
|
|
227
96
|
* Apply a GritQL pattern to a file in the Nx tree.
|
|
228
97
|
*/
|
|
229
|
-
const
|
|
98
|
+
const applyGritQL = async (tree, filePath, pattern) => {
|
|
230
99
|
if (!tree.exists(filePath))
|
|
231
100
|
throw new Error(`No file at ${filePath}`);
|
|
232
101
|
const source = tree.read(filePath).toString();
|
|
@@ -238,12 +107,12 @@ const applyGritQLTransform = async (tree, filePath, pattern) => {
|
|
|
238
107
|
}
|
|
239
108
|
return false;
|
|
240
109
|
};
|
|
241
|
-
exports.
|
|
110
|
+
exports.applyGritQL = applyGritQL;
|
|
242
111
|
/**
|
|
243
112
|
* Check whether a GritQL pattern matches anywhere in a file.
|
|
244
113
|
* Returns true if the pattern matches at least once.
|
|
245
114
|
*/
|
|
246
|
-
const
|
|
115
|
+
const matchGritQL = async (tree, filePath, pattern) => {
|
|
247
116
|
if (!tree.exists(filePath))
|
|
248
117
|
return false;
|
|
249
118
|
const source = tree.read(filePath).toString();
|
|
@@ -262,5 +131,5 @@ const hasGritQLMatch = async (tree, filePath, pattern) => {
|
|
|
262
131
|
return false;
|
|
263
132
|
}
|
|
264
133
|
};
|
|
265
|
-
exports.
|
|
134
|
+
exports.matchGritQL = matchGritQL;
|
|
266
135
|
//# sourceMappingURL=ast.js.map
|
package/src/utils/ast.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/utils/ast.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ast.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/utils/ast.ts"],"names":[],"mappings":";;;AAKA,4CAA+C;AAE/C,MAAM,cAAc,GAAG,CAAC,IAAU,EAAE,QAAgB,EAAE,EAAE;IACtD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,sBAAsB,QAAQ,EAAE,CAAC,CAAC;IACpD,CAAC;AACH,CAAC,CAAC;AAEK,MAAM,qBAAqB,GAAG,KAAK,EACxC,IAAU,EACV,QAAgB,EAChB,aAAuB,EACvB,IAAY,EACZ,EAAE;IACF,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAE/B,uDAAuD;IACvD,MAAM,iBAAiB,GAAG,MAAM,IAAA,mBAAW,EACzC,IAAI,EACJ,QAAQ,EACR,yBAAyB,IAAI,KAAK,CACnC,CAAC;IAEF,IAAI,iBAAiB,EAAE,CAAC;QACtB,6EAA6E;QAC7E,KAAK,MA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AC,0BAA0B,OAAO,IAAI,CAAC,CAAC;QACtE,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC;YACrC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,MAAM;SAChB,CAAC,CAAC;QACH,OAAO,MAAM,KAAK,IAAI,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AApBW,QAAA,WAAW,eAoBtB"}
|
|
@@ -40,4 +40,4 @@ export interface AddTypeScriptBundleTargetOptions {
|
|
|
40
40
|
/**
|
|
41
41
|
* Add a TypeScript bundle target using rolldown
|
|
42
42
|
*/
|
|
43
|
-
export declare const addTypeScriptBundleTarget: (tree: Tree, project: ProjectConfiguration, opts: AddTypeScriptBundleTargetOptions) => void
|
|
43
|
+
export declare const addTypeScriptBundleTarget: (tree: Tree, project: ProjectConfiguration, opts: AddTypeScriptBundleTargetOptions) => Promise<void>;
|