@aws/nx-plugin 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/LICENSE +175 -0
  2. package/LICENSE-THIRD-PARTY +37594 -0
  3. package/NOTICE +2 -0
  4. package/package.json +11 -10
  5. package/src/cloudscape-website/app/generator.d.ts +4 -0
  6. package/src/cloudscape-website/app/generator.js +139 -170
  7. package/src/cloudscape-website/app/generator.js.map +1 -1
  8. package/src/cloudscape-website/app/schema.d.ts +4 -0
  9. package/src/cloudscape-website/cognito-auth/__snapshots__/generator.spec.ts.snap +0 -4
  10. package/src/cloudscape-website/cognito-auth/generator.d.ts +4 -0
  11. package/src/cloudscape-website/cognito-auth/generator.js +82 -93
  12. package/src/cloudscape-website/cognito-auth/generator.js.map +1 -1
  13. package/src/cloudscape-website/cognito-auth/schema.d.ts +4 -0
  14. package/src/cloudscape-website/runtime-config/generator.d.ts +4 -0
  15. package/src/cloudscape-website/runtime-config/generator.js +56 -70
  16. package/src/cloudscape-website/runtime-config/generator.js.map +1 -1
  17. package/src/cloudscape-website/runtime-config/schema.d.ts +4 -0
  18. package/src/gitlab/generator.d.ts +4 -0
  19. package/src/gitlab/generator.js +13 -22
  20. package/src/gitlab/generator.js.map +1 -1
  21. package/src/gitlab/schema.d.ts +4 -0
  22. package/src/index.d.ts +4 -0
  23. package/src/index.js +4 -2
  24. package/src/index.js.map +1 -1
  25. package/src/infra/app/__snapshots__/generator.spec.ts.snap +6 -6
  26. package/src/infra/app/generator.d.ts +4 -0
  27. package/src/infra/app/generator.js +57 -71
  28. package/src/infra/app/generator.js.map +1 -1
  29. package/src/infra/app/schema.d.ts +4 -0
  30. package/src/trpc/backend/generator.d.ts +4 -0
  31. package/src/trpc/backend/generator.js +95 -116
  32. package/src/trpc/backend/generator.js.map +1 -1
  33. package/src/trpc/backend/schema.d.ts +4 -1
  34. package/src/trpc/react/generator.d.ts +4 -0
  35. package/src/trpc/react/generator.js +62 -76
  36. package/src/trpc/react/generator.js.map +1 -1
  37. package/src/trpc/react/schema.d.ts +4 -0
  38. package/src/ts/cjs-to-esm/generator.d.ts +4 -0
  39. package/src/ts/cjs-to-esm/generator.js +131 -143
  40. package/src/ts/cjs-to-esm/generator.js.map +1 -1
  41. package/src/ts/cjs-to-esm/schema.d.ts +4 -0
  42. package/src/ts/lib/eslint.d.ts +6 -2
  43. package/src/ts/lib/eslint.js +20 -28
  44. package/src/ts/lib/eslint.js.map +1 -1
  45. package/src/ts/lib/generator.d.ts +6 -2
  46. package/src/ts/lib/generator.js +35 -51
  47. package/src/ts/lib/generator.js.map +1 -1
  48. package/src/ts/lib/schema.d.ts +6 -2
  49. package/src/ts/lib/ts-project-utils.d.ts +6 -2
  50. package/src/ts/lib/ts-project-utils.js +53 -83
  51. package/src/ts/lib/ts-project-utils.js.map +1 -1
  52. package/src/ts/lib/types.d.ts +4 -0
  53. package/src/ts/lib/types.js +1 -4
  54. package/src/ts/lib/types.js.map +1 -1
  55. package/src/ts/lib/vitest.d.ts +6 -2
  56. package/src/ts/lib/vitest.js +49 -51
  57. package/src/ts/lib/vitest.js.map +1 -1
  58. package/src/utils/npm-scope.d.ts +4 -0
  59. package/src/utils/npm-scope.js +19 -27
  60. package/src/utils/npm-scope.js.map +1 -1
  61. package/src/utils/paths.d.ts +5 -1
  62. package/src/utils/paths.js +13 -23
  63. package/src/utils/paths.js.map +1 -1
  64. package/src/utils/shared-constructs.d.ts +4 -0
  65. package/src/utils/shared-constructs.js +44 -68
  66. package/src/utils/shared-constructs.js.map +1 -1
  67. package/src/utils/versions.d.ts +23 -18
  68. package/src/utils/versions.js +35 -45
  69. package/src/utils/versions.js.map +1 -1
  70. package/src/cloudscape-website/app/schema.d.js +0 -6
  71. package/src/cloudscape-website/app/schema.d.js.map +0 -1
  72. package/src/cloudscape-website/cognito-auth/schema.d.js +0 -6
  73. package/src/cloudscape-website/cognito-auth/schema.d.js.map +0 -1
  74. package/src/cloudscape-website/runtime-config/schema.d.js +0 -6
  75. package/src/cloudscape-website/runtime-config/schema.d.js.map +0 -1
  76. package/src/gitlab/files/.gitlab-ci.yml.template +0 -26
  77. package/src/gitlab/schema.d.js +0 -6
  78. package/src/gitlab/schema.d.js.map +0 -1
  79. package/src/infra/app/schema.d.js +0 -6
  80. package/src/infra/app/schema.d.js.map +0 -1
  81. package/src/trpc/backend/schema.d.js +0 -6
  82. package/src/trpc/backend/schema.d.js.map +0 -1
  83. package/src/trpc/react/schema.d.js +0 -6
  84. package/src/trpc/react/schema.d.js.map +0 -1
  85. package/src/ts/cjs-to-esm/schema.d.js +0 -6
  86. package/src/ts/cjs-to-esm/schema.d.js.map +0 -1
  87. package/src/ts/lib/schema.d.js +0 -6
  88. package/src/ts/lib/schema.d.js.map +0 -1
