@trackunit/iris-app 2.16.73 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/package.json +17 -17
- package/src/generators/ai-agent-sync/README.md +5 -2
- package/src/generators/ai-agent-sync/generator.d.ts +1 -1
- package/src/generators/ai-agent-sync/generator.js +41 -7
- package/src/generators/ai-agent-sync/legacy-agents-md/v1-prettier.md +98 -0
- package/src/generators/ai-agent-sync/legacy-agents-md/v1.md +95 -0
- package/src/generators/ai-agent-sync/legacy-agents-md/v2-prettier.md +93 -0
- package/src/generators/ai-agent-sync/legacy-agents-md/v2.md +90 -0
- package/src/generators/ai-agent-sync/legacy-agents-md/v3-prettier.md +94 -0
- package/src/generators/ai-agent-sync/legacy-agents-md/v3.md +91 -0
- package/src/generators/ai-agent-sync/legacy-agents-md/v4.md +43 -0
- package/src/generators/ai-agent-sync/legacy-agents-md/v5.md +43 -0
- package/src/generators/ai-agent-sync/legacy-agents-md/v6.md +62 -0
- package/src/generators/ai-agent-sync/legacy-agents-md/v7.md +62 -0
- package/src/generators/ai-agent-sync/legacy-agents-md/v8.md +62 -0
- package/src/generators/preset/files/.agents/skills/create-app/SKILL.md +2 -2
- package/src/generators/preset/files/.agents/skills/databricks-unity-catalog/SKILL.md +1 -1
- package/src/generators/preset/files/.agents/skills/graphql/SKILL.md +1 -1
- package/src/generators/preset/files/.agents/skills/irisx-app-sdk/SKILL.md +1 -1
- package/src/generators/preset/files/.agents/skills/set-up-react-map/SKILL.md +1 -1
- package/src/generators/preset/files/.agents/skills/widget-extensions/SKILL.md +1 -1
- package/src/generators/preset/generator.js +2 -0
- package/src/generators/preset/root-files/AGENTS-iris-app-sdk.md +78 -0
- package/src/generators/utils/sdk-agents-md/sdk-agents-md.d.ts +7 -0
- package/src/generators/utils/sdk-agents-md/sdk-agents-md.js +20 -0
- package/migrations/entry.js.map +0 -1
- package/migrations/p-content-space-codemod/invent-content-space.js.map +0 -1
- package/migrations/p-content-space-codemod/orchestrator.js.map +0 -1
- package/migrations/p-content-space-codemod/remove-redundant-padding.js.map +0 -1
- package/migrations/p-content-space-codemod/report-run-messaging.js.map +0 -1
- package/migrations/p-content-space-codemod/report-unresolved.js.map +0 -1
- package/migrations/p-content-space-codemod/resolve-content-shell.js.map +0 -1
- package/migrations/p-content-space-codemod/rewrite-page-content.js.map +0 -1
- package/migrations/p-content-space-codemod/shell-skip-reason.js.map +0 -1
- package/migrations/repair-tsconfig/repair-tsconfig.js.map +0 -1
- package/migrations/utils/classname-ast-rewrite.js.map +0 -1
- package/migrations/utils/resolve-extension-types.js.map +0 -1
- package/src/executors/submit/executor.js.map +0 -1
- package/src/executors/unpublish/executor.js.map +0 -1
- package/src/executors/utils/authentication.js.map +0 -1
- package/src/executors/utils/irisAppServerSettings.js.map +0 -1
- package/src/executors/utils/src/index.js.map +0 -1
- package/src/generators/ai-agent-sync/generator.js.map +0 -1
- package/src/generators/create/generator.js.map +0 -1
- package/src/generators/extend/dependencies.js.map +0 -1
- package/src/generators/extend/generator.js.map +0 -1
- package/src/generators/preset/generator.js.map +0 -1
- package/src/generators/utils/get-package-manifest.js.map +0 -1
- package/src/generators/utils/link-claude-skills.js.map +0 -1
- package/src/generators/utils/own-package-json/own-package-json.js.map +0 -1
- package/src/generators/utils/pinned-versions/pinned-versions.js.map +0 -1
- package/src/generators/utils/uses-trackunit-eslint-plugin.js.map +0 -1
- package/src/generators/utils/write-trackunit-project-eslint-config.js.map +0 -1
- package/src/index.js.map +0 -1
- package/src/utils/ast/astUtils.js.map +0 -1
- package/src/utils/fileUpdater.js.map +0 -1
- /package/src/generators/{preset/root-files/AGENTS.md → ai-agent-sync/legacy-agents-md/v9.md} +0 -0
package/migrations/entry.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../../../../../libs/iris-app-sdk/iris-app/migrations/entry.ts"],"names":[],"mappings":"","sourcesContent":["// Migration entry point for @nx/js:tsc build target.\n// Migrations are registered in ../migrations.json and resolved by NX at runtime.\nexport {};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"invent-content-space.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app/migrations/p-content-space-codemod/invent-content-space.ts"],"names":[],"mappings":";;;AACA,wEAAsF;AACtF,oDAAyE;AACzE,4EAAsE;AACtE,0EAMwC;AAExC,2DAAwF;AACxF,mEAA0F;AAG1F,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAE9C;;;;GAIG;AACU,QAAA,sBAAsB,GAAwB,IAAI,GAAG,CAAC;IACjE,sBAAsB;IACtB,qBAAqB;IACrB,iBAAiB;CAClB,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC;AAC7E,MAAM,kBAAkB,GAAG;IACzB,GAAG;IACH,KAAK;IACL,GAAG;IACH,KAAK;IACL,GAAG;IACH,KAAK;IACL,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,kBAAkB;CACV,CAAC;AACX,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAU,CAAC;AAErE,MAAM,YAAY,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CA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_NODE_TYPES, type TSESTree } from \"@typescript-eslint/types\";\nimport { simpleTraverse } from \"@typescript-eslint/typescript-estree\";\nimport {\n applyEdits,\n buildEditsForLocation,\n findClassnameLocations,\n parseTsestreeSource,\n type ClassnameEdit,\n} from \"../utils/classname-ast-rewrite\";\nimport type { ResolvedExtension } from \"../utils/resolve-extension-types\";\nimport { findUnresolvedSurface, type MigrationChangeReport } from \"./report-unresolved\";\nimport { resolveContentShells, type ResolvedContentShell } from \"./resolve-content-shell\";\nimport type { ShellSkipReason } from \"./shell-skip-reason\";\n\nconst CONTENT_SPACE_TOKEN = \"p-content-space\";\n\n/**\n * Extension types that may invent/convert content-shell padding. Fleet/Customer\n * remain swap-only (page-content rewrite) and must never invent or convert.\n * Shared with the orchestrator so the ASA gate lives in exactly one place.\n */\nexport const ASSET_SITE_ADMIN_TYPES: ReadonlySet<string> = new Set([\n \"ASSET_HOME_EXTENSION\",\n \"SITE_HOME_EXTENSION\",\n \"ADMIN_EXTENSION\",\n]);\n\nconst SHELL_INSET_SIDES = [\"p\", \"px\", \"py\", \"pt\", \"pr\", \"pb\", \"pl\"] as const;\nconst SHELL_INSET_VALUES = [\n \"1\",\n \"1.5\",\n \"2\",\n \"2.5\",\n \"3\",\n \"3.5\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"10\",\n \"11\",\n \"12\",\n \"14\",\n \"16\",\n \"20\",\n \"24\",\n \"28\",\n \"32\",\n \"36\",\n \"40\",\n \"44\",\n \"48\",\n \"52\",\n \"56\",\n \"60\",\n \"64\",\n \"72\",\n \"80\",\n \"96\",\n \"responsive-space\",\n] as const;\nconst BREAKPOINT_VARIANTS = [\"sm\", \"md\", \"lg\", \"xl\", \"2xl\"] as const;\n\nconst escapeRegExp = (value: string): string => value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\n/**\n * Tailwind padding utilities treated as content-region shell inset candidates.\n * Enumerated (not `.+`) so reset tokens (`px-0`, `pb-0.5`) and state/print\n * variants (`hover:`, `focus:`, `print:`) are left alone. Breakpoint variants\n * (`md:p-6`) are still converted — those are lossy and logged as such.\n */\nconst SHELL_PADDING_TOKEN = new RegExp(\n `^(?:(?:${BREAKPOINT_VARIANTS.join(\"|\")}):)?(?:${SHELL_INSET_SIDES.join(\"|\")})-(?:${SHELL_INSET_VALUES.map(escapeRegExp).join(\"|\")})$`\n);\n\nconst tokenBase = (token: string): string => (token.includes(\":\") ? token.slice(token.lastIndexOf(\":\") + 1) : token);\n\nconst isContentSpaceToken = (token: string): boolean => tokenBase(token) === CONTENT_SPACE_TOKEN;\n\nconst isShellPaddingToken = (token: string): boolean => {\n if (isContentSpaceToken(token)) {\n return false;\n }\n return SHELL_PADDING_TOKEN.test(token);\n};\n\ntype InventContentSpaceResult = {\n filesChanged: ReadonlyArray<string>;\n changes: ReadonlyArray<MigrationChangeReport>;\n skippedRouteNames: ReadonlyArray<string>;\n /** Set when shell discovery returned unresolved (invent made no edits). */\n unresolvedReason: ShellSkipReason | null;\n};\n\nconst emptyResult = (unresolvedReason: ShellSkipReason | null = null): InventContentSpaceResult => ({\n filesChanged: [],\n changes: [],\n skippedRouteNames: [],\n unresolvedReason,\n});\n\n/**\n * Ensures each resolved ASA content shell carries `p-content-space`:\n * - invents the token on a bare shell (reported as `addition`)\n * - converts custom shell padding (`p-*` / `px-*` / `py-*` / sides /\n * `p-responsive-space` / `pb-responsive-space`) to `p-content-space`,\n * removing those custom tokens (reported as `conversion`)\n *\n * Uses {@link resolveContentShells}: shared layout Outlet shells yield one\n * target; multi-route without a shared layout invents/converts each clear\n * leaf. Only classname locations bound to each host are edited — inner layout\n * padding is left alone. Idempotent when a shell already has `p-content-space`\n * (including a variant-prefixed form) and no custom shell padding (including\n * whitespace-only differences). Never invents an `overflow-*` token — existing\n * scroll ownership is preserved. Fleet/Customer types are a no-op (swap-only\n * surfaces).\n *\n * Returns empty `filesChanged` / `changes` (never throws) when shells are\n * unresolved, the extension type is out of scope, or already in the desired state.\n * `skippedRouteNames` names unanalysable routes on a partial graph so the\n * orchestrator can report them instead of treating the extension as fully migrated.\n */\nexport const inventContentSpace = (tree: Tree, extension: ResolvedExtension): InventContentSpaceResult => {\n if (!ASSET_SITE_ADMIN_TYPES.has(extension.type)) {\n return emptyResult();\n }\n\n const resolved = resolveContentShells(tree, extension);\n if (resolved.status === \"unresolved\") {\n return emptyResult(resolved.reason);\n }\n\n const skippedRouteNames = [...resolved.skippedRouteNames];\n\n // Single resolved shell that already carries the token (or page-content):\n // do not invent a second inset. A token on a *nested* file is not enough —\n // that hid Device Administration's layout shell (GLU-1903). Multi-route\n // graphs skip this so a padded sibling leaf does not leave other leaves flush.\n if (resolved.shells.length === 1 && findUnresolvedSurface(tree, extension) === null) {\n return { filesChanged: [], changes: [], skippedRouteNames, unresolvedReason: null };\n }\n\n const shellsByFile = groupShellsByFile(resolved.shells);\n const filesChanged: Array<string> = [];\n const changes: Array<MigrationChangeReport> = [];\n\n for (const [filePath, shells] of shellsByFile) {\n const content = tree.read(filePath, \"utf-8\");\n if (content === null) {\n continue;\n }\n\n let program: TSESTree.Program;\n try {\n program = parseTsestreeSource(content);\n } catch {\n continue;\n }\n\n // Edit later ranges first so earlier offsets stay valid in one applyEdits pass.\n const orderedShells = [...shells].sort(\n (left, right) => right.location.reportNode.range[0] - left.location.reportNode.range[0]\n );\n\n const fileEdits: Array<ClassnameEdit> = [];\n const fileChanges: Array<MigrationChangeReport> = [];\n\n for (const shell of orderedShells) {\n const hostLocations = collectHostClassnameLocations(program, shell.location);\n const combinedBefore = hostLocations.map(hostLocation => hostLocation.value).join(\" \");\n const combinedPlan = planContentSpaceOnShell(combinedBefore);\n if (!combinedPlan.changed) {\n continue;\n }\n\n const alreadyHasContentSpace = splitClasses(combinedBefore).some(isContentSpaceToken);\n const primaryRange = shell.location.fixNode.range;\n const orderedLocations = [...hostLocations].sort((left, right) => {\n const leftIsPrimary = rangesEqual(left.fixNode.range, primaryRange);\n const rightIsPrimary = rangesEqual(right.fixNode.range, primaryRange);\n if (leftIsPrimary === rightIsPrimary) {\n return left.fixNode.range[0] - right.fixNode.range[0];\n }\n return leftIsPrimary ? -1 : 1;\n });\n\n let addedToken = alreadyHasContentSpace;\n const shellEdits: Array<ClassnameEdit> = [];\n for (const hostLocation of orderedLocations) {\n const locationEdits = buildEditsForLocation(\n hostLocation,\n value => {\n const next = transformClassnamePreservingWhitespace(value, { addContentSpace: !addedToken });\n if (!addedToken && splitClasses(next).some(isContentSpaceToken)) {\n addedToken = true;\n }\n return next;\n },\n content\n );\n shellEdits.push(...locationEdits);\n }\n\n if (shellEdits.length === 0) {\n continue;\n }\n\n fileEdits.push(...shellEdits);\n fileChanges.push({\n extensionId: extension.id,\n sourceRoot: extension.sourceRoot,\n filePath,\n kind: combinedPlan.removedTokens.length > 0 ? \"conversion\" : \"addition\",\n before: shell.classnameValue,\n after: planContentSpaceOnShell(shell.location.value).next,\n removedTokens: combinedPlan.removedTokens,\n });\n }\n\n if (fileEdits.length === 0) {\n continue;\n }\n\n tree.write(filePath, applyEdits(content, fileEdits));\n filesChanged.push(filePath);\n changes.push(...fileChanges.reverse());\n }\n\n if (filesChanged.length === 0) {\n return { filesChanged: [], changes: [], skippedRouteNames, unresolvedReason: null };\n }\n\n return { filesChanged, changes, skippedRouteNames, unresolvedReason: null };\n};\n\nconst groupShellsByFile = (shells: ReadonlyArray<ResolvedContentShell>): Map<string, Array<ResolvedContentShell>> => {\n const byFile = new Map<string, Array<ResolvedContentShell>>();\n for (const shell of shells) {\n const existing = byFile.get(shell.filePath);\n if (existing === undefined) {\n byFile.set(shell.filePath, [shell]);\n } else {\n existing.push(shell);\n }\n }\n return byFile;\n};\n\ntype ContentSpacePlan = {\n readonly next: string;\n readonly changed: boolean;\n readonly removedTokens: Array<string>;\n};\n\n/**\n * Strips custom shell-inset padding tokens and ensures `p-content-space` is\n * present, preserving the relative order of non-padding tokens.\n *\n * `changed` is true only when custom padding was stripped or `p-content-space`\n * was missing — not when the only difference would be whitespace normalization.\n */\nconst planContentSpaceOnShell = (classnameValue: string): ContentSpacePlan => {\n const classes = splitClasses(classnameValue);\n const removedTokens = classes.filter(isShellPaddingToken);\n const withoutCustomPadding = classes.filter(token => !isShellPaddingToken(token));\n const hadContentSpace = withoutCustomPadding.some(isContentSpaceToken);\n const nextClasses = hadContentSpace ? withoutCustomPadding : [...withoutCustomPadding, CONTENT_SPACE_TOKEN];\n return {\n next: nextClasses.join(\" \"),\n changed: removedTokens.length > 0 || !hadContentSpace,\n removedTokens,\n };\n};\n\nconst transformClassnamePreservingWhitespace = (value: string, options: { addContentSpace: boolean }): string => {\n const trimmedStart = value.length - value.trimStart().length;\n const trimmedEnd = value.length - value.trimEnd().length;\n const leading = value.slice(0, trimmedStart);\n const trailing = trimmedStart === value.length ? \"\" : value.slice(value.length - trimmedEnd);\n const classes = splitClasses(value);\n const kept = classes.filter(token => !isShellPaddingToken(token));\n const hasToken = kept.some(isContentSpaceToken);\n const nextClasses = options.addContentSpace && !hasToken ? [...kept, CONTENT_SPACE_TOKEN] : kept;\n const core = nextClasses.join(\" \");\n if (core === \"\") {\n return `${leading}${trailing}`;\n }\n return `${leading}${core}${trailing}`;\n};\n\nconst rangesEqual = (left: TSESTree.Range, right: TSESTree.Range): boolean =>\n left[0] === right[0] && left[1] === right[1];\n\n/**\n * All editable classname args bound to the same host as `primary` (every\n * string argument of a `cn()` / `cva()` call). Plain JSX literals stay a\n * single location. CVA variant objects are excluded so variant padding is\n * not stripped as if it were shell inset.\n */\nconst collectHostClassnameLocations = (\n program: TSESTree.Program,\n primary: ClassnameLocation\n): Array<ClassnameLocation> => {\n if (primary.context.type !== \"function-call\" && primary.context.type !== \"array-element\") {\n return [primary];\n }\n\n const callRange = findSmallestEnclosingCallRange(program, primary.reportNode);\n if (callRange === null) {\n return [primary];\n }\n\n const siblings = findClassnameLocations(program).filter(location => {\n if (location.reportNode.range[0] < callRange[0] || location.reportNode.range[1] > callRange[1]) {\n return false;\n }\n return location.context.type === \"function-call\" || location.context.type === \"array-element\";\n });\n\n return siblings.length > 0 ? siblings : [primary];\n};\n\nconst findSmallestEnclosingCallRange = (program: TSESTree.Program, inner: TSESTree.Node): TSESTree.Range | null => {\n let best: TSESTree.Range | null = null;\n simpleTraverse(program, {\n enter: node => {\n if (node.type !== AST_NODE_TYPES.CallExpression) return;\n if (inner.range[0] < node.range[0] || inner.range[1] > node.range[1]) return;\n if (best === null || node.range[1] - node.range[0] < best[1] - best[0]) {\n best = node.range;\n }\n },\n });\n return best;\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app/migrations/p-content-space-codemod/orchestrator.ts"],"names":[],"mappings":";;AAoDA,oDA4EC;AAhID,uCAA+C;AAC/C,8EAAyE;AACzE,iEAAoF;AACpF,yEAAoE;AACpE,iEAA4F;AAC5F,2DAK6B;AAC7B,iEAA4D;AAE5D,MAAM,cAAc,GAAG,yBAAyB,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,yBAAyB,GAAwB,IAAI,GAAG,CAAC,CAAC,iBAAiB,EAAE,yBAAyB,CAAC,CAAC,CAAC;AAE/G;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,oBAAoB,CAAC,IAAU;IAC7C,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAA,+CAAqB,EAAC,IAAI,CAAC,CAAC;IAE7D,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;IACvC,MAAM,OAAO,GAAiC,EAAE,CAAC;IACjD,MAAM,OAAO,GAAmC,EAAE,CAAC;IACnD,IAAI,eAAe,GAAG,KAAK,CAAC;IAE5B,KAAK,MAAM,SAAS,IAAI,QAAQ,EAAE,CAAC;QACjC,IAAI,6CAAsB,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/C,eAAe,GAAG,IAAI,CAAC;YAC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,KAAK,GAAG,CAAC;AACzJ,CAAC;AAED,kBAAe,oBAAoB,CAAC","sourcesContent":["import { logger, type Tree } from \"@nx/devkit\";\nimport { resolveExtensionTypes } from \"../utils/resolve-extension-types\";\nimport { ASSET_SITE_ADMIN_TYPES, inventContentSpace } from \"./invent-content-space\";\nimport { removeRedundantPadding } from \"./remove-redundant-padding\";\nimport { collectAsaEndOfRunMessages, formatUnresolvedReport } from \"./report-run-messaging\";\nimport {\n findUnresolvedSurface,\n PADDING_DOCS_LINK,\n type MigrationChangeReport,\n type UnresolvedSurfaceReport,\n} from \"./report-unresolved\";\nimport { rewritePageContent } from \"./rewrite-page-content\";\n\nconst MIGRATION_NAME = \"p-content-space-codemod\";\n\n/**\n * Extension types that get the swap-only `page-content` -> `overflow-auto\n * p-content-space` rewrite (GLU-1732). Unlike `ASSET_SITE_ADMIN_TYPES`, these\n * are always expected to already have a `page-content` region, so redundant-\n * padding removal, invent/convert, and unresolved-surface reporting don't apply\n * to this group — Fleet/Customer Home never received platform inset.\n */\nconst FLEET_CUSTOMER_HOME_TYPES: ReadonlySet<string> = new Set([\"FLEET_EXTENSION\", \"CUSTOMER_HOME_EXTENSION\"]);\n\n/**\n * Composes the extension-type resolver with the page-content rewrite,\n * redundant-padding removal, content-shell invent/convert, change reporting,\n * and unresolved-surface report for every resolved Asset Home/Site Home/Admin\n * extension in the workspace, and the swap-only page-content rewrite for every\n * resolved Fleet/Customer Home extension. Every other extension type is left\n * untouched.\n *\n * Ordering for Asset Home/Site Home/Admin:\n * 1. `rewritePageContent` — so a just-migrated region already carries\n * `p-content-space` before invent and padding cleanup look for it.\n * 2. `inventContentSpace` — invents or converts `p-content-space` on a\n * high-confidence content shell (ASA only); change reports distinguish\n * addition vs conversion.\n * 3. `removeRedundantPadding` — only strips `pb-*` from classname strings\n * that carry `p-content-space`, including tokens invent just added, so\n * unresolved extensions (no padded region) and local component spacing\n * are left alone by construction.\n * 4. `findUnresolvedSurface` — against post-rewrite/invent Tree state;\n * invented/converted surfaces must not be reported as unresolved.\n *\n * Formatting is intentionally the caller's job: `@trackunit/migrations`'\n * `run-migrations` generator already awaits `formatFiles(tree)` after every\n * migration. Invoking this orchestrator directly (e.g. against an `FsTree`\n * for an in-repo corpus run) must also call `formatFiles` before flushing,\n * otherwise Prettier/Tailwind class order will leave migrated files failing\n * the format gate.\n */\nexport function pContentSpaceCodemod(tree: Tree): void {\n const { resolved, unresolved } = resolveExtensionTypes(tree);\n\n const filesChanged = new Set<string>();\n const changes: Array<MigrationChangeReport> = [];\n const reports: Array<UnresolvedSurfaceReport> = [];\n let asaWorkOccurred = false;\n\n for (const extension of resolved) {\n if (ASSET_SITE_ADMIN_TYPES.has(extension.type)) {\n asaWorkOccurred = true;\n addAll(filesChanged, rewritePageContent(tree, extension).filesChanged);\n const inventResult = inventContentSpace(tree, extension);\n addAll(filesChanged, inventResult.filesChanged);\n changes.push(...inventResult.changes);\n // Runs after invent so a just-invented shell also loses redundant `pb-*`.\n // Removal is keyed on `p-content-space` being present in the same\n // classname string, so unresolved surfaces are a no-op.\n addAll(filesChanged, removeRedundantPadding(tree, extension).filesChanged);\n\n const entryComponentPath = `${extension.sourceRoot}/${extension.main ?? \"index.tsx\"}`;\n for (const skippedRouteName of inventResult.skippedRouteNames) {\n reports.push({\n extensionId: extension.id,\n sourceRoot: extension.sourceRoot,\n entryComponentPath: tree.exists(entryComponentPath) ? entryComponentPath : null,\n docsLink: PADDING_DOCS_LINK,\n skippedRouteName,\n skipReason: {\n code: \"router-no-analysable-leaves\",\n message: `route \"${skippedRouteName}\" could not be analysed into an inventable overflow content shell`,\n },\n });\n }\n\n const report = findUnresolvedSurface(tree, extension);\n if (report !== null) {\n reports.push({\n ...report,\n skipReason: inventResult.unresolvedReason ?? report.skipReason,\n });\n }\n continue;\n }\n\n if (FLEET_CUSTOMER_HOME_TYPES.has(extension.type)) {\n addAll(filesChanged, rewritePageContent(tree, extension).filesChanged);\n continue;\n }\n }\n\n const lossyConversionCount = changes.filter(isLossyConversion).length;\n logSummary(filesChanged.size, reports.length + lossyConversionCount);\n\n for (const change of changes) {\n const message = formatChangeReport(change);\n if (isLossyConversion(change)) {\n logger.warn(message);\n } else {\n logger.info(message);\n }\n }\n\n for (const report of reports) {\n logger.warn(formatUnresolvedReport(report));\n }\n\n for (const message of collectAsaEndOfRunMessages({ asaWorkOccurred, changes, unresolvedReports: reports })) {\n logger.info(message);\n }\n\n for (const item of unresolved) {\n logger.warn(\n ` ${MIGRATION_NAME}: could not resolve extension import \"${item.specifier}\" referenced by app \"${item.app}\"`\n );\n }\n}\n\nfunction addAll(target: Set<string>, items: ReadonlyArray<string>): void {\n for (const item of items) target.add(item);\n}\n\nconst isLossyConversion = (change: MigrationChangeReport): boolean =>\n change.kind === \"conversion\" && change.removedTokens.some(token => token.includes(\":\") || /-(?:0|0\\.5)$/.test(token));\n\n/** Mirrors the log style of `logSummary` in `libs/react/components/migrations/utils/jsx-utils.ts`. */\nfunction logSummary(touched: number, manualReviewNeeded: number): void {\n if (touched === 0) {\n logger.info(` ${MIGRATION_NAME}: no files changed`);\n return;\n }\n const reviewSuffix = manualReviewNeeded > 0 ? ` (${manualReviewNeeded} location(s) need manual review)` : \"\";\n logger.info(` ${MIGRATION_NAME}: updated ${touched} file(s)${reviewSuffix}`);\n}\n\n/**\n * Explicit addition/conversion log so a third-party reading the migration\n * output knows exactly what invent/convert did on each shell.\n */\nfunction formatChangeReport(change: MigrationChangeReport): string {\n if (change.kind === \"addition\") {\n return ` ${MIGRATION_NAME}: addition on \"${change.extensionId}\" (${change.filePath}): \"${change.before}\" → \"${change.after}\"`;\n }\n const removed = change.removedTokens.join(\", \");\n return ` ${MIGRATION_NAME}: conversion on \"${change.extensionId}\" (${change.filePath}): removed [${removed}]; \"${change.before}\" → \"${change.after}\"`;\n}\n\nexport default pContentSpaceCodemod;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-redundant-padding.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app/migrations/p-content-space-codemod/remove-redundant-padding.ts"],"names":[],"mappings":";;AAyBA,wDAiBC;AAzCD,wEAAiF;AACjF,0EAAoF;AAGpF,MAAM,sBAAsB,GAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,CAAC,CAAC;AAC9F,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAE9C;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,sBAAsB,CAAC,IAAU,EAAE,SAA4B;IAC7E,OAAO,IAAA,0DAAkC,EACvC,IAAI,EACJ,SAAS,CAAC,UAAU,EACpB,OAAO,CAAC,EAAE,CACR,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,IAAI,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EACxG,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,IAAA,kCAAY,EAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC;YACvD,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,KAAK,MAAM,KAAK,IAAI,sBAAsB,EAAE,CAAC;YAC3C,MAAM,GAAG,IAAA,uCAAiB,EAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["import type { Tree } from \"@nx/devkit\";\nimport { replaceClassToken, splitClasses } from \"@trackunit/css-classname-utils\";\nimport { transformClassnamesUnderSourceRoot } from \"../utils/classname-ast-rewrite\";\nimport type { ResolvedExtension } from \"../utils/resolve-extension-types\";\n\nconst REDUNDANT_INSET_TOKENS: Array<string> = [\"pb-8\", \"pb-6\", \"pb-4\", \"pb-responsive-space\"];\nconst PADDED_REGION_TOKEN = \"p-content-space\";\n\n/**\n * Removes the redundant bottom-inset Tailwind tokens (`pb-8`, `pb-6`, `pb-4`,\n * `pb-responsive-space`) from classname strings that already carry\n * `p-content-space` under a single resolved extension's `sourceRoot`.\n *\n * Scoped to the padded region on purpose: local `pb-*` used as component\n * spacing (cards, timeline entries, wizard steps) must not be stripped just\n * because they live under the same `sourceRoot`. Callers must run\n * `rewritePageContent` first so a just-migrated `page-content` region already\n * reads as `p-content-space` before this transform looks for it. Extensions\n * with no padded region (the ones `findUnresolvedSurface` will report) are\n * therefore a complete no-op here — there is no `p-content-space` token to\n * key off.\n *\n * Scoped to one extension per call — the caller (the orchestrator) loops\n * over every Asset Home/Site Home/Admin extension.\n */\nexport function removeRedundantPadding(tree: Tree, extension: ResolvedExtension): { filesChanged: Array<string> } {\n return transformClassnamesUnderSourceRoot(\n tree,\n extension.sourceRoot,\n content =>\n content.includes(PADDED_REGION_TOKEN) && REDUNDANT_INSET_TOKENS.some(token => content.includes(token)),\n value => {\n if (!splitClasses(value).includes(PADDED_REGION_TOKEN)) {\n return value;\n }\n let result = value;\n for (const token of REDUNDANT_INSET_TOKENS) {\n result = replaceClassToken(result, token, \"\");\n }\n return result;\n }\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"report-run-messaging.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app/migrations/p-content-space-codemod/report-run-messaging.ts"],"names":[],"mappings":";;;AAAA,wEAA8D;AAC9D,2DAAkH;AAElH,MAAM,cAAc,GAAG,yBAAyB,CAAC;AASjD;;;;;GAKG;AACI,MAAM,gCAAgC,GAAG,GAAW,EAAE,CAC3D,KAAK,cAAc,8GAA8G,CAAC;AADvH,QAAA,gCAAgC,oCACuF;AAEpI;;;;GAIG;AACI,MAAM,6BAA6B,GAAG,GAAW,EAAE,CACxD,KAAK,cAAc,qYAAqY,qCAAiB,EAAE,CAAC;AADja,QAAA,6BAA6B,iCACoY;AAE9a;;;GAGG;AACI,MAAM,sBAAsB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D,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAXW,QAAA,8BAA8B,kCAWzC;AAEF;;;;GAIG;AACI,MAAM,0BAA0B,GAAG,CAAC,OAA2B,EAAiB,EAAE;IACvF,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;QAC7B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,QAAQ,GAAG,IAAA,sCAA8B,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjE,IAAI,OAAO,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzC,QAAQ,CAAC,IAAI,CAAC,IAAA,qCAA6B,GAAE,CAAC,CAAC;IACjD,CAAC;IACD,QAAQ,CAAC,IAAI,CAAC,IAAA,wCAAgC,GAAE,CAAC,CAAC;IAClD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAXW,QAAA,0BAA0B,8BAWrC;AAEF,MAAM,sBAAsB,GAAG,CAAC,cAAsB,EAAW,EAAE;IACjE,OAAO,IAAA,kCAAY,EAAC,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9E,CAAC,CAAC","sourcesContent":["import { splitClasses } from \"@trackunit/css-classname-utils\";\nimport { PADDING_DOCS_LINK, type MigrationChangeReport, type UnresolvedSurfaceReport } from \"./report-unresolved\";\n\nconst MIGRATION_NAME = \"p-content-space-codemod\";\n\nexport type AsaEndOfRunContext = {\n /** True when any ASA extension was visited this migration run. */\n readonly asaWorkOccurred: boolean;\n readonly changes: ReadonlyArray<MigrationChangeReport>;\n readonly unresolvedReports: ReadonlyArray<UnresolvedSurfaceReport>;\n};\n\n/**\n * Developer-facing end-of-run reminder: verify appearance after migration, and\n * note that intentional edge-to-edge (no content inset) remains an allowed choice.\n * Emitted at most once per run when any ASA work happened — including runs that\n * only produced unresolved reports and no invent/convert edits.\n */\nexport const buildVerifyAndEdgeToEdgeReminder = (): string =>\n ` ${MIGRATION_NAME}: verify UI after migration; edge-to-edge content (no p-content-space) is an allowed choice when intentional`;\n\n/**\n * Explains what an inventable overflow content shell is when the migration\n * could not auto-pad one or more Asset/Site/Admin surfaces. Emitted once per\n * run that produced unresolved reports.\n */\nexport const buildUnresolvedInventGuidance = (): string =>\n ` ${MIGRATION_NAME}: could not auto-invent p-content-space on the surface(s) above — invent only targets a single inventable overflow content shell (a div/main/section with an editable className that itself owns overflow-auto/scroll, with no PageHeader/Topbar child). Card-only roots, multi-route graphs, and unclear shells need a manual p-content-space on that scroll owner (or accept edge-to-edge). See ${PADDING_DOCS_LINK}`;\n\n/**\n * Per-extension unresolved warning. Prefer this over a bare \"no token\" line so\n * developers learn *why* invent skipped them.\n */\nexport const formatUnresolvedReport = (report: UnresolvedSurfaceReport): string => {\n const reasonSuffix =\n report.skipReason === undefined ? \"\" : ` — reason [${report.skipReason.code}]: ${report.skipReason.message}`;\n\n if (report.skippedRouteName !== undefined) {\n return ` ${MIGRATION_NAME}: extension \"${report.extensionId}\" (${report.sourceRoot}) skipped route \"${report.skippedRouteName}\"${reasonSuffix || \" — no inventable overflow content shell on that route\"}; see ${report.docsLink}`;\n }\n\n if (report.skipReason !== undefined) {\n return ` ${MIGRATION_NAME}: extension \"${report.extensionId}\" (${report.sourceRoot}) not auto-invented${reasonSuffix}; add p-content-space manually on the scroll owner or accept edge-to-edge — see ${report.docsLink}`;\n }\n\n return ` ${MIGRATION_NAME}: extension \"${report.extensionId}\" (${report.sourceRoot}) has no page-content/p-content-space and no inventable overflow content shell (needs a scrolling div/main/section with editable className, not e.g. a bare Card) — add p-content-space manually or accept edge-to-edge; see ${report.docsLink}`;\n};\n\n/**\n * Advisory-only scrollbar notes for invent/convert onto a self-scrolling\n * (`overflow-*`) shell. Cannot measure real DOM scrollbars in the codemod —\n * documents the preferred flush-scrollbar outcome after content owns padding.\n */\nexport const buildScrollbarAdvisoryMessages = (changes: ReadonlyArray<MigrationChangeReport>): Array<string> => {\n const messages: Array<string> = [];\n for (const change of changes) {\n if (!shellHasOverflowScroll(change.before) && !shellHasOverflowScroll(change.after)) {\n continue;\n }\n messages.push(\n ` ${MIGRATION_NAME}: scrollbar note on \"${change.extensionId}\" (${change.filePath}): shell uses overflow scrolling — prefer a flush scrollbar at the panel edge after content owns padding`\n );\n }\n return messages;\n};\n\n/**\n * Collects end-of-run ASA developer messages (scrollbar advisories, unresolved\n * invent guidance when needed, + single verify/edge-to-edge reminder). Empty\n * when no ASA work occurred this run.\n */\nexport const collectAsaEndOfRunMessages = (context: AsaEndOfRunContext): Array<string> => {\n if (!context.asaWorkOccurred) {\n return [];\n }\n\n const messages = buildScrollbarAdvisoryMessages(context.changes);\n if (context.unresolvedReports.length > 0) {\n messages.push(buildUnresolvedInventGuidance());\n }\n messages.push(buildVerifyAndEdgeToEdgeReminder());\n return messages;\n};\n\nconst shellHasOverflowScroll = (classnameValue: string): boolean => {\n return splitClasses(classnameValue).some(cls => /(^|:)overflow-/.test(cls));\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"report-unresolved.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app/migrations/p-content-space-codemod/report-unresolved.ts"],"names":[],"mappings":";;;AAyGA,sDAqBC;AA7HD,wEAA8D;AAC9D,0EAAmH;AAEnH,mEAA+D;AAE/D,MAAM,kBAAkB,GAAG,cAAc,CAAC;AAC1C,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAC9C,MAAM,eAAe,GAAkB,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,CAAC;AAEjF,MAAM,SAAS,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,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,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QACnC,MAAM,0BAA0B,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAC/D,IAAA,kCAAY,EAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CACjE,CAAC;QACF,IAAI,0BAA0B,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;SAAM,IAAI,0BAA0B,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC;QACvD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,kBAAkB,GAAG,GAAG,SAAS,CAAC,UAAU,IAAI,SAAS,CAAC,IAAI,IAAI,4BAA4B,EAAE,CAAC;IAEvG,OAAO;QACL,WAAW,EAAE,SAAS,CAAC,EAAE;QACzB,UAAU,EAAE,SAAS,CAAC,UAAU;QAChC,kBAAkB,EAAE,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI;QAC/E,QAAQ,EAAE,yBAAiB;KAC5B,CAAC;AACJ,CAAC","sourcesContent":["import type { Tree } from \"@nx/devkit\";\nimport { splitClasses } from \"@trackunit/css-classname-utils\";\nimport { findClassnameLocations, parseTsestreeSource, visitRewritableFiles } from \"../utils/classname-ast-rewrite\";\nimport type { ResolvedExtension } from \"../utils/resolve-extension-types\";\nimport { resolveContentShells } from \"./resolve-content-shell\";\n\nconst PAGE_CONTENT_TOKEN = \"page-content\";\nconst CONTENT_SPACE_TOKEN = \"p-content-space\";\nconst RESOLVED_TOKENS: Array<string> = [PAGE_CONTENT_TOKEN, CONTENT_SPACE_TOKEN];\n\nconst tokenBase = (token: string): string => (token.includes(\":\") ? token.slice(token.lastIndexOf(\":\") + 1) : token);\n\nconst isResolvedToken = (token: string): boolean => RESOLVED_TOKENS.includes(tokenBase(token));\n\nconst DEFAULT_ENTRY_COMPONENT_FILE = \"index.tsx\";\n\n/** In-repo docs for inventable overflow content shells (GLU-1571 / p-content-space migration). */\nexport const PADDING_DOCS_LINK = \"docs/tech/TAILWIND-ARCHITECTURE.md#p-content-space-inventable-shell\";\n\nexport type MigrationChangeKind = \"addition\" | \"conversion\";\n\n/**\n * Structured invent/convert outcome for a single content-shell edit. Emitted\n * so the orchestrator can log exactly what changed (added vs converted).\n */\nexport type MigrationChangeReport = {\n extensionId: string;\n sourceRoot: string;\n filePath: string;\n kind: MigrationChangeKind;\n /** Classname string on the shell before invent/convert. */\n before: string;\n /** Classname string on the shell after invent/convert. */\n after: string;\n /** Custom shell padding tokens removed (empty for pure additions). */\n removedTokens: Array<string>;\n};\n\nimport type { ShellSkipReason } from \"./shell-skip-reason\";\n\nexport type UnresolvedSurfaceReport = {\n extensionId: string;\n sourceRoot: string;\n /** Best-effort resolved path to the extension's entry component; `null` when it can't be found in the Tree. */\n entryComponentPath: string | null;\n docsLink: string;\n /** Route component or imported route binding that could not be analysed on a partial graph. */\n skippedRouteName?: string;\n /** Why invent/resolve declined this surface (when known). */\n skipReason?: ShellSkipReason;\n};\n\n/**\n * Read-only check for whether a single file already contains `page-content`\n * or `p-content-space` as a whole classname token (not matching inside e.g.\n * `page-content-with-gap`). Used as a suppressor on unresolvable graphs so\n * resolver limits do not permanently light up already-migrated extensions.\n */\nfunction fileHasResolvedToken(content: string): boolean {\n if (!RESOLVED_TOKENS.some(token => content.includes(token))) return false;\n\n const program = parseTsestreeSource(content);\n const locations = findClassnameLocations(program);\n return locations.some(location => splitClasses(location.value).some(isResolvedToken));\n}\n\nfunction sourceRootHasResolvedToken(tree: Tree, extension: ResolvedExtension): boolean {\n let found = false;\n visitRewritableFiles(tree, extension.sourceRoot, (_filePath, content) => {\n if (found) return;\n if (fileHasResolvedToken(content)) {\n found = true;\n }\n });\n return found;\n}\n\n/**\n * Determines whether the inventable content shell of an Asset Home/Site Home/Admin\n * extension still lacks `page-content` / `p-content-space`, and if so, builds a\n * report entry describing it.\n *\n * A token on a nested file is not enough when the graph *resolves*: Device\n * Administration hid behind `p-content-space` on a job-details leaf while the\n * layout shell still used `pb-responsive-space` (GLU-1903). Returns `null` only\n * when every *resolved content shell* already carries a resolved token (or still\n * uses `page-content`, which `rewritePageContent` handles separately so it must\n * not be double-reported).\n *\n * An unresolvable graph is *not* treated as a leftover if any rewritable file\n * already has a resolved token — otherwise Device Administration (and ~24 other\n * ASA extensions the walker cannot follow) stay permanently-on after padding.\n * Unresolvable graphs with no token anywhere still report.\n *\n * This function is read-only: it never calls `tree.write`. Callers must run it\n * against Tree state that already reflects `rewritePageContent`'s and\n * `removeRedundantPadding`'s edits for the same extension, since those two\n * transforms mutate `page-content` into `p-content-space` in place — running\n * this check first, against pre-rewrite content, would misreport a\n * just-fixed extension as unresolved.\n *\n * A `sourceRoot` that doesn't exist in the Tree at all (or contains no\n * rewritable files) is treated the same as \"no page-content and no\n * p-content-space found\": it gets reported, not silently skipped.\n */\nexport function findUnresolvedSurface(tree: Tree, extension: ResolvedExtension): UnresolvedSurfaceReport | null {\n const resolved = resolveContentShells(tree, extension);\n if (resolved.status === \"resolved\") {\n const everyShellHasResolvedToken = resolved.shells.every(shell =>\n splitClasses(shell.combinedClassnameValue).some(isResolvedToken)\n );\n if (everyShellHasResolvedToken) {\n return null;\n }\n } else if (sourceRootHasResolvedToken(tree, extension)) {\n return null;\n }\n\n const entryComponentPath = `${extension.sourceRoot}/${extension.main ?? DEFAULT_ENTRY_COMPONENT_FILE}`;\n\n return {\n extensionId: extension.id,\n sourceRoot: extension.sourceRoot,\n entryComponentPath: tree.exists(entryComponentPath) ? entryComponentPath : null,\n docsLink: PADDING_DOCS_LINK,\n };\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-content-shell.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app/migrations/p-content-space-codemod/resolve-content-shell.ts"],"names":[],"mappings":";;;;AACA,wEAA0G;AA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AAuB;IACvB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,MAAyC,EAAE,IAAY,EAAW,EAAE;IACzF,OAAO,MAAM,CAAC,IAAI,KAAK,sBAAc,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC;AAC3E,CAAC,CAAC","sourcesContent":["import type { Tree } from \"@nx/devkit\";\nimport { isTailwindFunction, splitClasses, type ClassnameLocation } from \"@trackunit/css-classname-utils\";\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/types\";\nimport { simpleTraverse } from \"@typescript-eslint/typescript-estree\";\nimport path from \"path\";\nimport { findClassnameLocations, parseTsestreeSource } from \"../utils/classname-ast-rewrite\";\nimport type { ResolvedExtension } from \"../utils/resolve-extension-types\";\nimport { shellSkipReason, type ShellSkipReason, type ShellSkipReasonCode } from \"./shell-skip-reason\";\n\n/**\n * A high-confidence content-region classname host discovered under an\n * extension entry (literal / cva / cn on a div-like shell).\n */\nexport type ResolvedContentShell = {\n readonly filePath: string;\n /** Current classname string at the editable host. */\n readonly classnameValue: string;\n /**\n * Every classname bound to the same host, joined. A cva/cn call can split\n * tokens across arguments (`cva({ base: [\"p-content-space\", \"overflow-auto\"] })`);\n * leftover reporting must look at this combined value, not `classnameValue`\n * alone, or it disagrees with invent.\n */\n readonly combinedClassnameValue: string;\n /** AST classname location invent uses to splice the edit. */\n readonly location: ClassnameLocation;\n};\n\nexport type ResolveContentShellResult =\n | { readonly status: \"resolved\"; readonly shell: ResolvedContentShell }\n | { readonly status: \"unresolved\"; readonly reason: ShellSkipReason };\n\n/**\n * Plural discovery result. Multi-route ASA apps may yield 0..N shells:\n * - shared layout content `div` wrapping `<Outlet />` → that layout's shell\n * - no shared layout → one shell per clear route leaf (static imports only)\n * - layout-wins is scoped to that layout's descendant leaves only\n * - unclear / unanalysable routes are named in `skippedRouteNames` when any\n * sibling still resolved (a partial graph must not look fully migrated)\n * - unclear graphs with no resolvable shells → unresolved (never guess a first-div)\n */\nexport type ResolveContentShellsResult =\n | {\n readonly status: \"resolved\";\n readonly shells: ReadonlyArray<ResolvedContentShell>;\n readonly skippedRouteNames: ReadonlyArray<string>;\n }\n | { readonly status: \"unresolved\"; readonly reason: ShellSkipReason };\n\nconst DEFAULT_ENTRY_COMPONENT_FILE = \"index.tsx\";\n\nconst unresolvedShell = (code: ShellSkipReasonCode, detail?: string): ResolveContentShellResult => ({\n status: \"unresolved\",\n reason: shellSkipReason(code, detail),\n});\n\nconst unresolvedShells = (code: ShellSkipReasonCode, detail?: string): ResolveContentShellsResult => ({\n status: \"unresolved\",\n reason: shellSkipReason(code, detail),\n});\n\n/** Intrinsic hosts treated as content-region shells for this walking skeleton. */\nconst DIV_LIKE_ELEMENTS: ReadonlySet<string> = new Set([\"div\", \"main\", \"section\"]);\n\n/**\n * Known non-DOM wrappers to skip when walking from an extension entry toward\n * the content shell (providers, Suspense, fragments).\n * `RouterProvider` is intentionally NOT a wrapper — it branches into light-touch\n * multi-route discovery instead of being skipped.\n */\nconst isKnownWrapperName = (name: string): boolean => {\n if (\n name === \"Suspense\" ||\n name === \"Fragment\" ||\n name === \"TrackunitInternalProviders\" ||\n name === \"TrackunitProviders\"\n ) {\n return true;\n }\n return name.endsWith(\"Provider\") && name !== \"RouterProvider\";\n};\n\n/**\n * Walks from `extension.main` through known non-DOM wrappers and static\n * imports to identify editable content-region classname host(s).\n *\n * Multi-route policy (light-touch, static imports only):\n * 1. Shared layout shell (div-like host wrapping `<Outlet />`) wins → one target.\n * 2. Else each resolvable route leaf with a clear shell is targeted.\n * 3. Exotic / unclear graphs → `{ status: \"unresolved\" }` (never throws; no first-div guess).\n */\nexport const resolveContentShells = (tree: Tree, extension: ResolvedExtension): ResolveContentShellsResult => {\n const entryPath = `${extension.sourceRoot}/${extension.main ?? DEFAULT_ENTRY_COMPONENT_FILE}`;\n if (!tree.exists(entryPath)) {\n return unresolvedShells(\"entry-missing\", entryPath);\n }\n\n return resolveShellsFromFile(tree, entryPath, extension.sourceRoot, new Set());\n};\n\n/**\n * Single-shell convenience wrapper over {@link resolveContentShells}.\n * Returns the first resolved shell when discovery finds one or more; unresolved\n * when none. Prefer {@link resolveContentShells} for RouterProvider / multi-route\n * graphs — an arbitrary one of N leaves is not a useful production answer.\n */\nexport const resolveContentShell = (tree: Tree, extension: ResolvedExtension): ResolveContentShellResult => {\n const result = resolveContentShells(tree, extension);\n if (result.status === \"unresolved\") {\n return { status: \"unresolved\", reason: result.reason };\n }\n const shell = result.shells[0];\n if (shell === undefined) {\n return unresolvedShell(\"unclear-graph\", \"resolved status with empty shells list\");\n }\n return { status: \"resolved\", shell };\n};\n\nconst resolveShellsFromFile = (\n tree: Tree,\n filePath: string,\n sourceRoot: string,\n visited: Set<string>\n): ResolveContentShellsResult => {\n if (visited.has(filePath)) {\n return unresolvedShells(\"cycle\", filePath);\n }\n visited.add(filePath);\n\n const content = tree.read(filePath, \"utf-8\");\n if (content === null) {\n return unresolvedShells(\"entry-missing\", filePath);\n }\n\n let program: TSESTree.Program;\n try {\n program = parseTsestreeSource(content);\n } catch {\n return unresolvedShells(\"parse-failed\", filePath);\n }\n\n const rootJsx = findRootJsxElement(program);\n if (rootJsx === null) {\n return unresolvedShells(\"no-root-jsx\", filePath);\n }\n\n const leaf = unwrapWrappers(rootJsx);\n if (leaf === null) {\n return unresolvedShells(\"empty-wrapper\", filePath);\n }\n\n if (isDivLikeHost(leaf) && leaf.type === AST_NODE_TYPES.JSXElement) {\n const single = pickContentShellInFile(filePath, program, leaf);\n if (single.status === \"unresolved\") {\n return { status: \"unresolved\", reason: single.reason };\n }\n return { status: \"resolved\", shells: [single.shell], skippedRouteNames: [] };\n }\n\n const componentName = getJsxComponentName(leaf);\n if (componentName === null) {\n return unresolvedShells(\"non-host-element\", filePath);\n }\n\n if (componentName === \"RouterProvider\" && leaf.type === AST_NODE_TYPES.JSXElement) {\n return resolveFromRouterProvider(tree, filePath, program, leaf, sourceRoot, visited);\n }\n\n if (isDynamicComponent(program, componentName)) {\n return unresolvedShells(\"dynamic-component\", componentName);\n }\n\n const importPath = resolveStaticLocalImport(tree, program, filePath, sourceRoot, componentName);\n if (importPath === null) {\n return unresolvedShells(\"unresolvable-import\", componentName);\n }\n\n return resolveShellsFromFile(tree, importPath, sourceRoot, visited);\n};\n\n/**\n * Light-touch RouterProvider follow: read `router={name}`, resolve the router\n * module (import or same-file), collect Identifier `component:` targets from\n * `createRootRoute` / `createRoute` / `createRootRouteWithContext`. Skip arrow\n * wrappers and exotic graphs rather than guessing.\n */\nconst resolveFromRouterProvider = (\n tree: Tree,\n filePath: string,\n program: TSESTree.Program,\n routerProvider: TSESTree.JSXElement,\n sourceRoot: string,\n visited: Set<string>\n): ResolveContentShellsResult => {\n const routerName = getRouterPropIdentifier(routerProvider);\n if (routerName === null) {\n return unresolvedShells(\"router-prop-unresolved\");\n }\n\n const routerModulePath = resolveStaticLocalImport(tree, program, filePath, sourceRoot, routerName);\n if (routerModulePath !== null) {\n return collectShellsFromRouterModule(tree, routerModulePath, sourceRoot, visited);\n }\n\n // Same-file router (route factories live alongside RouterProvider).\n return collectShellsFromRouterProgram(tree, filePath, program, sourceRoot, visited);\n};\n\nconst collectShellsFromRouterModule = (\n tree: Tree,\n routerModulePath: string,\n sourceRoot: string,\n visited: Set<string>\n): ResolveContentShellsResult => {\n if (visited.has(routerModulePath)) {\n return unresolvedShells(\"cycle\", routerModulePath);\n }\n visited.add(routerModulePath);\n\n const content = tree.read(routerModulePath, \"utf-8\");\n if (content === null) {\n return unresolvedShells(\"entry-missing\", routerModulePath);\n }\n\n let program: TSESTree.Program;\n try {\n program = parseTsestreeSource(content);\n } catch {\n return unresolvedShells(\"parse-failed\", routerModulePath);\n }\n\n return collectShellsFromRouterProgram(tree, routerModulePath, program, sourceRoot, visited);\n};\n\ntype RouterRoute = {\n readonly variableName: string | null;\n readonly componentName: string | null;\n readonly parentVariableName: string | null;\n};\n\ntype AnalyzedRoute = RouterRoute & {\n readonly analysis: RouteComponentAnalysis | null;\n};\n\nconst collectShellsFromRouterProgram = (\n tree: Tree,\n routerFilePath: string,\n program: TSESTree.Program,\n sourceRoot: string,\n visited: Set<string>\n): ResolveContentShellsResult => {\n const routes = collectRouterRoutes(program);\n if (routes.length === 0) {\n return unresolvedShells(\"router-no-analysable-leaves\", \"no createRoute/createRootRoute factories found\");\n }\n\n if (routes.every(route => route.componentName === null)) {\n return unresolvedShells(\"router-inline-arrow-components\", routerFilePath);\n }\n\n const definedVariableNames = new Set(\n routes.flatMap(route => (route.variableName === null ? [] : [route.variableName]))\n );\n const skippedRouteNames: Array<string> = collectAddChildrenIdentifiers(program).filter(\n name => !definedVariableNames.has(name)\n );\n\n const analyzed: Array<AnalyzedRoute> = [];\n for (const route of routes) {\n if (route.componentName === null) {\n analyzed.push({ ...route, analysis: null });\n continue;\n }\n\n const componentFile = resolveComponentModulePath(tree, program, routerFilePath, sourceRoot, route.componentName);\n if (componentFile === null) {\n skippedRouteNames.push(route.componentName);\n analyzed.push({ ...route, analysis: null });\n continue;\n }\n\n const analysis = analyzeRouteComponent(tree, componentFile, route.componentName, sourceRoot, new Set(visited));\n if (analysis === null) {\n skippedRouteNames.push(route.componentName);\n analyzed.push({ ...route, analysis: null });\n continue;\n }\n\n analyzed.push({ ...route, analysis });\n }\n\n const shells = selectShellsForInvent(analyzed);\n if (shells.length === 0) {\n const skipped = uniqueNames(skippedRouteNames);\n return unresolvedShells(\n \"router-no-analysable-leaves\",\n skipped.length > 0 ? `skipped: ${skipped.join(\", \")}` : routerFilePath\n );\n }\n return {\n status: \"resolved\",\n shells: dedupeShells(shells),\n skippedRouteNames: uniqueNames(skippedRouteNames),\n };\n};\n\ntype RouteComponentAnalysis =\n | { readonly kind: \"layout-shell\"; readonly shell: ResolvedContentShell }\n | { readonly kind: \"leaf-shell\"; readonly shell: ResolvedContentShell };\n\nconst analyzeRouteComponent = (\n tree: Tree,\n filePath: string,\n componentName: string,\n sourceRoot: string,\n visited: Set<string>\n): RouteComponentAnalysis | null => {\n if (visited.has(`${filePath}#${componentName}`)) {\n return null;\n }\n visited.add(`${filePath}#${componentName}`);\n\n const content = tree.read(filePath, \"utf-8\");\n if (content === null) {\n return null;\n }\n\n let program: TSESTree.Program;\n try {\n program = parseTsestreeSource(content);\n } catch {\n return null;\n }\n\n const rootJsx = findJsxReturnedByName(program, componentName);\n if (rootJsx === null) {\n return null;\n }\n\n const leaf = unwrapWrappers(rootJsx);\n if (leaf === null) {\n return null;\n }\n\n if (isDivLikeHost(leaf) && leaf.type === AST_NODE_TYPES.JSXElement) {\n const shellResult = pickContentShellInFile(filePath, program, leaf);\n if (shellResult.status === \"unresolved\") {\n return null;\n }\n const wrapsOutlet =\n elementContainsOutlet(leaf) || hostWrapsOutletOneHop(tree, filePath, program, leaf, sourceRoot, visited);\n return { kind: wrapsOutlet ? \"layout-shell\" : \"leaf-shell\", shell: shellResult.shell };\n }\n\n const childName = getJsxComponentName(leaf);\n if (childName === null || childName === \"Outlet\") {\n return null;\n }\n if (isDynamicComponent(program, childName)) {\n return null;\n }\n\n const importPath = resolveStaticLocalImport(tree, program, filePath, sourceRoot, childName);\n if (importPath === null) {\n return null;\n }\n\n // Preserve nested kind: a one-hop wrapper around an Outlet layout\n // (`Root` → `Shell` with Outlet) must stay `layout-shell` so shared layout\n // wins over clear leaves. Forcing `leaf-shell` here double-invents.\n return analyzeRouteComponent(tree, importPath, childName, sourceRoot, visited);\n};\n\nconst getRouterPropIdentifier = (element: TSESTree.JSXElement): string | null => {\n for (const attribute of element.openingElement.attributes) {\n if (attribute.type !== AST_NODE_TYPES.JSXAttribute) continue;\n if (attribute.name.type !== AST_NODE_TYPES.JSXIdentifier || attribute.name.name !== \"router\") continue;\n if (attribute.value?.type !== AST_NODE_TYPES.JSXExpressionContainer) continue;\n if (attribute.value.expression.type === AST_NODE_TYPES.Identifier) {\n return attribute.value.expression.name;\n }\n }\n return null;\n};\n\nconst getVariableDeclaratorInit = (declarator: TSESTree.VariableDeclarator): TSESTree.Expression | null => {\n if (!(\"init\" in declarator)) {\n return null;\n }\n return declarator.init ?? null;\n};\n\n/**\n * Collects TanStack route factory bindings (`createRootRoute` / `createRoute` /\n * `createRootRouteWithContext`) with parent links from `getParentRoute`.\n * Arrow `component` wrappers have `componentName: null` (not guessed).\n */\nconst collectRouterRoutes = (program: TSESTree.Program): Array<RouterRoute> => {\n const coveredRanges = new Set<string>();\n const routes: Array<RouterRoute> = [];\n\n simpleTraverse(program, {\n enter: node => {\n if (node.type !== AST_NODE_TYPES.VariableDeclarator) return;\n if (node.id.type !== AST_NODE_TYPES.Identifier) return;\n const init = getVariableDeclaratorInit(node);\n if (init === null || init.type !== AST_NODE_TYPES.CallExpression) return;\n if (!isRouteFactoryCall(init)) return;\n const options = init.arguments[0];\n if (options?.type !== AST_NODE_TYPES.ObjectExpression) return;\n coveredRanges.add(`${init.range[0]}:${init.range[1]}`);\n routes.push({\n variableName: node.id.name,\n componentName: getComponentIdentifierFromOptions(options),\n parentVariableName: getParentRouteIdentifier(options),\n });\n },\n });\n\n simpleTraverse(program, {\n enter: node => {\n if (node.type !== AST_NODE_TYPES.CallExpression) return;\n if (!isRouteFactoryCall(node)) return;\n if (coveredRanges.has(`${node.range[0]}:${node.range[1]}`)) return;\n const options = node.arguments[0];\n if (options?.type !== AST_NODE_TYPES.ObjectExpression) return;\n routes.push({\n variableName: null,\n componentName: getComponentIdentifierFromOptions(options),\n parentVariableName: getParentRouteIdentifier(options),\n });\n },\n });\n\n return routes;\n};\n\nconst getParentRouteIdentifier = (options: TSESTree.ObjectExpression): string | null => {\n for (const property of options.properties) {\n if (property.type !== AST_NODE_TYPES.Property) continue;\n if (property.key.type !== AST_NODE_TYPES.Identifier || property.key.name !== \"getParentRoute\") continue;\n if (\n property.value.type !== AST_NODE_TYPES.ArrowFunctionExpression &&\n property.value.type !== AST_NODE_TYPES.FunctionExpression\n ) {\n continue;\n }\n if (property.value.body.type === AST_NODE_TYPES.Identifier) {\n return property.value.body.name;\n }\n if (property.value.body.type === AST_NODE_TYPES.BlockStatement) {\n for (const statement of property.value.body.body) {\n if (statement.type !== AST_NODE_TYPES.ReturnStatement || statement.argument === null) continue;\n const arg = unwrapParentheses(statement.argument);\n if (arg.type === AST_NODE_TYPES.Identifier) {\n return arg.name;\n }\n }\n }\n }\n return null;\n};\n\nconst collectAddChildrenIdentifiers = (program: TSESTree.Program): Array<string> => {\n const names: Array<string> = [];\n simpleTraverse(program, {\n enter: node => {\n if (node.type !== AST_NODE_TYPES.CallExpression) return;\n if (node.callee.type !== AST_NODE_TYPES.MemberExpression || node.callee.computed) return;\n if (node.callee.property.type !== AST_NODE_TYPES.Identifier) return;\n if (node.callee.property.name !== \"addChildren\") return;\n const arg = node.arguments[0];\n if (arg?.type !== AST_NODE_TYPES.ArrayExpression) return;\n for (const element of arg.elements) {\n if (element?.type === AST_NODE_TYPES.Identifier) {\n names.push(element.name);\n }\n }\n },\n });\n return names;\n};\n\nconst CONTENT_SPACE_TOKEN = \"p-content-space\";\n\nconst shellHasContentSpace = (shell: ResolvedContentShell): boolean =>\n splitClasses(shell.classnameValue).includes(CONTENT_SPACE_TOKEN);\n\n/**\n * Layout-wins is per route subtree: a layout covers only descendant leaves.\n * Already-migrated descendant leaves must not get a second inset on the layout.\n */\nconst selectShellsForInvent = (routes: ReadonlyArray<AnalyzedRoute>): Array<ResolvedContentShell> => {\n const byVariable = new Map<string, AnalyzedRoute>();\n for (const route of routes) {\n if (route.variableName !== null) {\n byVariable.set(route.variableName, route);\n }\n }\n\n const layouts = routes.filter(route => route.analysis?.kind === \"layout-shell\");\n const leaves = routes.filter(route => route.analysis?.kind === \"leaf-shell\");\n const coveredLeaves = new Set<AnalyzedRoute>();\n const selected: Array<ResolvedContentShell> = [];\n\n for (const layout of layouts) {\n if (layout.analysis?.kind !== \"layout-shell\") continue;\n const descendants = leaves.filter(leaf => isDescendantOf(leaf, layout, byVariable));\n const descendantsAlreadyMigrated = descendants.some(\n leaf => leaf.analysis !== null && shellHasContentSpace(leaf.analysis.shell)\n );\n if (descendantsAlreadyMigrated) {\n continue;\n }\n selected.push(layout.analysis.shell);\n for (const descendant of descendants) {\n coveredLeaves.add(descendant);\n }\n }\n\n for (const leaf of leaves) {\n if (coveredLeaves.has(leaf) || leaf.analysis?.kind !== \"leaf-shell\") continue;\n selected.push(leaf.analysis.shell);\n }\n\n return selected;\n};\n\nconst isDescendantOf = (\n leaf: AnalyzedRoute,\n layout: AnalyzedRoute,\n byVariable: Map<string, AnalyzedRoute>\n): boolean => {\n if (layout.variableName === null) return false;\n let current = leaf.parentVariableName;\n const seen = new Set<string>();\n while (current !== null && !seen.has(current)) {\n if (current === layout.variableName) return true;\n seen.add(current);\n current = byVariable.get(current)?.parentVariableName ?? null;\n }\n return false;\n};\n\nconst uniqueNames = (names: ReadonlyArray<string>): Array<string> => {\n const seen = new Set<string>();\n const result: Array<string> = [];\n for (const name of names) {\n if (seen.has(name)) continue;\n seen.add(name);\n result.push(name);\n }\n return result;\n};\n\nconst isRouteFactoryCall = (node: TSESTree.CallExpression): boolean => {\n const directName = getCalleeIdentifierName(node.callee);\n if (directName === \"createRootRoute\" || directName === \"createRoute\") {\n return true;\n }\n // createRootRouteWithContext<T>()({ ... })\n if (node.callee.type === AST_NODE_TYPES.CallExpression) {\n const innerName = getCalleeIdentifierName(node.callee.callee);\n return innerName === \"createRootRouteWithContext\";\n }\n return false;\n};\n\nconst getCalleeIdentifierName = (\n callee: TSESTree.Expression | TSESTree.Super | TSESTree.PrivateIdentifier\n): string | null => {\n if (callee.type === AST_NODE_TYPES.Identifier) {\n return callee.name;\n }\n if (callee.type === AST_NODE_TYPES.TSInstantiationExpression) {\n return getCalleeIdentifierName(callee.expression);\n }\n return null;\n};\n\nconst getComponentIdentifierFromOptions = (options: TSESTree.ObjectExpression): string | null => {\n for (const property of options.properties) {\n if (property.type !== AST_NODE_TYPES.Property) continue;\n if (property.key.type !== AST_NODE_TYPES.Identifier || property.key.name !== \"component\") continue;\n if (property.value.type === AST_NODE_TYPES.Identifier) {\n return property.value.name;\n }\n }\n return null;\n};\n\nconst resolveComponentModulePath = (\n tree: Tree,\n program: TSESTree.Program,\n fromFilePath: string,\n sourceRoot: string,\n componentName: string\n): string | null => {\n const imported = resolveStaticLocalImport(tree, program, fromFilePath, sourceRoot, componentName);\n if (imported !== null) {\n return imported;\n }\n if (findJsxReturnedByName(program, componentName) !== null) {\n return fromFilePath;\n }\n return null;\n};\n\nconst elementContainsOutlet = (element: TSESTree.JSXElement | TSESTree.JSXFragment): boolean => {\n let found = false;\n simpleTraverse(element, {\n enter: node => {\n if (found) return;\n if (node.type !== AST_NODE_TYPES.JSXOpeningElement) return;\n const name = getJsxOpeningName(node.name);\n if (name === \"Outlet\") {\n found = true;\n }\n },\n });\n return found;\n};\n\n/**\n * True when a div-like shell's `<Outlet />` lives one custom-component hop\n * below (`<div><Main /></div>` where `Main` returns `<Outlet />`). Without this,\n * the ancestor is padded as a leaf alongside real route leaves.\n */\nconst hostWrapsOutletOneHop = (\n tree: Tree,\n filePath: string,\n program: TSESTree.Program,\n host: TSESTree.JSXElement,\n sourceRoot: string,\n visited: Set<string>\n): boolean => {\n for (const childName of collectCustomChildComponentNames(host)) {\n if (childName === \"Outlet\") {\n return true;\n }\n if (componentReturnsOutletOneHop(tree, filePath, program, childName, sourceRoot, visited)) {\n return true;\n }\n }\n return false;\n};\n\nconst collectCustomChildComponentNames = (host: TSESTree.JSXElement): Array<string> => {\n const names: Array<string> = [];\n for (const child of host.children) {\n if (child.type !== AST_NODE_TYPES.JSXElement) continue;\n const name = getJsxComponentName(child);\n if (name !== null) {\n names.push(name);\n }\n }\n return names;\n};\n\nconst componentReturnsOutletOneHop = (\n tree: Tree,\n fromFilePath: string,\n fromProgram: TSESTree.Program,\n componentName: string,\n sourceRoot: string,\n visited: Set<string>\n): boolean => {\n const visitKey = `${fromFilePath}#outlet-hop#${componentName}`;\n if (visited.has(visitKey)) {\n return false;\n }\n visited.add(visitKey);\n\n let program = fromProgram;\n if (findJsxReturnedByName(fromProgram, componentName) === null) {\n const importPath = resolveStaticLocalImport(tree, fromProgram, fromFilePath, sourceRoot, componentName);\n if (importPath === null) {\n return false;\n }\n const content = tree.read(importPath, \"utf-8\");\n if (content === null) {\n return false;\n }\n try {\n program = parseTsestreeSource(content);\n } catch {\n return false;\n }\n }\n\n const jsx = findJsxReturnedByName(program, componentName);\n if (jsx === null) {\n return false;\n }\n if (getJsxComponentName(jsx) === \"Outlet\") {\n return true;\n }\n return elementContainsOutlet(jsx);\n};\n\nconst dedupeShells = (shells: ReadonlyArray<ResolvedContentShell>): Array<ResolvedContentShell> => {\n const seen = new Set<string>();\n const result: Array<ResolvedContentShell> = [];\n for (const shell of shells) {\n const key = `${shell.filePath}:${shell.location.reportNode.range[0]}:${shell.location.reportNode.range[1]}`;\n if (seen.has(key)) continue;\n seen.add(key);\n result.push(shell);\n }\n return result;\n};\n\n/**\n * Finds the JSX element returned by the entry's primary component:\n * `singleSpaReact({ rootComponent })` when present, otherwise the first\n * exported function/const whose body returns JSX.\n */\nconst findRootJsxElement = (program: TSESTree.Program): TSESTree.JSXElement | TSESTree.JSXFragment | null => {\n const singleSpaRootName = findSingleSpaRootComponentName(program);\n if (singleSpaRootName !== null) {\n return findJsxReturnedByName(program, singleSpaRootName);\n }\n\n for (const statement of program.body) {\n const name = getExportedComponentName(statement);\n if (name === null) continue;\n const jsx = findJsxReturnedByName(program, name);\n if (jsx !== null) return jsx;\n }\n\n return null;\n};\n\nconst findSingleSpaRootComponentName = (program: TSESTree.Program): string | null => {\n let result: string | null = null;\n\n simpleTraverse(program, {\n enter: node => {\n if (result !== null) return;\n if (node.type !== AST_NODE_TYPES.CallExpression) return;\n if (!isCalleeNamed(node.callee, \"singleSpaReact\")) return;\n if (node.arguments[0]?.type !== AST_NODE_TYPES.ObjectExpression) return;\n\n for (const property of node.arguments[0].properties) {\n if (property.type !== AST_NODE_TYPES.Property) continue;\n if (property.key.type !== AST_NODE_TYPES.Identifier || property.key.name !== \"rootComponent\") continue;\n if (property.value.type === AST_NODE_TYPES.Identifier) {\n result = property.value.name;\n }\n }\n },\n });\n\n return result;\n};\n\nconst getExportedComponentName = (statement: TSESTree.ProgramStatement): string | null => {\n if (statement.type === AST_NODE_TYPES.ExportNamedDeclaration) {\n if (statement.declaration?.type === AST_NODE_TYPES.FunctionDeclaration) {\n return statement.declaration.id?.name ?? null;\n }\n if (statement.declaration?.type === AST_NODE_TYPES.VariableDeclaration) {\n const declarator = statement.declaration.declarations[0];\n if (declarator.id.type === AST_NODE_TYPES.Identifier) {\n return declarator.id.name;\n }\n }\n }\n if (statement.type === AST_NODE_TYPES.ExportDefaultDeclaration) {\n if (statement.declaration.type === AST_NODE_TYPES.Identifier) {\n return statement.declaration.name;\n }\n if (statement.declaration.type === AST_NODE_TYPES.FunctionDeclaration) {\n return statement.declaration.id?.name ?? null;\n }\n }\n return null;\n};\n\nconst findJsxReturnedByName = (\n program: TSESTree.Program,\n name: string\n): TSESTree.JSXElement | TSESTree.JSXFragment | null => {\n for (const statement of program.body) {\n const fn = matchNamedFunctionLike(statement, name);\n if (fn !== null) {\n return findReturnedJsx(fn);\n }\n }\n return null;\n};\n\nconst matchNamedFunctionLike = (\n statement: TSESTree.ProgramStatement,\n name: string\n): TSESTree.BlockStatement | TSESTree.Expression | null => {\n const decl =\n statement.type === AST_NODE_TYPES.ExportNamedDeclaration ||\n statement.type === AST_NODE_TYPES.ExportDefaultDeclaration\n ? statement.declaration\n : statement;\n\n if (decl === null) return null;\n\n if (decl.type === AST_NODE_TYPES.FunctionDeclaration && decl.id !== null && decl.id.name === name) {\n return decl.body;\n }\n\n if (decl.type === AST_NODE_TYPES.VariableDeclaration) {\n for (const declarator of decl.declarations) {\n if (declarator.id.type !== AST_NODE_TYPES.Identifier || declarator.id.name !== name) continue;\n const init = declarator.init;\n if (init === null) return null;\n if (init.type === AST_NODE_TYPES.ArrowFunctionExpression || init.type === AST_NODE_TYPES.FunctionExpression) {\n return init.body;\n }\n }\n }\n\n if (statement.type === AST_NODE_TYPES.FunctionDeclaration && statement.id.name === name) {\n return statement.body;\n }\n\n return null;\n};\n\nconst findReturnedJsx = (\n body: TSESTree.BlockStatement | TSESTree.Expression\n): TSESTree.JSXElement | TSESTree.JSXFragment | null => {\n if (body.type === AST_NODE_TYPES.JSXElement || body.type === AST_NODE_TYPES.JSXFragment) {\n return body;\n }\n if (body.type === AST_NODE_TYPES.BlockStatement) {\n for (const statement of body.body) {\n if (statement.type !== AST_NODE_TYPES.ReturnStatement || statement.argument === null) continue;\n const arg = unwrapParentheses(statement.argument);\n if (arg.type === AST_NODE_TYPES.JSXElement || arg.type === AST_NODE_TYPES.JSXFragment) {\n return arg;\n }\n }\n }\n return null;\n};\n\nconst unwrapParentheses = (expression: TSESTree.Expression): TSESTree.Expression => {\n let current = expression;\n while (current.type === AST_NODE_TYPES.TSAsExpression || current.type === AST_NODE_TYPES.TSSatisfiesExpression) {\n current = current.expression;\n }\n return current;\n};\n\n/**\n * Skips known provider / Suspense / fragment wrappers down to the first\n * meaningful child (host element or custom component).\n */\nconst unwrapWrappers = (\n node: TSESTree.JSXElement | TSESTree.JSXFragment\n): TSESTree.JSXElement | TSESTree.JSXFragment | null => {\n let current: TSESTree.JSXElement | TSESTree.JSXFragment = node;\n\n for (;;) {\n if (current.type === AST_NODE_TYPES.JSXFragment) {\n const child = firstJsxChild(current.children);\n if (child === null) return null;\n current = child;\n continue;\n }\n\n const name = getJsxComponentName(current);\n if (name !== null && isKnownWrapperName(name)) {\n const child = firstJsxChild(current.children);\n if (child === null) return null;\n current = child;\n continue;\n }\n\n return current;\n }\n};\n\nconst firstJsxChild = (\n children: ReadonlyArray<TSESTree.JSXChild>\n): TSESTree.JSXElement | TSESTree.JSXFragment | null => {\n for (const child of children) {\n if (child.type === AST_NODE_TYPES.JSXElement || child.type === AST_NODE_TYPES.JSXFragment) {\n return child;\n }\n }\n return null;\n};\n\nconst isDivLikeHost = (element: TSESTree.JSXElement | TSESTree.JSXFragment): boolean => {\n if (element.type !== AST_NODE_TYPES.JSXElement) return false;\n const name = getJsxOpeningName(element.openingElement.name);\n return name !== null && DIV_LIKE_ELEMENTS.has(name);\n};\n\nconst getJsxComponentName = (element: TSESTree.JSXElement | TSESTree.JSXFragment): string | null => {\n if (element.type !== AST_NODE_TYPES.JSXElement) return null;\n const name = getJsxOpeningName(element.openingElement.name);\n if (name === null) return null;\n if (DIV_LIKE_ELEMENTS.has(name)) return null;\n if (/^[a-z]/.test(name)) return null;\n return name;\n};\n\nconst getJsxOpeningName = (name: TSESTree.JSXTagNameExpression): string | null => {\n if (name.type === AST_NODE_TYPES.JSXIdentifier) return name.name;\n return null;\n};\n\n/**\n * Confidence rule for this phase: a single editable content-region classname\n * host that itself owns scrollable overflow (`overflow-auto` / `scroll` /\n * `overlay`, including axis-prefixed forms). Clipping overflow (`hidden` /\n * `clip`), a scrolling descendant, or a header-ish child (`PageHeader` /\n * `Topbar` / `Header`) make the host unresolved — those cases go to the\n * unresolved-surface report for a human to place the inset.\n *\n * Classnames must be bound to the host's `className`/`class` attribute (literal\n * on the attribute, direct Tailwind call in the attribute, or the local\n * binding of that attribute's identifier/callee). Never invent from unrelated\n * file-wide classname locations.\n */\nconst pickContentShellInFile = (\n filePath: string,\n program: TSESTree.Program,\n host: TSESTree.JSXElement\n): ResolveContentShellResult => {\n const hostClassnames = collectEditableClassnamesForHost(program, host);\n if (hostClassnames.length === 0) {\n return unresolvedShell(\"no-editable-classname\", filePath);\n }\n\n if (hostClassnames.some(classname => classListHasClippingOverflow(splitClasses(classname.value)))) {\n return unresolvedShell(\"clipping-overflow-on-host\", filePath);\n }\n\n const candidates = hostClassnames.filter(isContentShellClassname);\n if (candidates.length === 0) {\n return unresolvedShell(\"no-overflow-on-host\", filePath);\n }\n if (candidates.length > 1) {\n return unresolvedShell(\"multiple-overflow-candidates\", filePath);\n }\n\n if (hostRendersHeader(host)) {\n return unresolvedShell(\"header-on-shell\", filePath);\n }\n if (descendantOwnsScroll(program, host)) {\n return unresolvedShell(\"descendant-owns-scroll\", filePath);\n }\n\n const location = candidates[0];\n if (location === undefined) {\n return unresolvedShell(\"unclear-graph\", filePath);\n }\n return {\n status: \"resolved\",\n shell: {\n filePath,\n classnameValue: location.value,\n combinedClassnameValue: hostClassnames.map(hostLocation => hostLocation.value).join(\" \"),\n location,\n },\n };\n};\n\nconst collectEditableClassnamesForHost = (\n program: TSESTree.Program,\n host: TSESTree.JSXElement\n): Array<ClassnameLocation> => {\n const attribute = host.openingElement.attributes.find(\n (attr): attr is TSESTree.JSXAttribute =>\n attr.type === AST_NODE_TYPES.JSXAttribute &&\n attr.name.type === AST_NODE_TYPES.JSXIdentifier &&\n (attr.name.name === \"className\" || attr.name.name === \"class\")\n );\n if (attribute === undefined) return [];\n\n // Direct literal classnames on the attribute.\n const fromAttribute = findClassnameLocations(program).filter(location => {\n if (location.context.type !== \"jsx-attribute\") return false;\n return location.reportNode.range[0] >= attribute.range[0] && location.reportNode.range[1] <= attribute.range[1];\n });\n if (fromAttribute.length > 0) return fromAttribute;\n\n const value = attribute.value;\n if (value?.type !== AST_NODE_TYPES.JSXExpressionContainer) return [];\n const expression = value.expression;\n\n if (expression.type === AST_NODE_TYPES.CallExpression) {\n return collectClassnamesBoundToCallExpression(program, expression);\n }\n if (expression.type === AST_NODE_TYPES.Identifier) {\n return collectClassnamesBoundToIdentifier(program, expression.name);\n }\n return [];\n};\n\n/**\n * `className={cva(\"...\")}` — locations inside this call only.\n * `className={layout()}` — locations inside the local binding of `layout` only.\n */\nconst collectClassnamesBoundToCallExpression = (\n program: TSESTree.Program,\n callExpression: TSESTree.CallExpression\n): Array<ClassnameLocation> => {\n if (callExpression.callee.type !== AST_NODE_TYPES.Identifier) {\n return [];\n }\n\n const calleeName = callExpression.callee.name;\n if (isTailwindFunction(calleeName)) {\n return findClassnameLocations(program).filter(\n location =>\n location.reportNode.range[0] >= callExpression.range[0] &&\n location.reportNode.range[1] <= callExpression.range[1]\n );\n }\n\n return collectClassnamesBoundToIdentifier(program, calleeName);\n};\n\nconst collectClassnamesBoundToIdentifier = (program: TSESTree.Program, name: string): Array<ClassnameLocation> => {\n const bindingRange = findLocalBindingInitializerRange(program, name);\n if (bindingRange === null) {\n return [];\n }\n\n return findClassnameLocations(program).filter(\n location => location.reportNode.range[0] >= bindingRange[0] && location.reportNode.range[1] <= bindingRange[1]\n );\n};\n\nconst findLocalBindingInitializerRange = (program: TSESTree.Program, name: string): TSESTree.Range | null => {\n let result: TSESTree.Range | null = null;\n\n simpleTraverse(program, {\n enter: node => {\n if (result !== null) return;\n if (node.type !== AST_NODE_TYPES.VariableDeclarator) return;\n if (node.id.type !== AST_NODE_TYPES.Identifier || node.id.name !== name) return;\n if (node.init === null) return;\n result = node.init.range;\n },\n });\n\n return result;\n};\n\nconst SCROLLABLE_OVERFLOW = /(^|:)overflow-(x-|y-)?(auto|scroll|overlay)$/;\nconst CLIPPING_OVERFLOW = /(^|:)overflow-(x-|y-)?(hidden|clip)$/;\n\nconst classListHasScrollableOverflow = (classes: ReadonlyArray<string>): boolean =>\n classes.some(cls => SCROLLABLE_OVERFLOW.test(cls));\n\nconst classListHasClippingOverflow = (classes: ReadonlyArray<string>): boolean =>\n classes.some(cls => CLIPPING_OVERFLOW.test(cls));\n\nconst isContentShellClassname = (location: ClassnameLocation): boolean => {\n const classes = splitClasses(location.value);\n if (classListHasClippingOverflow(classes)) return false;\n return classListHasScrollableOverflow(classes);\n};\n\nconst HEADER_ISH_NAMES: ReadonlySet<string> = new Set([\"PageHeader\", \"Topbar\", \"Header\"]);\n\nconst hostRendersHeader = (host: TSESTree.JSXElement): boolean =>\n jsxElementsUnder(host).some(element => {\n const name = getJsxOpeningName(element.openingElement.name);\n return name !== null && HEADER_ISH_NAMES.has(name);\n });\n\nconst descendantOwnsScroll = (program: TSESTree.Program, host: TSESTree.JSXElement): boolean =>\n jsxElementsUnder(host).some(element =>\n collectEditableClassnamesForHost(program, element).some(isContentShellClassname)\n );\n\nconst jsxElementsUnder = (host: TSESTree.JSXElement): Array<TSESTree.JSXElement> => {\n const found: Array<TSESTree.JSXElement> = [];\n const visit = (children: ReadonlyArray<TSESTree.JSXChild>): void => {\n for (const child of children) {\n if (child.type === AST_NODE_TYPES.JSXElement) {\n found.push(child);\n visit(child.children);\n } else if (child.type === AST_NODE_TYPES.JSXFragment) {\n visit(child.children);\n }\n }\n };\n visit(host.children);\n return found;\n};\n\nconst isDynamicComponent = (program: TSESTree.Program, componentName: string): boolean => {\n let isDynamic = false;\n\n simpleTraverse(program, {\n enter: node => {\n if (isDynamic) return;\n if (node.type !== AST_NODE_TYPES.VariableDeclarator) return;\n if (node.id.type !== AST_NODE_TYPES.Identifier || node.id.name !== componentName) return;\n if (node.init === null) return;\n if (containsDynamicImport(node.init)) {\n isDynamic = true;\n }\n },\n });\n\n return isDynamic;\n};\n\nconst containsDynamicImport = (node: TSESTree.Node): boolean => {\n let found = false;\n simpleTraverse(node, {\n enter: child => {\n if (found) return;\n if (child.type === AST_NODE_TYPES.ImportExpression) {\n found = true;\n }\n },\n });\n return found;\n};\n\n/**\n * Resolves a component name to a static relative/local import under\n * `sourceRoot`. Returns null for external packages or missing bindings.\n */\nconst resolveStaticLocalImport = (\n tree: Tree,\n program: TSESTree.Program,\n fromFilePath: string,\n sourceRoot: string,\n componentName: string\n): string | null => {\n for (const statement of program.body) {\n if (statement.type !== AST_NODE_TYPES.ImportDeclaration) continue;\n const specifier = statement.source.value;\n if (typeof specifier !== \"string\") continue;\n const bindsComponent = statement.specifiers.some(spec => {\n if (spec.type === AST_NODE_TYPES.ImportDefaultSpecifier) {\n return spec.local.name === componentName;\n }\n if (spec.type === AST_NODE_TYPES.ImportSpecifier) {\n return spec.local.name === componentName;\n }\n return false;\n });\n if (!bindsComponent) continue;\n\n if (!(specifier.startsWith(\"./\") || specifier.startsWith(\"../\"))) {\n return null;\n }\n\n const fromDir = path.posix.dirname(fromFilePath);\n const resolvedWithoutExt = path.posix.normalize(path.posix.join(fromDir, specifier));\n const candidates = [\n resolvedWithoutExt,\n `${resolvedWithoutExt}.tsx`,\n `${resolvedWithoutExt}.ts`,\n `${resolvedWithoutExt}/index.tsx`,\n `${resolvedWithoutExt}/index.ts`,\n ];\n\n for (const candidate of candidates) {\n if (candidate === fromFilePath) continue;\n if (!candidate.startsWith(`${sourceRoot}/`) && candidate !== sourceRoot) continue;\n if (!(candidate.endsWith(\".tsx\") || candidate.endsWith(\".ts\"))) continue;\n if (tree.exists(candidate)) {\n return candidate;\n }\n }\n }\n\n // Local const binding (e.g. LazyPage) without an import — not followable as a\n // static local module.\n return null;\n};\n\nconst isCalleeNamed = (callee: TSESTree.CallExpression[\"callee\"], name: string): boolean => {\n return callee.type === AST_NODE_TYPES.Identifier && callee.name === name;\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rewrite-page-content.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app/migrations/p-content-space-codemod/rewrite-page-content.ts"],"names":[],"mappings":";;AAmCA,gDAYC;AA9CD,wEAAiF;AACjF,0EAAoF;AAGpF,MAAM,oBAAoB,GAAG,cAAc,CAAC;AAC5C,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAC9C,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAE5C;;;GAGG;AACH,SAAS,gBAAgB,CAAC,OAA8B;IACtD,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,kBAAkB,CAAC,IAAU,EAAE,SAA4B;IACzE,OAAO,IAAA,0DAAkC,EACvC,IAAI,EACJ,SAAS,CAAC,UAAU,EACpB,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EACjD,KAAK,CAAC,EAAE;QACN,MAAM,WAAW,GAAG,gBAAgB,CAAC,IAAA,kCAAY,EAAC,KAAK,CAAC,CAAC;YACvD,CAAC,CAAC,mBAAmB;YACrB,CAAC,CAAC,GAAG,mBAAmB,IAAI,mBAAmB,EAAE,CAAC;QACpD,OAAO,IAAA,uCAAiB,EAAC,KAAK,EAAE,oBAAoB,EAAE,WAAW,CAAC,CAAC;IACrE,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["import type { Tree } from \"@nx/devkit\";\nimport { replaceClassToken, splitClasses } from \"@trackunit/css-classname-utils\";\nimport { transformClassnamesUnderSourceRoot } from \"../utils/classname-ast-rewrite\";\nimport type { ResolvedExtension } from \"../utils/resolve-extension-types\";\n\nconst PAGE_CONTENT_PATTERN = \"page-content\";\nconst CONTENT_SPACE_TOKEN = \"p-content-space\";\nconst OVERFLOW_AUTO_TOKEN = \"overflow-auto\";\n\n/**\n * True when `token` is already present as a whole class token, including when\n * wrapped in Tailwind variant prefixes (e.g. `xl:overflow-hidden`).\n */\nfunction hasOverflowToken(classes: ReadonlyArray<string>): boolean {\n return classes.some(cls => /(^|:)overflow-/.test(cls));\n}\n\n/**\n * Rewrites the legacy `page-content` Tailwind class to\n * `overflow-auto p-content-space` across every rewritable file under a\n * single resolved extension's `sourceRoot`.\n *\n * When the classname already declares its own `overflow-*` token, only\n * `p-content-space` is inserted — emitting a second `overflow-auto` would be\n * dead (or, when an identical `overflow-auto` is already present, a\n * duplicate). Scroll ownership stays with the element's existing overflow\n * declaration.\n *\n * Scoped to one extension per call — the caller (the orchestrator) loops\n * over every Asset Home/Site Home/Admin extension.\n *\n * Only performs the `page-content` classname rewrite: it does not touch\n * `pb-*`/`pb-responsive-space` classes or produce a report, both of which are\n * separate migration steps.\n */\nexport function rewritePageContent(tree: Tree, extension: ResolvedExtension): { filesChanged: Array<string> } {\n return transformClassnamesUnderSourceRoot(\n tree,\n extension.sourceRoot,\n content => content.includes(PAGE_CONTENT_PATTERN),\n value => {\n const replacement = hasOverflowToken(splitClasses(value))\n ? CONTENT_SPACE_TOKEN\n : `${OVERFLOW_AUTO_TOKEN} ${CONTENT_SPACE_TOKEN}`;\n return replaceClassToken(value, PAGE_CONTENT_PATTERN, replacement);\n }\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shell-skip-reason.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app/migrations/p-content-space-codemod/shell-skip-reason.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AA4BH,MAAM,QAAQ,GAAwC;IACpD,eAAe,EAAE,qDAAqD;IACtE,cAAc,EAAE,8DAA8D;IAC9E,aAAa,EAAE,yDAAyD;IACxE,eAAe,EAAE,mEAAmE;IACpF,KAAK,EAAE,uEAAuE;IAC9E,mBAAmB,EAAE,0EAA0E;IAC/F,qBAAqB,EAAE,gEAAgE;IACvF,kBAAkB,EAAE,sEAAsE;IAC1F,wBAAwB,EAAE,8DAA8D;IACxF,gCAAgC,EAC9B,+HAA+H;IACjI,6BAA6B,EAC3B,uFAAuF;IACzF,uBAAuB,EAAE,0FAA0F;IACnH,qBAAqB,EACnB,qIAAqI;IACvI,8BAA8B,EAAE,0EAA0E;IAC1G,iBAAiB,EAAE,4FAA4F;IAC/G,wBAAwB,EAAE,qFAAqF;IAC/G,2BAA2B,EACzB,kGAAkG;IACpG,eAAe,EAAE,sEAAsE;CACxF,CAAC;AAEF;;;;;;GAMG;AACI,MAAM,eAAe,GAAG,CAAC,IAAyB,EAAE,MAAe,EAAmB,EAAE,CAAC,CAAC;IAC/F,IAAI;IACJ,OAAO,EAAE,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,MAAM,GAAG;CACxG,CAAC,CAAC;AAHU,QAAA,eAAe,mBAGzB","sourcesContent":["/**\n * Why invent/resolve declined to pick an ASA content shell. Surfaced in\n * migration console output and UnresolvedSurfaceReport so humans (and\n * third parties) can plan manual `p-content-space` placement.\n */\n\nexport type ShellSkipReasonCode =\n | \"entry-missing\"\n | \"parse-failed\"\n | \"no-root-jsx\"\n | \"empty-wrapper\"\n | \"cycle\"\n | \"dynamic-component\"\n | \"unresolvable-import\"\n | \"non-host-element\"\n | \"router-prop-unresolved\"\n | \"router-inline-arrow-components\"\n | \"router-no-analysable-leaves\"\n | \"no-editable-classname\"\n | \"no-overflow-on-host\"\n | \"multiple-overflow-candidates\"\n | \"header-on-shell\"\n | \"descendant-owns-scroll\"\n | \"clipping-overflow-on-host\"\n | \"unclear-graph\";\n\nexport type ShellSkipReason = {\n readonly code: ShellSkipReasonCode;\n /** Human-readable explanation (safe to print to the console). */\n readonly message: string;\n};\n\nconst MESSAGES: Record<ShellSkipReasonCode, string> = {\n \"entry-missing\": \"extension entry file was not found under sourceRoot\",\n \"parse-failed\": \"extension entry/source could not be parsed as TypeScript/TSX\",\n \"no-root-jsx\": \"could not find a root JSX return in the entry component\",\n \"empty-wrapper\": \"provider/Suspense/Fragment wrappers had no JSX child to walk into\",\n cycle: \"component graph walked into a cycle while resolving the content shell\",\n \"dynamic-component\": \"content shell is behind a dynamic import / lazy component (not followed)\",\n \"unresolvable-import\": \"could not resolve a static local import for the host component\",\n \"non-host-element\": \"leaf JSX is not a div/main/section with an inventable className host\",\n \"router-prop-unresolved\": \"RouterProvider router={...} prop was not a simple identifier\",\n \"router-inline-arrow-components\":\n \"TanStack routes use inline arrow `component: () => <...>` instead of a named component identifier — invent cannot follow them\",\n \"router-no-analysable-leaves\":\n \"router graph had no analysable named route leaves with a clear overflow content shell\",\n \"no-editable-classname\": \"div/main/section host has no editable className/class (literal or bound Tailwind helper)\",\n \"no-overflow-on-host\":\n \"host has a className but does not itself own scrollable overflow (overflow-auto/scroll/overlay) — invent only pads the scroll owner\",\n \"multiple-overflow-candidates\": \"host has more than one inventable overflow classname binding (ambiguous)\",\n \"header-on-shell\": \"host also renders PageHeader/Topbar/Header — pad the body below the header, not this shell\",\n \"descendant-owns-scroll\": \"a descendant owns overflow scrolling — pad that scroll owner, not the outer wrapper\",\n \"clipping-overflow-on-host\":\n \"host uses overflow-hidden/clip (full-bleed / clipping shell) — not inventable as a content inset\",\n \"unclear-graph\": \"content-shell graph was unclear; invent refused to guess a first-div\",\n};\n\n/**\n * Builds a structured skip reason for invent/resolve console + report output.\n *\n * @param code - Stable skip-reason code from the inventable-shell contract\n * @param detail - Optional path / leaf list / host name appended in parentheses\n * @returns {ShellSkipReason} Structured reason with a human-readable message\n */\nexport const shellSkipReason = (code: ShellSkipReasonCode, detail?: string): ShellSkipReason => ({\n code,\n message: detail === undefined || detail.length === 0 ? MESSAGES[code] : `${MESSAGES[code]} (${detail})`,\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repair-tsconfig.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app/migrations/repair-tsconfig/repair-tsconfig.ts"],"names":[],"mappings":";;;AAAA,uCAAoH;AACpH,+BAA0F;AAC1F,mHAAmH;AACnH,8CAA4D;AAC5D,2CAA0D;AAE1D;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,uBAAuB,GAAG,uBAAuB,CAAC;AACxD,MAAM,sBAAsB,GAAG,sBAAsB,CAAC;AACtD,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAC9C,MAAM,SAAS,GAAG,WAAW,CAAC;AAI9B,iHAAiH;AACjH,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAuB,EAAE,CACvD,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEvE,MAAM,YAAY,GAAG,CAAC,KAAc,EAAU,EAAE,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAA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AAM,gBAAgB,GAAG,CAAC,IAAU,EAAQ,EAAE;IACnD,KAAK,MAAM,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;QACzC,IAAI,CAAC;YACH,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,eAAM,CAAC,IAAI,CAAC,0BAA0B,OAAO,KAAK,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AARW,QAAA,gBAAgB,oBAQ3B;AAEF;;;;GAIG;AACI,MAAM,cAAc,GAAG,CAAC,IAAU,EAAQ,EAAE;IACjD,IAAA,4BAAoB,EAAC,IAAI,CAAC,CAAC;IAC3B,IAAA,wBAAgB,EAAC,IAAI,CAAC,CAAC;AACzB,CAAC,CAAC;AAHW,QAAA,cAAc,kBAGzB;AAEF,kBAAe,sBAAc,CAAC","sourcesContent":["import { getProjects, joinPathFragments, logger, normalizePath, readJson, updateJson, type Tree } from \"@nx/devkit\";\nimport { extendsResolutionFailed, getRootTsConfigPathInTree, readTsConfig } from \"@nx/js\";\n// An internal entry point: safe only because iris-app pins @nx/js exactly. Check this export on every @nx/js bump.\nimport { createTreeParseConfigHost } from \"@nx/js/internal\";\nimport { isExternalModuleNameRelative } from \"typescript\";\n\n/**\n * Repairs the TypeScript configuration of workspaces the SDK itself left\n * unbuildable under a type-checked `nx build` (SDK-649).\n *\n * Root cause (path aliases): the `extend` generator wrote `tsconfig.base.json` `paths` entries\n * without a leading `./` while the workspace preset leaves `baseUrl` unset, and\n * TypeScript 6 rejects that combination with TS5090. Generators fixed in the\n * SDK only help new workspaces, so existing ones are repaired here.\n *\n * Root cause (jsx): `iris-app:create` generated a `tsconfig.app.json` with no\n * `jsx`, so once an extension manifest imports `./src/routeTree` (`.tsx`) the\n * app's type-check fails with TS6142.\n *\n * Only alias targets that are non-relative and point at an existing\n * `extension-manifest.ts` (the shape the SDK's `extend` generator writes) are\n * touched; other aliases that would still trip TS5090 are reported with a\n * warning. A file is only written when something in it changes, and is then\n * re-serialised like every other JSON edit the SDK makes, so comments and\n * trailing commas in that file are lost. A file this migration cannot read is\n * skipped with a warning and never aborts the migration.\n */\n\nconst EXTENSION_MANIFEST_FILE = \"extension-manifest.ts\";\nconst IRIS_APP_MANIFEST_FILE = \"iris-app-manifest.ts\";\nconst APP_TSCONFIG_FILE = \"tsconfig.app.json\";\nconst JSX_VALUE = \"react-jsx\";\n\ntype JsonObject = Record<string, unknown>;\n\n// TODO(SDK-742): promote `isRecord` and `errorMessage` to @trackunit/shared-utils; they are copied here for now.\nconst isRecord = (value: unknown): value is JsonObject =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst errorMessage = (error: unknown): string => (error instanceof Error ? error.message : String(error));\n\n/** Reads a tsconfig (devkit's `readJson` accepts comments and trailing commas); `undefined` when it is not a JSON object. */\nconst readJsonObject = (tree: Tree, filePath: string): JsonObject | undefined => {\n const parsed: unknown = readJson(tree, filePath);\n return isRecord(parsed) ? parsed : undefined;\n};\n\n/** TypeScript's own syntax diagnostics (TS1xxx), such as \"'}' expected\": the JSON of a file in the chain is broken. */\nconst isSyntaxDiagnostic = (diagnostic: { readonly code: number }): boolean => diagnostic.code < 2000;\n\n/**\n * What TypeScript itself makes of a tsconfig, `extends` chain included: the options and whether the chain could be\n * read in full. The Tree-backed host resolves the chain exactly like `tsc`, package-form bases such as\n * `@tsconfig/strictest` included. A chain with a missing base or broken JSON is not read in full, since an option\n * missing from what could be read may be set in what could not.\n */\nconst resolveEffectiveConfig = (tree: Tree, filePath: string) => {\n const parsed = readTsConfig(filePath, createTreeParseConfigHost(tree));\n return {\n options: parsed.options,\n chainReadable: !extendsResolutionFailed(parsed.errors) && !parsed.errors.some(isSyntaxDiagnostic),\n };\n};\n\n/**\n * The forward-slash form of an alias target the SDK wrote, or `undefined` when\n * the target is not one. The `extend` generator builds targets with\n * `path.join`, so ones created on Windows carry backslashes.\n */\nconst sdkExtensionManifestTarget = (tree: Tree, target: unknown): string | undefined => {\n if (typeof target !== \"string\") {\n return undefined;\n }\n const normalised = normalizePath(target);\n const isManifest = normalised === EXTENSION_MANIFEST_FILE || normalised.endsWith(`/${EXTENSION_MANIFEST_FILE}`);\n return isManifest && !isExternalModuleNameRelative(normalised) && tree.exists(normalised) ? normalised : undefined;\n};\n\n/** Whether any target of `paths` is an SDK extension manifest target that still lacks its `./`. */\nconst hasSdkAliasToRepair = (tree: Tree, paths: JsonObject): boolean =>\n Object.values(paths).some(\n targets => Array.isArray(targets) && targets.some(target => sdkExtensionManifestTarget(tree, target) !== undefined)\n );\n\n/**\n * Prefixes `./` onto every SDK extension manifest target of `paths`, in place.\n * The prefix never changes what an alias resolves to: with `baseUrl` set,\n * targets resolve against it and `./libs/x` is the same path as `libs/x`;\n * without it they resolve against the tsconfig and TypeScript 6 requires the\n * `./`.\n */\nconst prefixSdkAliases = (tree: Tree, paths: JsonObject): void => {\n for (const targets of Object.values(paths)) {\n if (!Array.isArray(targets)) {\n continue;\n }\n targets.forEach((target: unknown, index) => {\n const manifestPath = sdkExtensionManifestTarget(tree, target);\n if (manifestPath !== undefined) {\n targets[index] = `./${manifestPath}`;\n }\n });\n }\n};\n\n/**\n * Aliases this migration leaves alone that still break a type-checked build:\n * TS5090 applies to every non-relative `paths` target once no `baseUrl`\n * applies, not only the SDK's. They are reported, never rewritten.\n */\nconst remainingNonRelativeAliases = (tree: Tree, paths: JsonObject): ReadonlyArray<string> =>\n Object.entries(paths)\n .filter(\n ([, targets]) =>\n Array.isArray(targets) &&\n targets.some(\n (target: unknown) =>\n typeof target === \"string\" &&\n !isExternalModuleNameRelative(normalizePath(target)) &&\n sdkExtensionManifestTarget(tree, target) === undefined\n )\n )\n .map(([alias]) => alias);\n\nconst repairPathAliasesIn = (tree: Tree, rootTsConfigPath: string): void => {\n const tsConfig = readJsonObject(tree, rootTsConfigPath);\n if (tsConfig === undefined || !isRecord(tsConfig.compilerOptions) || !isRecord(tsConfig.compilerOptions.paths)) {\n return;\n }\n const { paths } = tsConfig.compilerOptions;\n\n // The warning is only true when no baseUrl applies, whether the file sets it or inherits it through `extends`.\n // A chain that cannot be read leaves that unknown, and an unknown is not worth a possibly false warning.\n const { options, chainReadable } = resolveEffectiveConfig(tree, rootTsConfigPath);\n const remaining = chainReadable && options.baseUrl === undefined ? remainingNonRelativeAliases(tree, paths) : [];\n if (remaining.length > 0) {\n logger.warn(\n `${rootTsConfigPath} has path aliases with non-relative targets, which TypeScript rejects when no baseUrl is set (TS5090): ${remaining.join(\", \")}. They were not written by the Iris App SDK, so they were left as they are; add a leading \"./\" to their targets if the workspace sets no baseUrl.`\n );\n }\n\n if (hasSdkAliasToRepair(tree, paths)) {\n updateJson<JsonObject>(tree, rootTsConfigPath, json => {\n if (isRecord(json.compilerOptions) && isRecord(json.compilerOptions.paths)) {\n prefixSdkAliases(tree, json.compilerOptions.paths);\n }\n return json;\n });\n logger.info(`Repaired SDK path aliases in ${rootTsConfigPath}: prefixed \"./\" onto extension manifest paths.`);\n }\n};\n\n/**\n * Prefixes `./` onto the `paths` entries of the root tsconfig that point at an\n * existing project's `extension-manifest.ts`.\n *\n * @param tree - Nx virtual file tree.\n */\nexport const repairSdkPathAliases = (tree: Tree): void => {\n // Typed `string | null`, but at runtime it falls back to `tsconfig.base.json` even when neither candidate exists,\n // so a path that is not there has to be checked for as well.\n const rootTsConfigPath = getRootTsConfigPathInTree(tree);\n if (rootTsConfigPath === null || !tree.exists(rootTsConfigPath)) {\n return;\n }\n\n try {\n repairPathAliasesIn(tree, rootTsConfigPath);\n } catch (error) {\n logger.warn(`Skipped path alias repair for ${rootTsConfigPath}: ${errorMessage(error)}`);\n }\n};\n\nconst irisAppRoots = (tree: Tree): ReadonlyArray<string> =>\n Array.from(getProjects(tree).values(), project => project.root).filter(root =>\n tree.exists(joinPathFragments(root, IRIS_APP_MANIFEST_FILE))\n );\n\nconst addJsxToApp = (tree: Tree, appRoot: string): void => {\n const appTsConfigPath = joinPathFragments(appRoot, APP_TSCONFIG_FILE);\n\n if (!tree.isFile(appTsConfigPath)) {\n logger.warn(`Skipped jsx repair for ${appRoot}: ${appTsConfigPath} not found.`);\n return;\n }\n\n const appTsConfig = readJsonObject(tree, appTsConfigPath);\n if (appTsConfig === undefined) {\n logger.warn(`Skipped jsx repair for ${appTsConfigPath}: it is not a JSON object.`);\n return;\n }\n if (appTsConfig.compilerOptions !== undefined && !isRecord(appTsConfig.compilerOptions)) {\n logger.warn(`Skipped jsx repair for ${appTsConfigPath}: its compilerOptions is not an object.`);\n return;\n }\n\n // Only a chain read in full can show `jsx` is missing, so an unreadable one is left alone.\n const { options, chainReadable } = resolveEffectiveConfig(tree, appTsConfigPath);\n if (!chainReadable || options.jsx !== undefined) {\n return;\n }\n\n updateJson<JsonObject>(tree, appTsConfigPath, json => ({\n ...json,\n compilerOptions: { ...(isRecord(json.compilerOptions) ? json.compilerOptions : {}), jsx: JSX_VALUE },\n }));\n logger.info(`Added \"jsx\": \"${JSX_VALUE}\" to ${appTsConfigPath}.`);\n};\n\n/**\n * Adds `jsx: \"react-jsx\"` to the `tsconfig.app.json` of every Iris app (a\n * project with an `iris-app-manifest.ts`) whose effective tsconfig chain\n * (`tsconfig.app.json` -> `tsconfig.json` -> `tsconfig.base.json`, via\n * `extends`) sets no `jsx`. An app that configures `jsx` anywhere in the chain,\n * or whose chain cannot be read in full, is left alone.\n *\n * @param tree - Nx virtual file tree.\n */\nexport const addJsxToIrisApps = (tree: Tree): void => {\n for (const appRoot of irisAppRoots(tree)) {\n try {\n addJsxToApp(tree, appRoot);\n } catch (error) {\n logger.warn(`Skipped jsx repair for ${appRoot}: ${errorMessage(error)}`);\n }\n }\n};\n\n/**\n * Repairs tsconfig defects the SDK left in existing workspaces.\n *\n * @param tree - Nx virtual file tree.\n */\nexport const repairTsconfig = (tree: Tree): void => {\n repairSdkPathAliases(tree);\n addJsxToIrisApps(tree);\n};\n\nexport default repairTsconfig;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classname-ast-rewrite.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app/migrations/utils/classname-ast-rewrite.ts"],"names":[],"mappings":";;;AAmCA,kDAEC;AAaD,wDAgBC;AA2BD,kDAoBC;AAYD,sDAsBC;AAmBD,gCASC;AAgCD,gFAwBC;AAQD,oDAWC;AA1PD,uCAA6D;AAC7D,wEAMwC;AACxC,oDAAyE;AACzE,4EAA6E;AAE7E;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,OAAe;IACjD,OAAO,IAAA,yBAAK,EAAC,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,sBAAsB,CAAC,OAAyB;IAC9D,MAAM,SAAS,GAA6B,EAAE,CAAC;IAE/C,IAAA,kCAAc,EAAC,OAAO,EAAE;QACtB,KAAK,EAAE,IAAI,CAAC,EAAE;YACZ,IAAI,IAAI,CAAC,IAAI,KAAK,sBAAc,CAAC,YAAY,EAAE,CAAC;gBAC9C,SAAS,CAAC,IAAI,CAAC,GAAG,IAAA,qDAA+B,EAAC,IAAI,CAAC,CAAC,CAAC;YAC3D,CAAC;iBAAM,IAAI,IAAI,CAAC,IAAI,KAAK,sBAAc,CAAC,cAAc,EAAE,CAAC;gBACvD,SAAS,CAAC,IAAI,CAAC,GAAG,IAAA,gDAA0B,EAAC,IAAI,CAAC,CAAC,CAAC;YACtD,CAAC;iBAAM,IAAI,IAAI,CAAC,IAAI,KAAK,sBAAc,CAAC,kBAAkB,EAAE,CAAC;gBAC3D,SAAS,CAAC,IAAI,CAAC,GAAG,IAAA,oDAA8B,EAAC,IAAI,CAAC,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;KACF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E,OAAO;QAExC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC7C,IAAI,OAAO,KAAK,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;YAAE,OAAO;QAEzD,MAAM,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAC7C,MAAM,SAAS,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAClD,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,qBAAqB,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;QACjG,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAE/B,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;QACjD,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,YAAY,EAAE,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACH,SAAgB,oBAAoB,CAClC,IAAU,EACV,UAAkB,EAClB,OAAoD;IAEpD,IAAA,6BAAoB,EAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE;QAChD,IAAI,CAAC,IAAA,wBAAgB,EAAC,QAAQ,CAAC;YAAE,OAAO;QACxC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC7C,IAAI,OAAO,KAAK,IAAI;YAAE,OAAO;QAC7B,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { visitNotIgnoredFiles, type Tree } from \"@nx/devkit\";\nimport {\n findClassnameStringsInAttribute,\n findClassnameStringsInCall,\n findClassnameStringsInVariable,\n quoteString,\n type ClassnameLocation,\n} from \"@trackunit/css-classname-utils\";\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/types\";\nimport { parse, simpleTraverse } from \"@typescript-eslint/typescript-estree\";\n\n/**\n * Shared TSESTree parsing/traversal/splice helpers for classname-rewriting Nx\n * migrations (the `p-content-space-codemod` and any future codemod that needs\n * to detect and rewrite Tailwind classnames across a Tree).\n *\n * `@trackunit/css-classname-utils`'s detection helpers\n * (`findClassnameStringsInAttribute`/`InCall`/`InVariable`) expect TSESTree AST\n * nodes, which today only ESLint's parser produces in this repo. Nx migrations\n * run outside of ESLint, so this module wraps\n * `@typescript-eslint/typescript-estree`'s `parse` (the same underlying parser\n * `@typescript-eslint/parser` delegates to) to turn a raw source string into an\n * equivalent TSESTree `Program`, then re-splices edits directly against the\n * original source string by AST node range (mirroring the range-splice\n * approach `insertAttributeIntoOpeningTag` in\n * `libs/react/components/migrations/utils/jsx-utils.ts` uses for the\n * TypeScript-compiler-API case).\n */\n\n/**\n * Parses raw TypeScript/TSX source into a TSESTree `Program` AST.\n *\n * `jsx: true` is always passed (harmless for plain `.ts` files) so callers\n * don't need to branch on file extension before parsing.\n */\nexport function parseTsestreeSource(content: string): TSESTree.Program {\n return parse(content, { jsx: true, loc: true, range: true });\n}\n\n/**\n * Finds every classname string location in a parsed source: JSX\n * `className`/`class` attributes, Tailwind-function calls (`cva`, `cn`,\n * `clsx`, etc. — see `TAILWIND_FUNCTIONS`), and\n * `*Class`/`*ClassName`/`*Classes`-suffixed variable declarators.\n *\n * Walks the AST with `simpleTraverse` (shipped by\n * `@typescript-eslint/typescript-estree`) instead of a hand-rolled\n * visitor-keys walker, since it already knows every node type's visitor keys\n * for the resolved parser version.\n */\nexport function findClassnameLocations(program: TSESTree.Program): Array<ClassnameLocation> {\n const locations: Array<ClassnameLocation> = [];\n\n simpleTraverse(program, {\n enter: node => {\n if (node.type === AST_NODE_TYPES.JSXAttribute) {\n locations.push(...findClassnameStringsInAttribute(node));\n } else if (node.type === AST_NODE_TYPES.CallExpression) {\n locations.push(...findClassnameStringsInCall(node));\n } else if (node.type === AST_NODE_TYPES.VariableDeclarator) {\n locations.push(...findClassnameStringsInVariable(node));\n }\n },\n });\n\n return locations;\n}\n\n/** A single range-based text splice against the original source string. */\nexport type ClassnameEdit = {\n range: TSESTree.Range;\n text: string;\n};\n\n/**\n * Builds the edit(s) needed to apply `transform` to a `ClassnameLocation`'s\n * `fixNode`, splicing by the node's own `.range` against the original source\n * (there is no ESLint `SourceCode`/fixer available outside of rule\n * execution).\n *\n * - `Literal`: one edit replacing the whole quoted literal, preserving the\n * original quote style via `quoteString`.\n * - `TemplateLiteral`: one edit per quasi whose raw text changes, splicing\n * only the text between the surrounding backtick/`${`/`}` delimiters so the\n * template's interpolated expressions are left untouched.\n *\n * Returns an empty array when `transform` doesn't change the value, so\n * callers can cheaply detect \"no-op\" locations.\n *\n * Prefer {@link buildEditsForLocation} when the caller has a full\n * `ClassnameLocation` — that path can drop an emptied JSX `className`\n * attribute entirely instead of leaving `className=\"\"`.\n */\nexport function buildClassnameEdits(\n fixNode: ClassnameLocation[\"fixNode\"],\n transform: (value: string) => string\n): Array<ClassnameEdit> {\n if (fixNode.type === AST_NODE_TYPES.Literal) {\n if (typeof fixNode.value !== \"string\") return [];\n const newValue = transform(fixNode.value);\n if (newValue === fixNode.value) return [];\n return [{ range: fixNode.range, text: quoteString(newValue, fixNode) }];\n }\n\n const edits: Array<ClassnameEdit> = [];\n for (const quasi of fixNode.quasis) {\n const newRaw = transform(quasi.value.raw);\n if (newRaw === quasi.value.raw) continue;\n const start = quasi.range[0] + 1;\n const end = quasi.range[1] - (quasi.tail ? 1 : 2);\n edits.push({ range: [start, end], text: newRaw });\n }\n return edits;\n}\n\n/**\n * Like {@link buildClassnameEdits}, but when a JSX `className`/`class`\n * attribute's token list becomes empty, removes the whole attribute\n * (including a single run of preceding horizontal whitespace) instead of\n * writing `className=\"\"`.\n *\n * Non-JSX locations (cva/cn/clsx calls, `*ClassName` variables) still fall\n * through to an empty-string literal — deleting those would require\n * statement-level surgery we deliberately do not attempt here.\n */\nexport function buildEditsForLocation(\n location: ClassnameLocation,\n transform: (value: string) => string,\n sourceContent: string\n): Array<ClassnameEdit> {\n const { fixNode, context, reportNode } = location;\n\n if (\n context.type === \"jsx-attribute\" &&\n reportNode.type === AST_NODE_TYPES.JSXAttribute &&\n fixNode.type === AST_NODE_TYPES.Literal &&\n typeof fixNode.value === \"string\"\n ) {\n const newValue = transform(fixNode.value);\n if (newValue === fixNode.value) return [];\n if (newValue === \"\") {\n return [buildJsxAttributeRemovalEdit(reportNode, sourceContent)];\n }\n return [{ range: fixNode.range, text: quoteString(newValue, fixNode) }];\n }\n\n return buildClassnameEdits(fixNode, transform);\n}\n\n/**\n * Removes a JSX attribute, swallowing the horizontal whitespace immediately\n * before it so `<div className=\"x\">` becomes `<div>` rather than `<div >`.\n */\nfunction buildJsxAttributeRemovalEdit(attribute: TSESTree.JSXAttribute, sourceContent: string): ClassnameEdit {\n let start = attribute.range[0];\n while (start > 0 && /[ \\t]/.test(sourceContent[start - 1] ?? \"\")) {\n start -= 1;\n }\n return { range: [start, attribute.range[1]], text: \"\" };\n}\n\n/**\n * Applies a batch of range-based edits to `content`, splicing in\n * reverse-offset order so that an earlier edit's range is never invalidated\n * by one applied after it.\n */\nexport function applyEdits(content: string, edits: ReadonlyArray<ClassnameEdit>): string {\n const byDescendingStart = [...edits].sort((a, b) => b.range[0] - a.range[0]);\n\n let result = content;\n for (const edit of byDescendingStart) {\n const [start, end] = edit.range;\n result = result.slice(0, start) + edit.text + result.slice(end);\n }\n return result;\n}\n\nconst REWRITABLE_EXTENSIONS: Array<string> = [\".ts\", \".tsx\"];\n\n/**\n * Manifest files must never be mutated by a classname-rewriting migration\n * (a hard Success Criterion of GLU-1570). No in-repo extension currently\n * declares a `sourceRoot` that overlaps its own manifest file, but this\n * filename guard is defense-in-depth so that invariant doesn't depend\n * entirely on that data convention holding forever.\n */\nconst MANIFEST_FILENAME_PATTERN = /(^|\\/)(iris-app-manifest|extension-manifest)\\.ts$/;\n\n/**\n * `true` for `.ts`/`.tsx` files a classname-rewriting migration is allowed\n * to read/write — excludes `iris-app-manifest.ts`/`extension-manifest.ts`\n * files. Shared by every transform/report module in this codemod so the\n * file-extension allowlist and manifest exclusion live in exactly one place.\n */\nexport const isRewritableFile = (filePath: string): boolean =>\n REWRITABLE_EXTENSIONS.some(ext => filePath.endsWith(ext)) && !MANIFEST_FILENAME_PATTERN.test(filePath);\n\n/**\n * Walks every rewritable file under `sourceRoot`, and for files passing the\n * cheap `shouldConsider` substring pre-check, parses them, finds every\n * classname location, applies `transform` to each, and writes back any file\n * that actually changed.\n *\n * Shared by `rewritePageContent` and `removeRedundantPadding` so the\n * walk → pre-filter → parse → find → edit → write skeleton lives in exactly\n * one place instead of being duplicated per transform.\n */\nexport function transformClassnamesUnderSourceRoot(\n tree: Tree,\n sourceRoot: string,\n shouldConsider: (content: string) => boolean,\n transform: (value: string) => string\n): { filesChanged: Array<string> } {\n const filesChanged: Array<string> = [];\n\n visitNotIgnoredFiles(tree, sourceRoot, filePath => {\n if (!isRewritableFile(filePath)) return;\n\n const content = tree.read(filePath, \"utf-8\");\n if (content === null || !shouldConsider(content)) return;\n\n const program = parseTsestreeSource(content);\n const locations = findClassnameLocations(program);\n const edits = locations.flatMap(location => buildEditsForLocation(location, transform, content));\n if (edits.length === 0) return;\n\n tree.write(filePath, applyEdits(content, edits));\n filesChanged.push(filePath);\n });\n\n return { filesChanged };\n}\n\n/**\n * Read-only walk of every rewritable file under `sourceRoot`, invoking\n * `visitor` with each file's path and content. Never writes. Shared by\n * `findUnresolvedSurface`'s detection pass, which only needs to inspect\n * content, not rewrite it.\n */\nexport function visitRewritableFiles(\n tree: Tree,\n sourceRoot: string,\n visitor: (filePath: string, content: string) => void\n): void {\n visitNotIgnoredFiles(tree, sourceRoot, filePath => {\n if (!isRewritableFile(filePath)) return;\n const content = tree.read(filePath, \"utf-8\");\n if (content === null) return;\n visitor(filePath, content);\n });\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-extension-types.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app/migrations/utils/resolve-extension-types.ts"],"names":[],"mappings":";;AAsDA,sDA4DC;;AAlHD,uCAAqE;AACrE,uDAAiC;AAyCjC,MAAM,qBAAqB,GAAG,wCAAwC,CAAC;AACvE,MAAM,4BAA4B,GAAG,WAAW,CAAC;AAEjD;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CAAC,IAAU;IAC9C,MAAM,aAAa,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC9C,MAAM,cAAc,GAAG,IAAI,GAAG,EAA6B,CAAC;IAC5D,MAAM,UAAU,GAAqC,EAAE,CAAC;IAExD,IAAA,6BAAoB,EAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE;QAC5C,MAAM,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO;QAC3B,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACzB,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO;QAElC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC7C,IAAI,OAAO,KAAK,IAAI;YAAE,OAAO;QAE7B,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QAC1G,MAAM,cAAc,GAAG,iCAAiC,CAAC,UAAU,CAAC,CAAC;QACrE,IAAI,cAAc,KAAK,IAAI;YAAE,OAAO;QAEpC,MAAM,oBAAoB,GAAG,uBAAuB,CAAC,cAAc,EAAE,QAAQ,CA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AiB,CAAC,OAAO,CAAC,CAAC,CAAC;IAClD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,eAAM,CAAC,IAAI,CAAC,iEAAiE,OAAO,EAAE,CAAC,CAAC;QACxF,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE,CAAC;IAClD,KAAK,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzD,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,MAAM,KAAK,SAAS;YAAE,SAAS;QACnC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;GAMG;AACH,SAAS,iBAAiB,CAAC,OAAe;IACxC,OAAO,OAAO,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;AACrF,CAAC;AAED,SAAS,yBAAyB,CAAC,SAAiB;IAClD,OAAO,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AACxC,CAAC","sourcesContent":["import { logger, visitNotIgnoredFiles, type Tree } from \"@nx/devkit\";\nimport * as ts from \"typescript\";\n\nexport type ResolvedExtension = {\n /** The extension manifest's `id` field. */\n id: string;\n /** SCREAMING_SNAKE extension type discriminator, e.g. \"ADMIN_EXTENSION\". */\n type: string;\n /** Repo-relative source root for the extension, e.g. \"libs/administration/api-keys/src\". */\n sourceRoot: string;\n /** Repo-relative path to the resolved `extension-manifest.ts` file. */\n extensionManifestPath: string;\n /**\n * The extension manifest's entry component file, e.g. \"index.tsx\".\n * Optional so hand-written fixtures/tests don't need to set it; when\n * produced by `resolveExtensionTypes` it is always populated, defaulting\n * to `\"index.tsx\"` per `AbstractExtensionManifest.main`'s own documented\n * default when the manifest doesn't set it explicitly.\n */\n main?: string;\n /** App names (`apps/<name>`) that import this extension. Lets callers verify dedup. */\n ownerApps: Array<string>;\n};\n\nexport type UnresolvedExtensionImport = {\n /** The app (`apps/<name>`) that references the unresolvable specifier. */\n app: string;\n /** The module specifier that could not be resolved via `tsconfig.base.json` paths. */\n specifier: string;\n};\n\nexport type ResolveExtensionTypesResult = {\n resolved: Array<ResolvedExtension>;\n /**\n * Extensions referenced by an app's `extensions` array whose import\n * specifier could not be resolved to a file via `tsconfig.base.json`'s\n * `compilerOptions.paths`. Surfaced here instead of thrown, so a single\n * unresolvable/renamed package doesn't abort the whole migration.\n */\n unresolved: Array<UnresolvedExtensionImport>;\n};\n\nconst APPS_MANIFEST_PATTERN = /^apps\\/([^/]+)\\/iris-app-manifest\\.ts$/;\nconst DEFAULT_ENTRY_COMPONENT_FILE = \"index.tsx\";\n\n/**\n * Statically resolves every `apps/*\\/iris-app-manifest.ts`'s declared\n * `extensions` to a concrete `type` + `sourceRoot`, deduping extensions\n * shared by multiple apps into a single entry.\n *\n * Uses the TypeScript compiler API against the Nx `Tree` (not `fs`/dynamic\n * `import()`), so uncommitted edits held only in the Tree are seen and the\n * migration stays deterministic.\n */\nexport function resolveExtensionTypes(tree: Tree): ResolveExtensionTypesResult {\n const tsconfigPaths = readTsconfigPaths(tree);\n const resolvedByPath = new Map<string, ResolvedExtension>();\n const unresolved: Array<UnresolvedExtensionImport> = [];\n\n visitNotIgnoredFiles(tree, \"apps\", filePath => {\n const match = APPS_MANIFEST_PATTERN.exec(filePath);\n if (match === null) return;\n const appName = match[1];\n if (appName === undefined) return;\n\n const content = tree.read(filePath, \"utf-8\");\n if (content === null) return;\n\n const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const manifestObject = resolveDefaultExportObjectLiteral(sourceFile);\n if (manifestObject === null) return;\n\n const extensionIdentifiers = getExtensionIdentifiers(manifestObject, filePath);\n if (extensionIdentifiers.length === 0) return;\n\n const importSpecifiersByLocalName = getImportSpecifiersByLocalName(sourceFile);\n\n for (const identifierName of extensionIdentifiers) {\n const specifier = importSpecifiersByLocalName.get(identifierName);\n if (specifier === undefined) {\n logger.warn(\n `[resolve-extension-types] Could not find an import for \"${identifierName}\" referenced in ${filePath}'s extensions array.`\n );\n continue;\n }\n\n const extensionManifestPath = tsconfigPaths.get(specifier);\n if (extensionManifestPath === undefined) {\n logger.warn(\n `[resolve-extension-types] Could not resolve module specifier \"${specifier}\" (from ${filePath}) via tsconfig.base.json paths.`\n );\n unresolved.push({ app: appName, specifier });\n continue;\n }\n\n const existing = resolvedByPath.get(extensionManifestPath);\n if (existing !== undefined) {\n if (!existing.ownerApps.includes(appName)) existing.ownerApps.push(appName);\n continue;\n }\n\n const resolvedExtension = resolveExtensionManifest(tree, extensionManifestPath);\n if (resolvedExtension === null) {\n logger.warn(\n `[resolve-extension-types] Could not resolve extension manifest fields from \"${extensionManifestPath}\" (imported as \"${specifier}\" in ${filePath}).`\n );\n continue;\n }\n\n resolvedByPath.set(extensionManifestPath, { ...resolvedExtension, ownerApps: [appName] });\n }\n });\n\n return { resolved: [...resolvedByPath.values()], unresolved };\n}\n\nfunction resolveExtensionManifest(\n tree: Tree,\n extensionManifestPath: string\n): Omit<ResolvedExtension, \"ownerApps\"> | null {\n const content = tree.read(extensionManifestPath, \"utf-8\");\n if (content === null) return null;\n\n const sourceFile = ts.createSourceFile(\n extensionManifestPath,\n content,\n ts.ScriptTarget.Latest,\n true,\n ts.ScriptKind.TS\n );\n const extensionObject = resolveDefaultExportObjectLiteral(sourceFile);\n if (extensionObject === null) return null;\n\n const id = getStringLiteralProperty(extensionObject, \"id\");\n const type = getStringLiteralProperty(extensionObject, \"type\");\n const sourceRoot = getStringLiteralProperty(extensionObject, \"sourceRoot\");\n if (id === null || type === null || sourceRoot === null) return null;\n\n const main = getStringLiteralProperty(extensionObject, \"main\") ?? DEFAULT_ENTRY_COMPONENT_FILE;\n\n return { id, type, sourceRoot, extensionManifestPath, main };\n}\n\n/**\n * Finds the object literal behind `export default <expr>;`, following a\n * single level of identifier indirection (e.g. `const x = {...}; export\n * default x;`) since that's the shape every real manifest in this repo uses.\n */\nfunction resolveDefaultExportObjectLiteral(sourceFile: ts.SourceFile): ts.ObjectLiteralExpression | null {\n for (const statement of sourceFile.statements) {\n if (!ts.isExportAssignment(statement) || statement.isExportEquals) continue;\n const expr = statement.expression;\n if (ts.isObjectLiteralExpression(expr)) return expr;\n if (ts.isIdentifier(expr)) return findObjectLiteralVariable(sourceFile, expr.text);\n }\n return null;\n}\n\nfunction findObjectLiteralVariable(sourceFile: ts.SourceFile, name: string): ts.ObjectLiteralExpression | null {\n for (const statement of sourceFile.statements) {\n if (!ts.isVariableStatement(statement)) continue;\n for (const declaration of statement.declarationList.declarations) {\n if (!ts.isIdentifier(declaration.name) || declaration.name.text !== name) continue;\n if (declaration.initializer !== undefined && ts.isObjectLiteralExpression(declaration.initializer)) {\n return declaration.initializer;\n }\n }\n }\n return null;\n}\n\nfunction getExtensionIdentifiers(manifestObject: ts.ObjectLiteralExpression, filePath: string): Array<string> {\n for (const property of manifestObject.properties) {\n if (!ts.isPropertyAssignment(property)) continue;\n if (!ts.isIdentifier(property.name) || property.name.text !== \"extensions\") continue;\n if (!ts.isArrayLiteralExpression(property.initializer)) return [];\n\n const identifiers: Array<string> = [];\n for (const element of property.initializer.elements) {\n if (ts.isIdentifier(element)) {\n identifiers.push(element.text);\n } else {\n logger.warn(\n `[resolve-extension-types] Skipping a non-identifier element of the \"extensions\" array in ${filePath} (only \\`import x from \"...\"\\`-style identifiers can be statically resolved).`\n );\n }\n }\n return identifiers;\n }\n return [];\n}\n\nfunction getImportSpecifiersByLocalName(sourceFile: ts.SourceFile): Map<string, string> {\n const result = new Map<string, string>();\n for (const statement of sourceFile.statements) {\n if (!ts.isImportDeclaration(statement)) continue;\n const moduleSpecifier = statement.moduleSpecifier;\n if (!ts.isStringLiteral(moduleSpecifier)) continue;\n const specifier = moduleSpecifier.text;\n\n const importClause = statement.importClause;\n if (importClause === undefined) continue;\n\n if (importClause.name !== undefined) {\n result.set(importClause.name.text, specifier);\n }\n\n const namedBindings = importClause.namedBindings;\n if (namedBindings !== undefined && ts.isNamedImports(namedBindings)) {\n for (const element of namedBindings.elements) {\n result.set(element.name.text, specifier);\n }\n }\n }\n return result;\n}\n\nfunction getStringLiteralProperty(objectLiteral: ts.ObjectLiteralExpression, propertyName: string): string | null {\n for (const property of objectLiteral.properties) {\n if (!ts.isPropertyAssignment(property)) continue;\n if (!ts.isIdentifier(property.name) || property.name.text !== propertyName) continue;\n return ts.isStringLiteral(property.initializer) ? property.initializer.text : null;\n }\n return null;\n}\n\ntype TsconfigPaths = { compilerOptions?: { paths?: Record<string, Array<string>> } };\n\nfunction readTsconfigPaths(tree: Tree): Map<string, string> {\n const result = new Map<string, string>();\n const content = tree.read(\"tsconfig.base.json\", \"utf-8\");\n if (content === null) {\n logger.warn(\"[resolve-extension-types] tsconfig.base.json not found; no extension imports will resolve.\");\n return result;\n }\n\n let parsed: TsconfigPaths;\n try {\n parsed = JSON.parse(stripJsonComments(content));\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.warn(`[resolve-extension-types] Failed to parse tsconfig.base.json: ${message}`);\n return result;\n }\n\n const paths = parsed.compilerOptions?.paths ?? {};\n for (const [specifier, targets] of Object.entries(paths)) {\n const target = targets[0];\n if (target === undefined) continue;\n result.set(specifier, normalizeRepoRelativePath(target));\n }\n return result;\n}\n\n/**\n * `tsconfig.base.json` is committed without comments today, but strip\n * line comments and block comments defensively in case that changes, so a\n * stray comment doesn't hard-fail `JSON.parse`. The line-comment regex\n * requires the preceding character not be `:` so it doesn't mangle URL-like\n * string values (e.g. `\"https://...\"`).\n */\nfunction stripJsonComments(content: string): string {\n return content.replace(/\\/\\*[\\s\\S]*?\\*\\//g, \"\").replace(/(^|[^:])\\/\\/.*$/gm, \"$1\");\n}\n\nfunction normalizeRepoRelativePath(pathValue: string): string {\n return pathValue.replace(/^\\.\\//, \"\");\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/submit/executor.ts"],"names":[],"mappings":";;AAyIA,8BAqCC;;AA5KD,+CAA4C;AAC5C,kFAA0E;AAC1E,8DAAwC;AACxC,uDAAiC;AACjC,gEAAgC;AAChC,mCAAgC;AAChC,4DAAyD;AACzD,0EAAuE;AAGvE,+FAA+F;AAC/F,IAAA,eAAM,EAAC,GAAG,CAAC,CAAC;AASZ,MAAM,gBAAiB,SAAQ,KAAK;CAAG;AAEvC,MAAM,eAAgB,SAAQ,KAAK;IACjC,YACE,OAAe,EACC,UAAmB,EACnB,IAAa,EACb,IAAa;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,eAAU,GAAV,UAAU,CAAS;QACnB,SAAI,GAAJ,IAAI,CAAS;QACb,SAAI,GAAJ,IAAI,CAAS;IAG/B,CAAC;CACF;AAED,MAAM,YAAa,SAAQ,KAAK;IAC9B,YACE,OAAe,EACC,UAAmB,EACnB,IAAa;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,eAAU,GAAV,UAAU,CAAS;QACnB,SAAI,GAAJ,IAAI,CAAS;IAG/B,CAAC;CACF;AAED,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,gFAAgF;AAChF,gFAAgF;AAChF,kFAAkF;AAClF,6EAA6E;AAC7E,+E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AAK,MAAM,aAAa,CAAC,IAAI,EAAE,eAAe,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,EAChH,aAAa,CAAC,MAAM,CACrB,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;AACH,CAAC","sourcesContent":["/* eslint-disable no-console */\nimport { PackageJson } from \"@npm/types\";\nimport { Arborist } from \"@npmcli/arborist\";\nimport { checkPackageVersion } from \"@trackunit/iris-app-build-utilities\";\nimport * as libpub from \"libnpmpublish\";\nimport * as pacote from \"pacote\";\nimport readline from \"readline\";\nimport { inject } from \"win-ca\";\nimport { getAccessToken } from \"../utils/authentication\";\nimport { getSettings, Settings } from \"../utils/irisAppServerSettings\";\nimport { SubmitExecutorSchema } from \"./schema\";\n\n// Inject Windows trusted certificates to support Zscalar and other traffic inspection systems.\ninject(\"+\");\n\ntype SubmitError = Error & {\n statusCode?: number;\n code?: string;\n type?: string;\n headers?: { [key: string]: string };\n};\n\nclass NpmConflictError extends Error {}\n\nclass NpmGeneralError extends Error {\n public constructor(\n message: string,\n public readonly statusCode?: number,\n public readonly code?: string,\n public readonly type?: string\n ) {\n super(message);\n }\n}\n\nclass ApproveError extends Error {\n public constructor(\n message: string,\n public readonly statusCode?: number,\n public readonly code?: string\n ) {\n super(message);\n }\n}\n\nfunction sleep(time: number) {\n return new Promise(resolve => setTimeout(resolve, time));\n}\n\n// Errno-style codes that indicate the request never reached the registry at all\n// (DNS/connection/timeout failures at the transport layer), as opposed to local\n// validation errors (e.g. libnpmpublish's EPRIVATE/EBADSEMVER/EUSAGE) which carry\n// a code but are permanent and can never succeed on retry. Kept aligned with\n// make-fetch-happen's own RETRY_ERRORS list (used by the submit path) plus the\n// undici error codes doApproveApp's native fetch can raise.\n//\n// ENOTFOUND (DNS failure) is deliberately included even though make-fetch-happen\n// itself excludes it as \"bad hostname, or offline\" - a DNS blip during a VPN/\n// network transition is common enough in practice that failing fast here would\n// trade one wasted-wait problem for developers hitting spurious permanent\n// failures on flaky networks. This is a judgment call, not a clear-cut default.\nconst RETRYABLE_TRANSPORT_CODES = new Set([\n \"ENOTFOUND\",\n \"ECONNRESET\",\n \"ECONNREFUSED\",\n \"ETIMEDOUT\",\n \"EAI_AGAIN\",\n \"ERR_SOCKET_TIMEOUT\",\n \"EADDRINUSE\",\n // from @npmcli/agent, surfaced through make-fetch-happen\n \"ECONNECTIONTIMEOUT\",\n \"EIDLETIMEOUT\",\n \"ERESPONSETIMEOUT\",\n \"ETRANSFERTIMEOUT\",\n // doApproveApp uses Node's native fetch (undici), which raises its own\n // codes distinct from the classic Node errno codes above.\n \"UND_ERR_CONNECT_TIMEOUT\",\n \"UND_ERR_HEADERS_TIMEOUT\",\n \"UND_ERR_BODY_TIMEOUT\",\n \"UND_ERR_SOCKET\", // e.g. \"other side closed\" on a reused keep-alive connection\n]);\n\n/**\n * Decide whether a failed submit/approve attempt is worth retrying.\n *\n * This is an allowlist, not a denylist: only failures with a real chance of\n * succeeding on a later attempt are retried - 5xx responses, 408/429 (timeout/\n * rate-limited), a transport-level failure that never reached the registry at\n * all (identified by a known transient errno code), or a minipass-fetch request\n * timeout (which surfaces with the generic code FETCH_ERROR, distinguishable\n * only via its `type: \"request-timeout\"`). Everything else - permanent 4xx\n * errors, local validation errors with an unrelated code (e.g. EBADSEMVER), or\n * any other unrecognized error shape - is treated as non-retryable by default.\n *\n * @param {number} [statusCode] The HTTP status code of the failed attempt, if any.\n * @param {string} [code] The error's errno-style code, if any (no statusCode implies no HTTP response was received).\n * @param {string} [type] The error's `type` field, if any. Only consulted when `code === \"FETCH_ERROR\"`, since that's the one code minipass-fetch's FetchError uses generically for several failure kinds - `type` is what distinguishes a timeout from the others.\n * @returns {boolean} Whether the attempt should be retried.\n */\nfunction isRetryableError(statusCode?: number, code?: string, type?: string): boolean {\n if (statusCode !== undefined) {\n return statusCode >= 500 || statusCode === 408 || statusCode === 429;\n }\n if (code === undefined) {\n return false;\n }\n return RETRYABLE_TRANSPORT_CODES.has(code) || (code === \"FETCH_ERROR\" && type === \"request-timeout\");\n}\n\n/**\n * Older iris-app-sdk-server releases answer a failed outbound fetch of their own with\n * 400 `{ error: \"fetch failed\" }`, which npm-registry-fetch appends to the message as \" - fetch failed\".\n * That is a transient server-side failure, not a rejected package.\n *\n * @param {NpmGeneralError} error The failed upload attempt.\n * @returns {boolean} Whether the attempt should be retried.\n */\nfunction isRetryableUploadError(error: NpmGeneralError): boolean {\n if (error.statusCode === 400 && error.message.includes(\" - fetch failed.\")) {\n return true;\n }\n return isRetryableError(error.statusCode, error.code, error.type);\n}\n\nfunction isRetryableApproveError(statusCode?: number, code?: string, type?: string): boolean {\n // Same as isRetryableError but also accept 404 for approvals.\n // 404 can happen spuriously on approval\n return (statusCode !== undefined && statusCode === 404) || isRetryableError(statusCode, code, type);\n}\n\n/**\n * Submit the package to the npm registry.\n *\n * @param {SubmitExecutorSchema} options The options provided to the executor.\n * @returns {Promise<{ success: boolean }>} The result of the submit.\n * @throws {Error} When `@trackunit/*` dependencies are a major version behind or cannot be looked up; nothing is published.\n */\nexport default async function runExecutor(options: SubmitExecutorSchema) {\n await checkPackageVersion({ report: true, block: true });\n const settings = getSettings();\n const linkToTerms = \"https://trackunit.com/terms-conditions-marketplace/\";\n\n try {\n if (options.devTermsAndConditions?.toLowerCase() !== \"accept\" && !settings.devTermsAccept) {\n // Ask user if they accept dev terms and conditions.\n const userInput = await promptUserForInput(\n `Do you accept the developer terms and conditions? \\n(${linkToTerms}) \\n\\n 📝 Type 'accept' to proceed: `\n );\n if (userInput.toLowerCase() !== \"accept\") {\n throw new Error(`You must accept the developer terms and conditions (${linkToTerms}) to continue.`);\n }\n }\n const tokenData = await getAccessToken(settings.env);\n\n if (\"access_token\" in tokenData) {\n console.log(\"🥳 Successfully authenticated.\");\n\n const manifest = (await pacote.manifest(options.inputPath)) as PackageJson;\n const tarData = await pacote.tarball(options.inputPath, { Arborist });\n\n return await doUploadAppWithRetry(tokenData.access_token, manifest, tarData, settings, 10);\n } else if (\"error\" in tokenData) {\n if (tokenData.error === \"expired_token\") {\n throw new Error(\"⌛️ Authentication attempt expired\");\n } else {\n throw new Error(`Error occurred: ${tokenData.error} ${tokenData.error_description}`);\n }\n } else {\n throw new Error(\"Unknown error occurred\");\n }\n } catch (e) {\n console.error(\"❌ \", e);\n return { success: false };\n }\n}\n\nasync function doUploadAppWithRetry(\n accessToken: string,\n manifest: PackageJson,\n tarData: Buffer & pacote.FetchResult,\n settings: Settings,\n retryCount: number\n): Promise<{ success: boolean }> {\n try {\n return await doUploadApp(accessToken, manifest, tarData, settings);\n } catch (e) {\n if (e instanceof NpmConflictError) {\n console.error(\"❌ Unable to ship app package. Cannot submit over existing version.\");\n return { success: false };\n }\n\n if (!(e instanceof NpmGeneralError)) {\n // An error shape we don't recognize (e.g. a bug elsewhere in this function) -\n // log the full error/stack rather than a bare message so it stays debuggable.\n console.error(\"❌ Unable to ship app package. Got error from Iris App SDK repository.\", e);\n return { success: false };\n }\n\n if (!isRetryableUploadError(e)) {\n console.error(\"❌ Unable to ship app package.\", e.message);\n return { success: false };\n }\n\n if (retryCount > 1) {\n console.error(\n \"⚠️ Unable to ship app package. Got error from Iris App SDK repository. Retrying submit...\",\n e.message\n );\n await sleep(30000);\n return await doUploadAppWithRetry(accessToken, manifest, tarData, settings, retryCount - 1);\n } else {\n console.error(\"❌ Unable to ship app package. Got error from Iris App SDK repository.\", e.message);\n return { success: false };\n }\n }\n}\n\nasync function doUploadApp(\n accessToken: string,\n manifest: PackageJson,\n tarData: Buffer & pacote.FetchResult,\n settings: Settings\n): Promise<{ success: boolean }> {\n const npmFetchOptions: { registry?: string } & Record<string, string | boolean> = {};\n npmFetchOptions.registry = settings.repoUrl.toString();\n const repoHostAndPort = settings.repoUrl.hostname + (settings.repoUrl.port ? `:${settings.repoUrl.port}` : \"\");\n npmFetchOptions[`//${repoHostAndPort}${settings.repoUrl.pathname}:_authToken`] = accessToken;\n npmFetchOptions[`//${repoHostAndPort}${settings.repoUrl.pathname}/repo/:always-auth`] = true;\n\n console.log(\"🚢 Shipping the app package...\");\n const submitResult = await libpub.publish(manifest, tarData, npmFetchOptions).catch((err: SubmitError) => {\n if (err.statusCode === 409 || err.code === \"E409\" || err.code === \"EPUBLISHCONFLICT\") {\n return {\n ok: false,\n submitConflict: true,\n };\n } else {\n return {\n ok: false,\n statusCode: err.statusCode,\n code: err.code,\n type: err.type,\n headers: new Headers(err.headers),\n statusText: `Error`,\n text: () => Promise.resolve(`${err.name} ${err.message}`),\n };\n }\n });\n\n const warningsText = submitResult.headers?.get(\"TU-IRIS-APP-WARNINGS\");\n if (warningsText) {\n console.log(`⚠️ ${decodeURI(warningsText)}`);\n }\n\n if (submitResult.ok) {\n console.log(`🚀 Uploaded the app package version ${manifest.version}`);\n\n return await doApproveAppWithRetry(accessToken, manifest, settings, 3);\n } else if (\"submitConflict\" in submitResult) {\n if (process.env.SKIP_EXISTING === \"true\") {\n console.log(`⏩ Skipped submitting ${manifest.version} because the version is already submitted`);\n return await doApproveAppWithRetry(accessToken, manifest, settings, 3);\n } else {\n throw new NpmConflictError();\n }\n } else {\n throw new NpmGeneralError(\n `${submitResult.statusText} ${await submitResult.text()}. Trace ID: ${submitResult.headers.get(\"trace-id\")}`,\n \"statusCode\" in submitResult ? submitResult.statusCode : undefined,\n \"code\" in submitResult ? submitResult.code : undefined,\n \"type\" in submitResult ? submitResult.type : undefined\n );\n }\n}\n\nasync function promptUserForInput(query: string): Promise<string> {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n\n return new Promise(resolve => {\n rl.question(query, (input: string) => {\n rl.close();\n resolve(input);\n });\n });\n}\n\nasync function doApproveAppWithRetry(\n token: string,\n manifest: PackageJson,\n settings: Settings,\n retryCount: number\n): Promise<{ success: boolean }> {\n try {\n return await doApproveApp(token, manifest, settings);\n } catch (e) {\n if (!(e instanceof ApproveError)) {\n console.error(\"❌ Unable to approve app package. Got error from Iris App SDK repository.\", e);\n return { success: false };\n }\n\n if (!isRetryableApproveError(e.statusCode, e.code)) {\n console.error(\"❌ Unable to approve app package.\", e.message);\n return { success: false };\n }\n\n if (retryCount > 1) {\n console.error(\n \"⚠️ Unable to approve app package. Got approve error from Iris App SDK repository. Retrying approve...\",\n e.message\n );\n await sleep(30000);\n return await doApproveAppWithRetry(token, manifest, settings, retryCount - 1);\n } else {\n console.error(\"❌ Unable to approve app package. Got approve error from Iris App SDK repository.\", e.message);\n return { success: false };\n }\n }\n}\n\nasync function doApproveApp(token: string, manifest: PackageJson, settings: Settings) {\n if (process.env.TU_APPROVE === \"true\") {\n console.log(`🖋️ Approving the app...`);\n // A rejection here (e.g. DNS/connection/timeout failure) never produced an HTTP\n // response, so it's re-thrown as an ApproveError with no statusCode - carrying\n // the underlying cause's errno code (if any) so isRetryableError can recognize\n // genuine transport failures, and the cause's message so the log doesn't just\n // say \"fetch failed\" with no indication of what actually broke.\n const approveResult = await fetch(new URL(`${manifest.name}@${manifest.version}`, settings.approvalUrl), {\n method: \"PUT\",\n headers: {\n Authorization: `Bearer ${token}`,\n },\n }).catch((err: Error) => {\n const cause = err.cause instanceof Error ? err.cause : undefined;\n const causeCode = cause && \"code\" in cause ? (cause as NodeJS.ErrnoException).code : undefined;\n const code = typeof causeCode === \"string\" ? causeCode : undefined;\n const reason = cause ? `${err.message}: ${cause.message}` : err.message;\n throw new ApproveError(reason, undefined, code);\n });\n\n if (approveResult.ok) {\n console.log(`✅ Approved version ${manifest.version} of ${manifest.name}.`);\n return { success: true };\n } else {\n throw new ApproveError(\n `${approveResult.statusText}, ${await approveResult.text()}, Trace ID: ${approveResult.headers.get(\"trace-id\")}`,\n approveResult.status\n );\n }\n } else {\n return { success: true };\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/unpublish/executor.ts"],"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,eAAe,CAAC,UAAU,eAAe,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;gBAC3G,CAAC;YACH,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;YAChD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC3B,CAAC;aAAM,IAAI,OAAO,IAAI,SAAS,EAAE,CAAC;YAChC,IAAI,SAAS,CAAC,KAAK,KAAK,eAAe,EAAE,CAAC;gBACxC,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;YACvD,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,mBAAmB,SAAS,CAAC,KAAK,IAAI,SAAS,CAAC,iBAAiB,EAAE,CAAC,CAAC;YACvF,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACvB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC","sourcesContent":["/* eslint-disable no-console */\nimport { PackageJson } from \"nx/src/utils/package-json\";\nimport * as pacote from \"pacote\";\nimport \"win-ca\";\nimport { getAccessToken } from \"../utils/authentication\";\nimport { getSettings } from \"../utils/irisAppServerSettings\";\nimport { UnpublishExecutorSchema } from \"./schema\";\n\n/**\n * Unpublish an app from the Trackunit Marketplace.\n *\n * @param {UnpublishExecutorSchema} options options provided to the executor.\n * @returns {Promise<{ success: boolean }>} The result of the unpublish.\n */\nexport default async function runExecutor(options: UnpublishExecutorSchema) {\n const settings = getSettings();\n\n try {\n const tokenData = await getAccessToken(settings.env);\n\n if (\"access_token\" in tokenData) {\n console.log(\"🥳 Successfully authenticated.\");\n\n const manifest = (await pacote.manifest(options.inputPath)) as PackageJson;\n const unpublishResult = await fetch(new URL(manifest.name, settings.repoUrl), {\n method: \"DELETE\",\n headers: {\n Authorization: `Bearer ${tokenData.access_token}`,\n },\n });\n if (unpublishResult.status !== 200) {\n switch (unpublishResult.status) {\n case 401:\n throw new Error(\n `Unpublishing failed due to invalid credentials, Trace ID: ${unpublishResult.headers.get(\"trace-id\")}`\n );\n case 403:\n throw new Error(\n `You are not allowed to unpublish this app, Trace ID: ${unpublishResult.headers.get(\"trace-id\")}`\n );\n case 404:\n throw new Error(\n `The app you are trying to unpublish does not exist, Trace ID: ${unpublishResult.headers.get(\"trace-id\")}`\n );\n default:\n throw new Error(`${unpublishResult.statusText}, Trace ID: ${unpublishResult.headers.get(\"trace-id\")}`);\n }\n }\n\n console.log(\"🥳 Successfully unpublished app.\");\n return { success: true };\n } else if (\"error\" in tokenData) {\n if (tokenData.error === \"expired_token\") {\n throw new Error(\"⌛️ Authentication attempt expired\");\n } else {\n throw new Error(`Error occurred: ${tokenData.error} ${tokenData.error_description}`);\n }\n } else {\n throw new Error(\"Unknown error occurred\");\n }\n } catch (e) {\n console.error(\"❌ \", e);\n return { success: false };\n }\n}\n"]}
|