@@ -1,81 +1,67 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- default: function() {
13
- return _default;
14
- },
15
- reactGenerator: function() {
16
- return reactGenerator;
17
- }
18
- });
19
- const _extends = require("@swc/helpers/_/_extends");
20
- const _devkit = require("@nx/devkit");
21
- const _typescript = require("typescript");
22
- const _tsquery = require("@phenomnomnominal/tsquery");
23
- const _generator = require("../../cloudscape-website/runtime-config/generator");
24
- const _npmscope = require("../../utils/npm-scope");
25
- const _versions = require("../../utils/versions");
26
- async function reactGenerator(tree, options) {
27
- var _backendProjectConfig_metadata;
28
- const frontendProjectConfig = (0, _devkit.readProjectConfiguration)(tree, options.frontendProjectName);
29
- const backendProjectConfig = (0, _devkit.readProjectConfiguration)(tree, options.backendProjectName);
30
- const apiName = (_backendProjectConfig_metadata = backendProjectConfig.metadata) == null ? void 0 : _backendProjectConfig_metadata.apiName;
31
- (0, _devkit.generateFiles)(tree, (0, _devkit.joinPathFragments)(__dirname, 'files'), frontendProjectConfig.root, _extends._({
32
- apiName
33
- }, options, {
34
- backendProjectAlias: (0, _npmscope.toScopeAlias)(options.backendProjectName)
35
- }));
36
- await (0, _generator.runtimeConfigGenerator)(tree, {
37
- project: options.frontendProjectName
38
- });
39
- const mainTsxPath = (0, _devkit.joinPathFragments)(frontendProjectConfig.sourceRoot, 'main.tsx');
40
- if (!tree.exists(mainTsxPath)) {
41
- throw new Error(`Could not find main.tsx in ${frontendProjectConfig.sourceRoot}`);
42
- }
43
- const mainTsxContents = tree.read(mainTsxPath).toString();
44
- const trpcProviderImport = _typescript.factory.createImportDeclaration(undefined, _typescript.factory.createImportClause(false, _typescript.factory.createIdentifier('TRPCClientProvider'), undefined), _typescript.factory.createStringLiteral('./components/TRPCClientProvider'));
45
- const updatedImports = _tsquery.tsquery.map((0, _tsquery.ast)(mainTsxContents), 'SourceFile', (node)=>{
46
- return _extends._({}, node, {
47
- statements: [
48
- trpcProviderImport,
49
- ...node.statements
50
- ]
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reactGenerator = reactGenerator;
4
+ const tslib_1 = require("tslib");
5
+ /**
6
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
7
+ * SPDX-License-Identifier: Apache-2.0
8
+ */
9
+ const devkit_1 = require("@nx/devkit");
10
+ const typescript_1 = require("typescript");
11
+ const tsquery_1 = require("@phenomnomnominal/tsquery");
12
+ const generator_1 = require("../../cloudscape-website/runtime-config/generator");
13
+ const npm_scope_1 = require("../../utils/npm-scope");
14
+ const versions_1 = require("../../utils/versions");
15
+ function reactGenerator(tree, options) {
16
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
17
+ var _a;
18
+ const frontendProjectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.frontendProjectName);
19
+ const backendProjectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.backendProjectName);
20
+ /* eslint-disable @typescript-eslint/no-explicit-any */
21
+ const apiName = (_a = backendProjectConfig.metadata) === null || _a === void 0 ? void 0 : _a.apiName;
22
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), frontendProjectConfig.root, Object.assign(Object.assign({ apiName }, options), { backendProjectAlias: (0, npm_scope_1.toScopeAlias)(options.backendProjectName) }));
23
+ yield (0, generator_1.runtimeConfigGenerator)(tree, {
24
+ project: options.frontendProjectName,
51
25
  });
52
- }).getFullText();
53
- let locatedNode = false;
54
- const mainTsxUpdatedContents = _tsquery.tsquery.map((0, _tsquery.ast)(updatedImports), 'JsxSelfClosingElement', (node)=>{
55
- if (node.tagName.getText() !== 'App') {
56
- return node;
57
- } else {
58
- locatedNode = true;
26
+ const mainTsxPath = (0, devkit_1.joinPathFragments)(frontendProjectConfig.sourceRoot, 'main.tsx');
27
+ if (!tree.exists(mainTsxPath)) {
28
+ throw new Error(`Could not find main.tsx in ${frontendProjectConfig.sourceRoot}`);
59
29
  }
60
- return _typescript.factory.createJsxElement(_typescript.factory.createJsxOpeningElement(_typescript.factory.createIdentifier('TRPCClientProvider'), undefined, _typescript.factory.createJsxAttributes([])), [
61
- node
62
- ], _typescript.factory.createJsxClosingElement(_typescript.factory.createIdentifier('TRPCClientProvider')));
63
- }).getFullText();
64
- if (!locatedNode) {
65
- throw new Error('Could not locate App component in main.tsx');
66
- }
67
- if (mainTsxContents !== mainTsxUpdatedContents) {
68
- tree.write(mainTsxPath, mainTsxUpdatedContents);
69
- }
70
- (0, _devkit.addDependenciesToPackageJson)(tree, (0, _versions.withVersions)([
71
- "@trpc/react-query",
72
- "@tanstack/react-query"
73
- ]), {});
74
- await (0, _devkit.formatFiles)(tree);
75
- return ()=>{
76
- (0, _devkit.installPackagesTask)(tree);
77
- };
30
+ const mainTsxContents = tree.read(mainTsxPath).toString();
31
+ const trpcProviderImport = typescript_1.factory.createImportDeclaration(undefined, typescript_1.factory.createImportClause(false, typescript_1.factory.createIdentifier('TRPCClientProvider'), undefined), typescript_1.factory.createStringLiteral('./components/TRPCClientProvider'));
32
+ const updatedImports = tsquery_1.tsquery
33
+ .map((0, tsquery_1.ast)(mainTsxContents), 'SourceFile', (node) => {
34
+ return Object.assign(Object.assign({}, node), { statements: [trpcProviderImport, ...node.statements] });
35
+ })
36
+ .getFullText();
37
+ let locatedNode = false;
38
+ const mainTsxUpdatedContents = tsquery_1.tsquery
39
+ .map((0, tsquery_1.ast)(updatedImports), 'JsxSelfClosingElement', (node) => {
40
+ if (node.tagName.getText() !== 'App') {
41
+ return node;
42
+ }
43
+ else {
44
+ locatedNode = true;
45
+ }
46
+ return typescript_1.factory.createJsxElement(typescript_1.factory.createJsxOpeningElement(typescript_1.factory.createIdentifier('TRPCClientProvider'), undefined, typescript_1.factory.createJsxAttributes([])), [node], typescript_1.factory.createJsxClosingElement(typescript_1.factory.createIdentifier('TRPCClientProvider')));
47
+ })
48
+ .getFullText();
49
+ if (!locatedNode) {
50
+ throw new Error('Could not locate App component in main.tsx');
51
+ }
52
+ if (mainTsxContents !== mainTsxUpdatedContents) {
53
+ tree.write(mainTsxPath, mainTsxUpdatedContents);
54
+ }
55
+ (0, devkit_1.addDependenciesToPackageJson)(tree, (0, versions_1.withVersions)([
56
+ '@trpc/client',
57
+ '@trpc/react-query',
58
+ '@tanstack/react-query',
59
+ ]), {});
60
+ yield (0, devkit_1.formatFiles)(tree);
61
+ return () => {
62
+ (0, devkit_1.installPackagesTask)(tree);
63
+ };
64
+ });
78
65
  }
79
- const _default = reactGenerator;
80
-
66
+ exports.default = reactGenerator;
81
67
  //# sourceMappingURL=generator.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/trpc/react/generator.ts"],"sourcesContent":["import {\n addDependenciesToPackageJson,\n formatFiles,\n generateFiles,\n installPackagesTask,\n joinPathFragments,\n readProjectConfiguration,\n Tree,\n} from '@nx/devkit';\nimport { ReactGeneratorSchema } from './schema';\nimport {\n factory,\n ImportClause,\n JsxSelfClosingElement,\n SourceFile,\n} from 'typescript';\nimport { ast, tsquery } from '@phenomnomnominal/tsquery';\nimport { runtimeConfigGenerator } from '../../cloudscape-website/runtime-config/generator';\nimport { toScopeAlias } from '../../utils/npm-scope';\nimport { withVersions } from '../../utils/versions';\n\nexport async function reactGenerator(\n tree: Tree,\n options: ReactGeneratorSchema\n) {\n const frontendProjectConfig = readProjectConfiguration(\n tree,\n options.frontendProjectName\n );\n const backendProjectConfig = readProjectConfiguration(\n tree,\n options.backendProjectName\n );\n const apiName = (backendProjectConfig.metadata as any)?.apiName;\n generateFiles(\n tree,\n joinPathFragments(__dirname, 'files'),\n frontendProjectConfig.root,\n {\n apiName,\n ...options,\n backendProjectAlias: toScopeAlias(options.backendProjectName),\n }\n );\n\n await runtimeConfigGenerator(tree, {\n project: options.frontendProjectName,\n });\n\n const mainTsxPath = joinPathFragments(\n frontendProjectConfig.sourceRoot,\n 'main.tsx'\n );\n\n if (!tree.exists(mainTsxPath)) {\n throw new Error(\n `Could not find main.tsx in ${frontendProjectConfig.sourceRoot}`\n );\n }\n\n const mainTsxContents = tree.read(mainTsxPath).toString();\n\n const trpcProviderImport = factory.createImportDeclaration(\n undefined,\n factory.createImportClause(\n false,\n factory.createIdentifier('TRPCClientProvider'),\n undefined\n ) as ImportClause,\n factory.createStringLiteral('./components/TRPCClientProvider')\n );\n\n const updatedImports = tsquery\n .map(ast(mainTsxContents), 'SourceFile', (node: SourceFile) => {\n return {\n ...node,\n statements: [trpcProviderImport, ...node.statements],\n };\n })\n .getFullText();\n\n let locatedNode = false;\n const mainTsxUpdatedContents = tsquery\n .map(\n ast(updatedImports),\n 'JsxSelfClosingElement',\n (node: JsxSelfClosingElement) => {\n if (node.tagName.getText() !== 'App') {\n return node;\n } else {\n locatedNode = true;\n }\n\n return factory.createJsxElement(\n factory.createJsxOpeningElement(\n factory.createIdentifier('TRPCClientProvider'),\n undefined,\n factory.createJsxAttributes([])\n ),\n [node],\n factory.createJsxClosingElement(\n factory.createIdentifier('TRPCClientProvider')\n )\n );\n }\n )\n .getFullText();\n\n if (!locatedNode) {\n throw new Error('Could not locate App component in main.tsx');\n }\n\n if (mainTsxContents !== mainTsxUpdatedContents) {\n tree.write(mainTsxPath, mainTsxUpdatedContents);\n }\n\n addDependenciesToPackageJson(\n tree,\n withVersions([\n \"@trpc/react-query\",\n \"@tanstack/react-query\",\n ]),\n {}\n );\n await formatFiles(tree);\n\n return () => {\n installPackagesTask(tree);\n };\n}\n\nexport default reactGenerator;\n"],"names":["reactGenerator","tree","options","backendProjectConfig","frontendProjectConfig","readProjectConfiguration","frontendProjectName","backendProjectName","apiName","metadata","generateFiles","joinPathFragments","__dirname","root","backendProjectAlias","toScopeAlias","runtimeConfigGenerator","project","mainTsxPath","sourceRoot","exists","Error","mainTsxContents","read","toString","trpcProviderImport","factory","createImportDeclaration","undefined","createImportClause","createIdentifier","createStringLiteral","updatedImports","tsquery","map","ast","node","statements","getFullText","locatedNode","mainTsxUpdatedContents","tagName","getText","createJsxElement","createJsxOpeningElement","createJsxAttributes","createJsxClosingElement","write","addDependenciesToPackageJson","withVersions","formatFiles","installPackagesTask"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAmIA,OAA8B;eAA9B;;IA9GsBA,cAAc;eAAdA;;;;wBAbf;4BAOA;yBACsB;2BACU;0BACV;0BACA;AAEtB,eAAeA,eACpBC,IAAU,EACVC,OAA6B;QAUZC;IARjB,MAAMC,wBAAwBC,IAAAA,gCAAwB,EACpDJ,MACAC,QAAQI,mBAAmB;IAE7B,MAAMH,uBAAuBE,IAAAA,gCAAwB,EACnDJ,MACAC,QAAQK,kBAAkB;IAE5B,MAAMC,WAAWL,iCAAAA,qBAAqBM,QAAQ,qBAA9B,AAACN,+BAAuCK,OAAO;IAC/DE,IAAAA,qBAAa,EACXT,MACAU,IAAAA,yBAAiB,EAACC,WAAW,UAC7BR,sBAAsBS,IAAI,EAC1B;QACEL;OACGN;QAC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;IAClB;IAEA,IAAIC,oBAAoBkB,wBAAwB;QAC9CvC,KAAK8C,KAAK,CAAC7B,aAAasB;IAC1B;IAEAQ,IAAAA,oCAA4B,EAC1B/C,MACAgD,IAAAA,sBAAY,EAAC;QACX;QACA;KACD,GACD,CAAC;IAEH,MAAMC,IAAAA,mBAAW,EAACjD;IAElB,OAAO;QACLkD,IAAAA,2BAAmB,EAAClD;IACtB;AACF;MAEA,WAAeD"}
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/trpc/react/generator.ts"],"names":[],"mappings":";;AAyBA,wCA8GC;;AAvID;;;GAGG;AACH,uCAQoB;AAEpB,2CAKoB;AACpB,uDAAyD;AACzD,iFAA2F;AAC3F,qDAAqD;AACrD,mDAAoD;AAEpD,SAAsB,cAAc,CAClC,IAAU,EACV,OAA6B;;;QAE7B,MAAM,qBAAqB,GAAG,IAAA,iCAAwB,EACpD,IAAI,EACJ,OAAO,CAAC,mBAAmB,CAC5B,CAAC;QACF,MAAM,oBAAoB,GAAG,IAAA,iCAAwB,EACnD,IAAI,EACJ,OAAO,CAAC,kBAAkB,CAC3B,CAAC;QACF,uDAAuD;QACvD,MAAM,OAAO,GAAG,MAAC,oBAAoB,CAAC,QAAgB,0CAAE,OAAO,CAAC;QAChE,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,EACrC,qBAAqB,CAAC,IAAI,gCAExB,OAAO,IACJ,OAAO,KACV,mBAAmB,EAAE,IAAA,wBAAY,EAAC,OAAO,CAAC,kBAAkB,CAAC,IAEhE,CAAC;QAEF,MAAM,IAAA,kCAAsB,EAAC,IAAI,EAAE;YACjC,OAAO,EAAE,OAAO,CAAC,mBAAmB;SACrC,CAAC,CAAC;QAEH,MAAM,WAAW,GAAG,IAAA,0BAAiB,EACnC,qBAAqB,CAAC,UAAU,EAChC,UAAU,CACX,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,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AAC,uBAAuB,CAC7B,oBAAO,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAC/C,CACF,CAAC;QACJ,CAAC,CACF;aACA,WAAW,EAAE,CAAC;QAEjB,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAChE,CAAC;QAED,IAAI,eAAe,KAAK,sBAAsB,EAAE,CAAC;YAC/C,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,sBAAsB,CAAC,CAAC;QAClD,CAAC;QAED,IAAA,qCAA4B,EAC1B,IAAI,EACJ,IAAA,uBAAY,EAAC;YACX,cAAc;YACd,mBAAmB;YACnB,uBAAuB;SACxB,CAAC,EACF,EAAE,CACH,CAAC;QACF,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAExB,OAAO,GAAG,EAAE;YACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC;CAAA;AAED,kBAAe,cAAc,CAAC"}
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
1
5
  export interface ReactGeneratorSchema {
2
6
  frontendProjectName: string;
3
7
  backendProjectName: string;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
1
5
  import { Tree } from '@nx/devkit';
2
6
  import { CjsToEsmGeneratorSchema } from './schema';
3
7
  export declare function cjsToEsm(tree: Tree, relativePathInTree: string, options?: {
@@ -1,178 +1,169 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- cjsToEsm: function() {
13
- return cjsToEsm;
14
- },
15
- cjsToEsmGenerator: function() {
16
- return cjsToEsmGenerator;
17
- },
18
- default: function() {
19
- return _default;
20
- }
21
- });
22
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
23
- const _devkit = require("@nx/devkit");
24
- const _tsquery = require("@phenomnomnominal/tsquery");
25
- const _typescript = /*#__PURE__*/ _interop_require_wildcard._(require("typescript"));
26
- const _minimatch = require("minimatch");
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cjsToEsm = cjsToEsm;
4
+ exports.cjsToEsmGenerator = cjsToEsmGenerator;
5
+ const tslib_1 = require("tslib");
6
+ /**
7
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
8
+ * SPDX-License-Identifier: Apache-2.0
9
+ */
10
+ const devkit_1 = require("@nx/devkit");
11
+ const tsquery_1 = require("@phenomnomnominal/tsquery");
12
+ const ts = tslib_1.__importStar(require("typescript"));
13
+ const minimatch_1 = require("minimatch");
27
14
  // Replaces "module.exports = value" with "export default value"
28
- const replaceModuleExportsWithExportDefault = (sourceFile)=>{
29
- const transformer = (context)=>(rootNode)=>{
30
- function visit(node) {
31
- if (_typescript.isExpressionStatement(node)) {
32
- const expr = node.expression;
33
- if (_typescript.isBinaryExpression(expr) && _typescript.isPropertyAccessExpression(expr.left) && _typescript.isIdentifier(expr.left.expression) && expr.left.expression.text === 'module' && _typescript.isIdentifier(expr.left.name) && expr.left.name.text === 'exports' && expr.operatorToken.kind === _typescript.SyntaxKind.EqualsToken) {
34
- // Create an export default statement
35
- return context.factory.createExportAssignment(undefined, undefined, expr.right);
36
- }
15
+ const replaceModuleExportsWithExportDefault = (sourceFile) => {
16
+ const transformer = (context) => (rootNode) => {
17
+ function visit(node) {
18
+ if (ts.isExpressionStatement(node)) {
19
+ const expr = node.expression;
20
+ if (ts.isBinaryExpression(expr) &&
21
+ ts.isPropertyAccessExpression(expr.left) &&
22
+ ts.isIdentifier(expr.left.expression) &&
23
+ expr.left.expression.text === 'module' &&
24
+ ts.isIdentifier(expr.left.name) &&
25
+ expr.left.name.text === 'exports' &&
26
+ expr.operatorToken.kind === ts.SyntaxKind.EqualsToken) {
27
+ // Create an export default statement
28
+ return context.factory.createExportAssignment(undefined, undefined, expr.right);
37
29
  }
38
- return _typescript.visitEachChild(node, visit, context);
39
30
  }
40
- return _typescript.visitNode(rootNode, visit);
41
- };
42
- const result = _typescript.transform(sourceFile, [
43
- transformer
44
- ]);
31
+ return ts.visitEachChild(node, visit, context);
32
+ }
33
+ return ts.visitNode(rootNode, visit);
34
+ };
35
+ const result = ts.transform(sourceFile, [transformer]);
45
36
  return result.transformed[0];
46
37
  };
47
38
  // Replaces "const x = require('y')" with "import x from 'y'"
48
- const replaceRequires = (sourceFile)=>{
49
- const transformer = (context)=>(rootNode)=>{
50
- function visit(node) {
51
- if (_typescript.isVariableStatement(node)) {
52
- const declaration = node.declarationList.declarations[0];
53
- if (declaration && _typescript.isVariableDeclaration(declaration)) {
54
- const initializer = declaration.initializer;
55
- if (initializer && _typescript.isCallExpression(initializer) && _typescript.isIdentifier(initializer.expression) && initializer.expression.text === 'require' && initializer.arguments.length === 1) {
56
- const modulePath = initializer.arguments[0];
57
- if (_typescript.isStringLiteral(modulePath)) {
58
- // Handle destructuring pattern
59
- if (_typescript.isObjectBindingPattern(declaration.name)) {
60
- const importSpecifiers = declaration.name.elements.map((element)=>{
61
- if (_typescript.isBindingElement(element) && _typescript.isIdentifier(element.name)) {
62
- return context.factory.createImportSpecifier(false, undefined, element.name);
63
- }
64
- return undefined;
65
- }).filter((spec)=>spec !== undefined);
66
- return context.factory.createImportDeclaration(undefined, context.factory.createImportClause(false, undefined, context.factory.createNamedImports(importSpecifiers)), modulePath, undefined);
67
- }
68
- // Handle simple require
69
- if (_typescript.isIdentifier(declaration.name)) {
70
- return context.factory.createImportDeclaration(undefined, context.factory.createImportClause(false, declaration.name, undefined), modulePath, undefined);
71
- }
39
+ const replaceRequires = (sourceFile) => {
40
+ const transformer = (context) => (rootNode) => {
41
+ function visit(node) {
42
+ if (ts.isVariableStatement(node)) {
43
+ const declaration = node.declarationList.declarations[0];
44
+ if (declaration && ts.isVariableDeclaration(declaration)) {
45
+ const initializer = declaration.initializer;
46
+ if (initializer &&
47
+ ts.isCallExpression(initializer) &&
48
+ ts.isIdentifier(initializer.expression) &&
49
+ initializer.expression.text === 'require' &&
50
+ initializer.arguments.length === 1) {
51
+ const modulePath = initializer.arguments[0];
52
+ if (ts.isStringLiteral(modulePath)) {
53
+ // Handle destructuring pattern
54
+ if (ts.isObjectBindingPattern(declaration.name)) {
55
+ const importSpecifiers = declaration.name.elements
56
+ .map((element) => {
57
+ if (ts.isBindingElement(element) &&
58
+ ts.isIdentifier(element.name)) {
59
+ return context.factory.createImportSpecifier(false, undefined, element.name);
60
+ }
61
+ return undefined;
62
+ })
63
+ .filter((spec) => spec !== undefined);
64
+ return context.factory.createImportDeclaration(undefined, context.factory.createImportClause(false, undefined, context.factory.createNamedImports(importSpecifiers)), modulePath, undefined);
65
+ }
66
+ // Handle simple require
67
+ if (ts.isIdentifier(declaration.name)) {
68
+ return context.factory.createImportDeclaration(undefined, context.factory.createImportClause(false, declaration.name, undefined), modulePath, undefined);
72
69
  }
73
70
  }
74
71
  }
75
72
  }
76
- return _typescript.visitEachChild(node, visit, context);
77
73
  }
78
- return _typescript.visitNode(rootNode, visit);
79
- };
80
- const result = _typescript.transform(sourceFile, [
81
- transformer
82
- ]);
74
+ return ts.visitEachChild(node, visit, context);
75
+ }
76
+ return ts.visitNode(rootNode, visit);
77
+ };
78
+ const result = ts.transform(sourceFile, [transformer]);
83
79
  return result.transformed[0];
84
80
  };
85
81
  // Replaces requires not directly assigned to variables eg
86
82
  // "const x = require('y').foo()" with
87
83
  // import _import0 from 'y'
88
84
  // const x = _import0.foo()
89
- const replaceInlineRequires = (sourceFile)=>{
85
+ const replaceInlineRequires = (sourceFile) => {
90
86
  let importCounter = 0;
91
87
  const imports = [];
92
88
  const importMap = new Map();
93
- const transformer = (context)=>(rootNode)=>{
94
- function visit(node) {
95
- if (_typescript.isCallExpression(node) && _typescript.isIdentifier(node.expression) && node.expression.text === 'require' && node.arguments.length === 1 && _typescript.isStringLiteral(node.arguments[0])) {
96
- const modulePath = node.arguments[0];
97
- const modulePathText = modulePath.text;
98
- // Check if we already have an import for this module
99
- if (!importMap.has(modulePathText)) {
100
- const importName = `_import${importCounter++}`;
101
- importMap.set(modulePathText, importName);
102
- // Create import declaration
103
- imports.push(context.factory.createImportDeclaration(undefined, context.factory.createImportClause(false, context.factory.createIdentifier(importName), undefined), modulePath, undefined));
104
- }
105
- // Replace require() with the import reference
106
- return context.factory.createIdentifier(importMap.get(modulePathText));
89
+ const transformer = (context) => (rootNode) => {
90
+ function visit(node) {
91
+ if (ts.isCallExpression(node) &&
92
+ ts.isIdentifier(node.expression) &&
93
+ node.expression.text === 'require' &&
94
+ node.arguments.length === 1 &&
95
+ ts.isStringLiteral(node.arguments[0])) {
96
+ const modulePath = node.arguments[0];
97
+ const modulePathText = modulePath.text;
98
+ // Check if we already have an import for this module
99
+ if (!importMap.has(modulePathText)) {
100
+ const importName = `_import${importCounter++}`;
101
+ importMap.set(modulePathText, importName);
102
+ // Create import declaration
103
+ imports.push(context.factory.createImportDeclaration(undefined, context.factory.createImportClause(false, context.factory.createIdentifier(importName), undefined), modulePath, undefined));
107
104
  }
108
- return _typescript.visitEachChild(node, visit, context);
109
- }
110
- // First pass to collect all requires and create imports
111
- const visited = _typescript.visitNode(rootNode, visit);
112
- // If we found any inline requires, prepend the imports to the source file
113
- if (imports.length > 0 && _typescript.isSourceFile(visited)) {
114
- return context.factory.updateSourceFile(visited, [
115
- ...imports,
116
- ...visited.statements
117
- ]);
105
+ // Replace require() with the import reference
106
+ return context.factory.createIdentifier(importMap.get(modulePathText));
118
107
  }
119
- return visited;
120
- };
121
- const result = _typescript.transform(sourceFile, [
122
- transformer
123
- ]);
108
+ return ts.visitEachChild(node, visit, context);
109
+ }
110
+ // First pass to collect all requires and create imports
111
+ const visited = ts.visitNode(rootNode, visit);
112
+ // If we found any inline requires, prepend the imports to the source file
113
+ if (imports.length > 0 && ts.isSourceFile(visited)) {
114
+ return context.factory.updateSourceFile(visited, [
115
+ ...imports,
116
+ ...visited.statements,
117
+ ]);
118
+ }
119
+ return visited;
120
+ };
121
+ const result = ts.transform(sourceFile, [transformer]);
124
122
  return result.transformed[0];
125
123
  };
126
124
  function cjsToEsm(tree, relativePathInTree, options) {
127
- var _options_include;
128
- const includePatterns = (_options_include = options == null ? void 0 : options.include) != null ? _options_include : [
129
- '**/*.{js,ts}'
130
- ];
131
- var _options_exclude;
132
- const excludePatterns = (_options_exclude = options == null ? void 0 : options.exclude) != null ? _options_exclude : [
133
- 'node_modules',
134
- 'dist',
135
- 'build',
136
- 'tmp',
137
- '.nx'
138
- ].flatMap((p)=>[
139
- p,
140
- `**/${p}/**/*`,
141
- `${p}/**/*`
142
- ]);
125
+ var _a, _b;
126
+ const includePatterns = (_a = options === null || options === void 0 ? void 0 : options.include) !== null && _a !== void 0 ? _a : ['**/*.{js,ts}'];
127
+ const excludePatterns = (_b = options === null || options === void 0 ? void 0 : options.exclude) !== null && _b !== void 0 ? _b : ['node_modules', 'dist', 'build', 'tmp', '.nx'].flatMap((p) => [
128
+ p,
129
+ `**/${p}/**/*`,
130
+ `${p}/**/*`,
131
+ ]);
143
132
  // Process each TypeScript/JavaScript file in the project
144
- const processFile = (filePath)=>{
133
+ const processFile = (filePath) => {
145
134
  const content = tree.read(filePath, 'utf-8');
146
- if (!content) return;
135
+ if (!content)
136
+ return;
147
137
  // Parse the source file
148
- const originalSourceFile = _tsquery.tsquery.ast(content);
138
+ const originalSourceFile = tsquery_1.tsquery.ast(content);
149
139
  let sourceFile = originalSourceFile;
150
140
  sourceFile = replaceModuleExportsWithExportDefault(sourceFile);
151
141
  sourceFile = replaceRequires(sourceFile);
152
142
  sourceFile = replaceInlineRequires(sourceFile);
153
- const printer = _typescript.createPrinter({
143
+ const printer = ts.createPrinter({
154
144
  removeComments: false,
155
- newLine: _typescript.NewLineKind.LineFeed
145
+ newLine: ts.NewLineKind.LineFeed,
156
146
  });
157
- tree.write(filePath, printer.printNode(_typescript.EmitHint.Unspecified, sourceFile, originalSourceFile));
147
+ tree.write(filePath, printer.printNode(ts.EmitHint.Unspecified, sourceFile, originalSourceFile));
158
148
  };
159
149
  // Process all files in the given directory (recursively)
160
- const processDirectory = (dirPath)=>{
150
+ const processDirectory = (dirPath) => {
161
151
  const entries = tree.children(dirPath);
162
- entries.forEach((entry)=>{
152
+ entries.forEach((entry) => {
163
153
  const fullPath = `${dirPath}/${entry}`;
164
154
  const relativePath = fullPath.replace(`${relativePathInTree}/`, '');
165
155
  // Return early for exclude to ensure we don't traverse node_modules etc!
166
- const shouldExclude = excludePatterns.some((pattern)=>(0, _minimatch.minimatch)(relativePath, pattern));
156
+ const shouldExclude = excludePatterns.some((pattern) => (0, minimatch_1.minimatch)(relativePath, pattern));
167
157
  if (shouldExclude) {
168
158
  return;
169
159
  }
170
160
  if (tree.isFile(fullPath)) {
171
- const shouldInclude = includePatterns.some((pattern)=>(0, _minimatch.minimatch)(relativePath, pattern));
161
+ const shouldInclude = includePatterns.some((pattern) => (0, minimatch_1.minimatch)(relativePath, pattern));
172
162
  if (shouldInclude) {
173
163
  processFile(fullPath);
174
164
  }
175
- } else {
165
+ }
166
+ else {
176
167
  processDirectory(fullPath);
177
168
  }
178
169
  });
@@ -180,22 +171,19 @@ function cjsToEsm(tree, relativePathInTree, options) {
180
171
  // Start processing from the given directories
181
172
  processDirectory(relativePathInTree);
182
173
  }
183
- async function cjsToEsmGenerator(tree, options) {
184
- // Get the project configuration
185
- const projects = (0, _devkit.getProjects)(tree);
186
- const project = projects.get(options.project);
187
- if (!project) {
188
- throw new Error(`Project ${options.project} not found`);
189
- }
190
- cjsToEsm(tree, project.root, {
191
- include: options.include ? [
192
- options.include
193
- ] : undefined,
194
- exclude: options.exclude ? [
195
- options.exclude
196
- ] : undefined
174
+ function cjsToEsmGenerator(tree, options) {
175
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
176
+ // Get the project configuration
177
+ const projects = (0, devkit_1.getProjects)(tree);
178
+ const project = projects.get(options.project);
179
+ if (!project) {
180
+ throw new Error(`Project ${options.project} not found`);
181
+ }
182
+ cjsToEsm(tree, project.root, {
183
+ include: options.include ? [options.include] : undefined,
184
+ exclude: options.exclude ? [options.exclude] : undefined,
185
+ });
197
186
  });
198
187
  }
199
- const _default = cjsToEsmGenerator;
200
-
188
+ exports.default = cjsToEsmGenerator;
201
189
  //# sourceMappingURL=generator.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/cjs-to-esm/generator.ts"],"sourcesContent":["import {\n Tree,\n getProjects,\n} from '@nx/devkit';\nimport { CjsToEsmGeneratorSchema } from './schema';\nimport { tsquery } from '@phenomnomnominal/tsquery';\nimport * as ts from 'typescript';\nimport { minimatch } from 'minimatch';\n\n// Replaces \"module.exports = value\" with \"export default value\"\nconst replaceModuleExportsWithExportDefault = (sourceFile: ts.SourceFile): ts.SourceFile => {\n const transformer = <T extends ts.Node>(context: ts.TransformationContext) => (rootNode: T) => {\n function visit(node: ts.Node): ts.Node {\n if (ts.isExpressionStatement(node)) {\n const expr = node.expression;\n if (ts.isBinaryExpression(expr) &&\n ts.isPropertyAccessExpression(expr.left) &&\n ts.isIdentifier(expr.left.expression) &&\n expr.left.expression.text === 'module' &&\n ts.isIdentifier(expr.left.name) &&\n expr.left.name.text === 'exports' &&\n expr.operatorToken.kind === ts.SyntaxKind.EqualsToken) {\n\n // Create an export default statement\n return context.factory.createExportAssignment(\n undefined,\n undefined,\n expr.right\n );\n }\n }\n return ts.visitEachChild(node, visit, context);\n }\n return ts.visitNode(rootNode, visit);\n };\n\n const result = ts.transform(sourceFile, [transformer]);\n return result.transformed[0] as ts.SourceFile;\n};\n\n// Replaces \"const x = require('y')\" with \"import x from 'y'\"\nconst replaceRequires = (sourceFile: ts.SourceFile): ts.SourceFile => {\n const transformer = <T extends ts.Node>(context: ts.TransformationContext) => (rootNode: T) => {\n function visit(node: ts.Node): ts.Node {\n if (ts.isVariableStatement(node)) {\n const declaration = node.declarationList.declarations[0];\n if (declaration && ts.isVariableDeclaration(declaration)) {\n const initializer = declaration.initializer;\n if (initializer && ts.isCallExpression(initializer) &&\n ts.isIdentifier(initializer.expression) &&\n initializer.expression.text === 'require' &&\n initializer.arguments.length === 1) {\n\n const modulePath = initializer.arguments[0];\n if (ts.isStringLiteral(modulePath)) {\n // Handle destructuring pattern\n if (ts.isObjectBindingPattern(declaration.name)) {\n const importSpecifiers = declaration.name.elements.map(element => {\n if (ts.isBindingElement(element) && ts.isIdentifier(element.name)) {\n return context.factory.createImportSpecifier(\n false,\n undefined,\n element.name\n );\n }\n return undefined;\n }).filter((spec): spec is ts.ImportSpecifier => spec !== undefined);\n\n return context.factory.createImportDeclaration(\n undefined,\n context.factory.createImportClause(\n false,\n undefined,\n context.factory.createNamedImports(importSpecifiers)\n ),\n modulePath,\n undefined\n );\n }\n\n // Handle simple require\n if (ts.isIdentifier(declaration.name)) {\n return context.factory.createImportDeclaration(\n undefined,\n context.factory.createImportClause(\n false,\n declaration.name,\n undefined\n ),\n modulePath,\n undefined\n );\n }\n }\n }\n }\n }\n return ts.visitEachChild(node, visit, context);\n }\n return ts.visitNode(rootNode, visit);\n };\n\n const result = ts.transform(sourceFile, [transformer]);\n return result.transformed[0] as ts.SourceFile;\n};\n\n// Replaces requires not directly assigned to variables eg\n// \"const x = require('y').foo()\" with\n// import _import0 from 'y'\n// const x = _import0.foo()\nconst replaceInlineRequires = (sourceFile: ts.SourceFile): ts.SourceFile => {\n let importCounter = 0;\n const imports: ts.ImportDeclaration[] = [];\n const importMap = new Map<string, string>();\n\n const transformer = <T extends ts.Node>(context: ts.TransformationContext) => (rootNode: T) => {\n function visit(node: ts.Node): ts.Node {\n if (ts.isCallExpression(node) &&\n ts.isIdentifier(node.expression) &&\n node.expression.text === 'require' &&\n node.arguments.length === 1 &&\n ts.isStringLiteral(node.arguments[0])) {\n\n const modulePath = node.arguments[0];\n const modulePathText = modulePath.text;\n\n // Check if we already have an import for this module\n if (!importMap.has(modulePathText)) {\n const importName = `_import${importCounter++}`;\n importMap.set(modulePathText, importName);\n\n // Create import declaration\n imports.push(context.factory.createImportDeclaration(\n undefined,\n context.factory.createImportClause(\n false,\n context.factory.createIdentifier(importName),\n undefined\n ),\n modulePath,\n undefined\n ));\n }\n\n // Replace require() with the import reference\n return context.factory.createIdentifier(importMap.get(modulePathText)!);\n }\n\n return ts.visitEachChild(node, visit, context);\n }\n\n // First pass to collect all requires and create imports\n const visited = ts.visitNode(rootNode, visit);\n\n // If we found any inline requires, prepend the imports to the source file\n if (imports.length > 0 && ts.isSourceFile(visited)) {\n return context.factory.updateSourceFile(\n visited,\n [...imports, ...visited.statements]\n );\n }\n\n return visited;\n };\n\n const result = ts.transform(sourceFile, [transformer]);\n return result.transformed[0] as ts.SourceFile;\n};\n\nexport function cjsToEsm(tree: Tree, relativePathInTree: string, options?: { include?: string[]; exclude?: string[] }) {\n const includePatterns = options?.include ?? ['**/*.{js,ts}'];\n const excludePatterns = options?.exclude ?? ['node_modules', 'dist', 'build', 'tmp', '.nx'].flatMap(p => [p, `**/${p}/**/*`, `${p}/**/*`]);\n\n // Process each TypeScript/JavaScript file in the project\n const processFile = (filePath: string) => {\n const content = tree.read(filePath, 'utf-8');\n if (!content) return;\n\n // Parse the source file\n const originalSourceFile = tsquery.ast(content);\n let sourceFile = originalSourceFile;\n\n sourceFile = replaceModuleExportsWithExportDefault(sourceFile);\n sourceFile = replaceRequires(sourceFile);\n sourceFile = replaceInlineRequires(sourceFile);\n\n const printer = ts.createPrinter({ removeComments: false, newLine: ts.NewLineKind.LineFeed });\n tree.write(filePath, printer.printNode(ts.EmitHint.Unspecified, sourceFile, originalSourceFile));\n };\n\n // Process all files in the given directory (recursively)\n const processDirectory = (dirPath: string) => {\n const entries = tree.children(dirPath);\n entries.forEach(entry => {\n const fullPath = `${dirPath}/${entry}`;\n const relativePath = fullPath.replace(`${relativePathInTree}/`, '');\n\n // Return early for exclude to ensure we don't traverse node_modules etc!\n const shouldExclude = excludePatterns.some(pattern => minimatch(relativePath, pattern));\n if (shouldExclude) {\n return;\n }\n\n if (tree.isFile(fullPath)) {\n const shouldInclude = includePatterns.some(pattern => minimatch(relativePath, pattern));\n if (shouldInclude) {\n processFile(fullPath);\n }\n } else {\n processDirectory(fullPath);\n }\n });\n };\n\n // Start processing from the given directories\n processDirectory(relativePathInTree);\n}\n\nexport async function cjsToEsmGenerator(\n tree: Tree,\n options: CjsToEsmGeneratorSchema\n) {\n // Get the project configuration\n const projects = getProjects(tree);\n const project = projects.get(options.project);\n\n if (!project) {\n throw new Error(`Project ${options.project} not found`);\n }\n\n cjsToEsm(tree, project.root, {\n include: options.include ? [options.include] : undefined,\n exclude: options.exclude ? [options.exclude] : undefined,\n });\n}\n\nexport default cjsToEsmGenerator;\n"],"names":["cjsToEsm","cjsToEsmGenerator","replaceModuleExportsWithExportDefault","sourceFile","transformer","context","rootNode","visit","node","ts","isExpressionStatement","expr","expression","isBinaryExpression","isPropertyAccessExpression","left","isIdentifier","text","name","operatorToken","kind","SyntaxKind","EqualsToken","factory","createExportAssignment","undefined","right","visitEachChild","visitNode","result","transform","transformed","replaceRequires","isVariableStatement","declaration","declarationList","declarations","isVariableDeclaration","initializer","isCallExpression","arguments","length","modulePath","isStringLiteral","isObjectBindingPattern","importSpecifiers","elements","map","element","isBindingElement","createImportSpecifier","filter","spec","createImportDeclaration","createImportClause","createNamedImports","replaceInlineRequires","importCounter","imports","importMap","Map","modulePathText","has","importName","set","push","createIdentifier","get","visited","isSourceFile","updateSourceFile","statements","tree","relativePathInTree","options","includePatterns","include","excludePatterns","exclude","flatMap","p","processFile","filePath","content","read","originalSourceFile","tsquery","ast","printer","createPrinter","removeComments","newLine","NewLineKind","LineFeed","write","printNode","EmitHint","Unspecified","processDirectory","dirPath","entries","children","forEach","entry","fullPath","relativePath","replace","shouldExclude","some","pattern","minimatch","isFile","shouldInclude","projects","getProjects","project","Error","root"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAyKgBA,QAAQ;eAARA;;IAiDMC,iBAAiB;eAAjBA;;IAkBtB,OAAiC;eAAjC;;;;wBAzOO;yBAEiB;sEACJ;2BACM;AAE1B,gEAAgE;AAChE,MAAMC,wCAAwC,CAACC;IAC7C,MAAMC,cAAc,CAAoBC,UAAsC,CAACC;YAC7E,SAASC,MAAMC,IAAa;gBAC1B,IAAIC,YAAGC,qBAAqB,CAACF,OAAO;oBAClC,MAAMG,OAAOH,KAAKI,UAAU;oBAC5B,IAAIH,YAAGI,kBAAkB,CAACF,SACtBF,YAAGK,0BAA0B,CAACH,KAAKI,IAAI,KACvCN,YAAGO,YAAY,CAACL,KAAKI,IAAI,CAACH,UAAU,KACpCD,KAAKI,IAAI,CAACH,UAAU,CAACK,IAAI,KAAK,YAC9BR,YAAGO,YAAY,CAACL,KAAKI,IAAI,CAACG,IAAI,KAC9BP,KAAKI,IAAI,CAACG,IAAI,CAACD,IAAI,KAAK,aACxBN,KAAKQ,aAAa,CAACC,IAAI,KAAKX,YAAGY,UAAU,CAACC,WAAW,EAAE;wBAEzD,qCAAqC;wBACrC,OAAOjB,QAAQkB,OAAO,CAACC,sBAAsB,CAC3CC,WACAA,WACAd,KAAKe,KAAK;oBAEd;gBACF;gBACA,OAAOjB,YAAGkB,cAAc,CAACnB,MAAMD,OAAOF;YACxC;YACA,OAAOI,YAAGmB,SAAS,CAACtB,UAAUC;QAChC;IAEA,MAAMsB,SAASpB,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AAC,QAAQ,EAAE1C,QAAQyC,OAAO,CAAC,UAAU,CAAC;IACxD;IAEAnH,SAASwE,MAAM2C,QAAQE,IAAI,EAAE;QAC3BzC,SAASF,QAAQE,OAAO,GAAG;YAACF,QAAQE,OAAO;SAAC,GAAGnD;QAC/CqD,SAASJ,QAAQI,OAAO,GAAG;YAACJ,QAAQI,OAAO;SAAC,GAAGrD;IACjD;AACF;MAEA,WAAexB"}
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/ts/cjs-to-esm/generator.ts"],"names":[],"mappings":";;AAiMA,4BAmEC;AAED,8CAgBC;;AAtRD;;;GAGG;AACH,uCAA+C;AAE/C,uDAAoD;AACpD,uDAAiC;AACjC,yCAAsC;AAEtC,gEAAgE;AAChE,MAAM,qCAAqC,GAAG,CAC5C,UAAyB,EACV,EAAE;IACjB,MAAM,WAAW,GACf,CAAoB,OAAiC,EAAE,EAAE,CACzD,CAAC,QAAW,EAAE,EAAE;QACd,SAAS,KAAK,CAAC,IAAa;YAC1B,IAAI,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnC,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC;gBAC7B,IACE,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC;oBAC3B,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC;oBACxC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;oBACrC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,QAAQ;oBACtC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;oBAC/B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS;oBACjC,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,WAAW,EACrD,CAAC;oBACD,qCAAqC;oBAC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SAAS;YACxD,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;SACzD,CAAC,CAAC;IACL,CAAC;CAAA;AAED,kBAAe,iBAAiB,CAAC"}
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
1
5
  export interface CjsToEsmGeneratorSchema {
2
6
  project: string;
3
7
  include?: string;
@@ -1,3 +1,7 @@
1
- import { Tree } from "@nx/devkit";
2
- import { ConfigureProjectOptions } from "./types";
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { Tree } from '@nx/devkit';
6
+ import { ConfigureProjectOptions } from './types';
3
7
  export declare const configureEslint: (tree: Tree, options: ConfigureProjectOptions) => void;