@litsx/babel-preset-litsx 0.3.0 → 0.4.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/dist/index.cjs +7 -1
- package/dist/index.cjs.map +1 -1
- package/dist/internal/transform-litsx-components.cjs +529 -586
- package/dist/internal/transform-litsx-components.cjs.map +1 -1
- package/dist/internal/transform-litsx-renderer-props.cjs +21 -5
- package/dist/internal/transform-litsx-renderer-props.cjs.map +1 -1
- package/dist/pipeline.cjs +8 -1
- package/dist/pipeline.cjs.map +1 -1
- package/dist/shared/transform-litsx-element-candidates-JMFlPFXK.cjs +1170 -0
- package/dist/shared/transform-litsx-element-candidates-JMFlPFXK.cjs.map +1 -0
- package/package.json +4 -2
- package/src/internal/transform-litsx-components.js +46 -231
- package/src/internal/transform-litsx-element-candidates.js +1173 -0
- package/src/internal/transform-litsx-param-rewrites.js +0 -71
- package/src/internal/transform-litsx-render-body.js +113 -0
- package/src/internal/transform-litsx-renderer-calls.js +92 -0
- package/src/internal/transform-litsx-renderer-props.js +13 -5
- package/src/pipeline.js +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform-litsx-element-candidates-JMFlPFXK.cjs","sources":["../../src/internal/transform-litsx-element-candidates.js"],"sourcesContent":["import helperPluginUtils from \"@babel/helper-plugin-utils\";\nimport babelTraverse from \"@babel/traverse\";\nimport jsxSyntaxPlugin from \"@babel/plugin-syntax-jsx\";\nimport parser from \"@litsx/babel-parser\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { normalizeFilePath } from \"@litsx/typescript-session\";\nimport { ensureTypescriptModule } from \"./transform-litsx-properties.js\";\n\nconst { declare } = helperPluginUtils;\nconst traverse = babelTraverse.default || babelTraverse;\nconst IMPORT_RESOLUTION_EXTENSIONS = [\n \".litsx\",\n \".litsx.jsx\",\n \".jsx\",\n \".js\",\n \".tsx\",\n \".ts\",\n];\nconst DEFAULT_MODULE_RESOLUTION_OPTIONS = {\n moduleResolution: 100,\n allowJs: true,\n checkJs: false,\n jsx: 1,\n target: 99,\n module: 99,\n esModuleInterop: true,\n allowSyntheticDefaultImports: true,\n};\n\nlet t;\n\nexport function setElementCandidatesBabelTypes(nextTypes) {\n t = nextTypes;\n}\n\nfunction isInsideFunctionOrClass(path) {\n return path.findParent(\n (p) =>\n p.isFunctionDeclaration() ||\n p.isFunctionExpression() ||\n p.isArrowFunctionExpression() ||\n p.isClassDeclaration()\n );\n}\n\nfunction isRelativeSpecifier(value) {\n return typeof value === \"string\" && (\n value.startsWith(\"./\") ||\n value.startsWith(\"../\") ||\n value.startsWith(\"/\")\n );\n}\n\nfunction createEmptyCandidateResult() {\n return {\n localCandidates: new Set(),\n importedCandidates: new Map(),\n };\n}\n\nfunction cloneCandidateResult(result) {\n return {\n localCandidates: new Set(result?.localCandidates || []),\n importedCandidates: new Map(result?.importedCandidates || []),\n };\n}\n\nfunction mergeCandidateResults(target, source) {\n source.localCandidates.forEach((candidate) => target.localCandidates.add(candidate));\n source.importedCandidates.forEach((candidate, key) => {\n if (!target.importedCandidates.has(key)) {\n target.importedCandidates.set(key, candidate);\n }\n });\n}\n\nfunction toImportRecordKey(record) {\n return `${record.sourceFile}:${record.importedName}:${record.tagName}`;\n}\n\nfunction toRelativeModuleSpecifier(fromFilename, targetFilename) {\n const fromDir = path.dirname(fromFilename);\n let relativePath = normalizeFilePath(path.relative(fromDir, targetFilename));\n\n if (!relativePath.startsWith(\".\") && !relativePath.startsWith(\"/\")) {\n relativePath = `./${relativePath}`;\n }\n\n return relativePath;\n}\n\nfunction hasSupportedExtension(filePath) {\n return IMPORT_RESOLUTION_EXTENSIONS.some((extension) => filePath.endsWith(extension));\n}\n\nfunction resolveImportSource(fromFilename, sourceValue, context) {\n const cacheKey = `${normalizeFilePath(fromFilename)}::${sourceValue}`;\n if (context.resolvedImportCache.has(cacheKey)) {\n return context.resolvedImportCache.get(cacheKey);\n }\n\n const existingFile = (candidatePath) => {\n try {\n return fs.existsSync(candidatePath) && fs.statSync(candidatePath).isFile();\n } catch {\n return false;\n }\n };\n\n const resolveWithExtensions = (basePath) => {\n const normalizedBasePath = normalizeFilePath(basePath);\n const candidates = [];\n\n if (hasSupportedExtension(normalizedBasePath)) {\n candidates.push(normalizedBasePath);\n } else {\n IMPORT_RESOLUTION_EXTENSIONS.forEach((extension) => {\n candidates.push(`${normalizedBasePath}${extension}`);\n });\n IMPORT_RESOLUTION_EXTENSIONS.forEach((extension) => {\n candidates.push(normalizeFilePath(path.join(normalizedBasePath, `index${extension}`)));\n });\n }\n\n return candidates.find(existingFile) || null;\n };\n\n const resolvePathAlias = () => {\n const compilerOptions = context.getCompilerOptions?.(fromFilename) || {};\n const baseUrl = compilerOptions.baseUrl\n ? normalizeFilePath(\n path.isAbsolute(compilerOptions.baseUrl)\n ? compilerOptions.baseUrl\n : path.resolve(path.dirname(fromFilename), compilerOptions.baseUrl)\n )\n : normalizeFilePath(path.dirname(fromFilename));\n const pathMappings = compilerOptions.paths || {};\n\n for (const [pattern, substitutions] of Object.entries(pathMappings)) {\n const starIndex = pattern.indexOf(\"*\");\n const isStarPattern = starIndex !== -1;\n const prefix = isStarPattern ? pattern.slice(0, starIndex) : pattern;\n const suffix = isStarPattern ? pattern.slice(starIndex + 1) : \"\";\n\n if (isStarPattern) {\n if (!sourceValue.startsWith(prefix) || !sourceValue.endsWith(suffix)) {\n continue;\n }\n } else if (sourceValue !== pattern) {\n continue;\n }\n\n const wildcardValue = isStarPattern\n ? sourceValue.slice(prefix.length, sourceValue.length - suffix.length)\n : \"\";\n\n for (const substitution of substitutions || []) {\n const substituted = isStarPattern\n ? substitution.replace(\"*\", wildcardValue)\n : substitution;\n const candidateBase = path.isAbsolute(substituted)\n ? substituted\n : path.join(baseUrl, substituted);\n const resolvedPath = resolveWithExtensions(candidateBase);\n if (resolvedPath) {\n return resolvedPath;\n }\n }\n }\n\n return null;\n };\n\n let resolved = null;\n if (fromFilename && isRelativeSpecifier(sourceValue)) {\n resolved = resolveWithExtensions(\n path.resolve(path.dirname(fromFilename), sourceValue)\n );\n } else if (fromFilename) {\n resolved = resolvePathAlias();\n if (!resolved) {\n const ts = ensureTypescriptModule();\n const compilerOptions = context.getCompilerOptions?.(fromFilename) || DEFAULT_MODULE_RESOLUTION_OPTIONS;\n const moduleResolutionHost = context.getModuleResolutionHost?.(fromFilename) || ts.sys;\n try {\n const resolution = ts.resolveModuleName(\n sourceValue,\n normalizeFilePath(fromFilename),\n compilerOptions,\n moduleResolutionHost\n );\n const resolvedFileName = resolution?.resolvedModule?.resolvedFileName;\n if (resolvedFileName) {\n resolved = resolveWithExtensions(resolvedFileName) || normalizeFilePath(resolvedFileName);\n }\n } catch {\n resolved = null;\n }\n }\n }\n\n context.resolvedImportCache.set(cacheKey, resolved);\n return resolved;\n}\n\nfunction createCompilerContextResolver(options = {}) {\n const providedTypescriptSession =\n options?.typescriptSession?.projectSession || options?.typescriptSession || null;\n\n const compilerOptionsCache = new Map();\n const moduleResolutionHostCache = new Map();\n\n function getProgramForFile(filename) {\n if (!providedTypescriptSession?.getProgram || !filename) {\n return null;\n }\n\n try {\n if (providedTypescriptSession.kind === \"project\") {\n return providedTypescriptSession.getProgram();\n }\n\n if (providedTypescriptSession.kind === \"standalone\") {\n return providedTypescriptSession.getProgram(normalizeFilePath(filename));\n }\n } catch {\n return null;\n }\n\n return null;\n }\n\n return {\n getCompilerOptions(filename) {\n const cacheKey = normalizeFilePath(filename);\n if (compilerOptionsCache.has(cacheKey)) {\n return compilerOptionsCache.get(cacheKey);\n }\n\n const program = getProgramForFile(filename);\n const compilerOptions = program?.getCompilerOptions?.() || DEFAULT_MODULE_RESOLUTION_OPTIONS;\n compilerOptionsCache.set(cacheKey, compilerOptions);\n return compilerOptions;\n },\n getModuleResolutionHost(filename) {\n const cacheKey = normalizeFilePath(filename);\n if (moduleResolutionHostCache.has(cacheKey)) {\n return moduleResolutionHostCache.get(cacheKey);\n }\n\n const ts = ensureTypescriptModule();\n const program = getProgramForFile(filename);\n const host = providedTypescriptSession?.host || ts.sys;\n moduleResolutionHostCache.set(cacheKey, host);\n return host;\n },\n };\n}\n\nfunction getOrCreateAvailableNames(programPath) {\n const cached = programPath.getData(\"__litsxAvailableNames\");\n if (cached) {\n return cached;\n }\n\n const availableNames = new Set();\n programPath.get(\"body\").forEach((nodePath) => {\n if (nodePath.isImportDeclaration()) {\n nodePath.node.specifiers.forEach((specifier) => {\n if (specifier.local?.name) {\n availableNames.add(specifier.local.name);\n }\n });\n return;\n }\n\n if (nodePath.isClassDeclaration() && nodePath.node.id?.name) {\n availableNames.add(nodePath.node.id.name);\n return;\n }\n\n if (\n (nodePath.isExportNamedDeclaration() || nodePath.isExportDefaultDeclaration()) &&\n nodePath.get(\"declaration\")?.isClassDeclaration?.() &&\n nodePath.node.declaration?.id?.name\n ) {\n availableNames.add(nodePath.node.declaration.id.name);\n return;\n }\n\n if (nodePath.isFunctionDeclaration() && nodePath.node.id?.name) {\n availableNames.add(nodePath.node.id.name);\n return;\n }\n\n if (\n (nodePath.isExportNamedDeclaration() || nodePath.isExportDefaultDeclaration()) &&\n nodePath.get(\"declaration\")?.isFunctionDeclaration?.() &&\n nodePath.node.declaration?.id?.name\n ) {\n availableNames.add(nodePath.node.declaration.id.name);\n return;\n }\n\n if (\n (nodePath.isExportNamedDeclaration() || nodePath.isExportDefaultDeclaration()) &&\n nodePath.get(\"declaration\")?.isVariableDeclaration?.()\n ) {\n nodePath.get(\"declaration.declarations\").forEach((declaratorPath) => {\n const declarator = declaratorPath.node;\n if (t.isIdentifier(declarator.id)) {\n availableNames.add(declarator.id.name);\n }\n });\n return;\n }\n\n if (!nodePath.isVariableDeclaration()) return;\n nodePath.get(\"declarations\").forEach((declaratorPath) => {\n const declarator = declaratorPath.node;\n if (t.isIdentifier(declarator.id)) {\n availableNames.add(declarator.id.name);\n }\n });\n });\n\n programPath.setData(\"__litsxAvailableNames\", availableNames);\n return availableNames;\n}\n\nfunction getOrCreateHelperPaths(programPath) {\n const cached = programPath.getData(\"__litsxHelperPaths\");\n if (cached) {\n return cached;\n }\n\n const helperPaths = new Map();\n programPath.get(\"body\").forEach((nodePath) => {\n if (nodePath.isFunctionDeclaration() && nodePath.node.id?.name) {\n helperPaths.set(nodePath.node.id.name, nodePath);\n return;\n }\n\n if (\n (nodePath.isExportNamedDeclaration() || nodePath.isExportDefaultDeclaration()) &&\n nodePath.get(\"declaration\")?.isFunctionDeclaration?.() &&\n nodePath.node.declaration?.id?.name\n ) {\n helperPaths.set(nodePath.node.declaration.id.name, nodePath.get(\"declaration\"));\n return;\n }\n\n if (\n (nodePath.isExportNamedDeclaration() || nodePath.isExportDefaultDeclaration()) &&\n nodePath.get(\"declaration\")?.isVariableDeclaration?.()\n ) {\n nodePath.get(\"declaration.declarations\").forEach((declaratorPath) => {\n const declarator = declaratorPath.node;\n if (!t.isIdentifier(declarator.id)) {\n return;\n }\n\n const initPath = declaratorPath.get(\"init\");\n if (\n initPath?.isArrowFunctionExpression?.() ||\n initPath?.isFunctionExpression?.()\n ) {\n helperPaths.set(declarator.id.name, initPath);\n }\n });\n return;\n }\n\n if (!nodePath.isVariableDeclaration()) return;\n nodePath.get(\"declarations\").forEach((declaratorPath) => {\n const declarator = declaratorPath.node;\n if (!t.isIdentifier(declarator.id)) {\n return;\n }\n\n const initPath = declaratorPath.get(\"init\");\n if (\n initPath?.isArrowFunctionExpression?.() ||\n initPath?.isFunctionExpression?.()\n ) {\n helperPaths.set(declarator.id.name, initPath);\n }\n });\n });\n\n programPath.setData(\"__litsxHelperPaths\", helperPaths);\n return helperPaths;\n}\n\nfunction buildModuleAnalysis(programPath, filename, context) {\n const availableNames = getOrCreateAvailableNames(programPath);\n const helperPaths = getOrCreateHelperPaths(programPath);\n const importBindings = new Map();\n const exportBindings = new Map();\n\n programPath.get(\"body\").forEach((nodePath) => {\n if (nodePath.isImportDeclaration()) {\n const sourceValue = nodePath.node.source.value;\n const resolvedSource = resolveImportSource(filename, sourceValue, context);\n\n nodePath.node.specifiers.forEach((specifier) => {\n if (!specifier.local?.name) {\n return;\n }\n\n let importedName = null;\n if (specifier.type === \"ImportDefaultSpecifier\") {\n importedName = \"default\";\n } else if (specifier.type === \"ImportSpecifier\") {\n importedName = specifier.imported?.name ?? specifier.imported?.value ?? null;\n } else if (specifier.type === \"ImportNamespaceSpecifier\") {\n importedName = \"*\";\n }\n\n importBindings.set(specifier.local.name, {\n localName: specifier.local.name,\n importedName,\n sourceValue,\n resolvedSource,\n });\n });\n\n return;\n }\n\n if (nodePath.isExportNamedDeclaration()) {\n const declarationPath = nodePath.get(\"declaration\");\n if (declarationPath?.node) {\n if (declarationPath.isFunctionDeclaration() || declarationPath.isClassDeclaration()) {\n const localName = declarationPath.node.id?.name;\n if (localName) {\n exportBindings.set(localName, { localName });\n }\n } else if (declarationPath.isVariableDeclaration()) {\n declarationPath.get(\"declarations\").forEach((declaratorPath) => {\n const localName = declaratorPath.node.id?.name;\n if (localName) {\n exportBindings.set(localName, { localName });\n }\n });\n }\n }\n\n nodePath.get(\"specifiers\").forEach((specifierPath) => {\n const exportedName =\n specifierPath.node.exported?.name ?? specifierPath.node.exported?.value ?? null;\n if (!exportedName) {\n return;\n }\n\n const sourceValue = nodePath.node.source?.value ?? null;\n if (sourceValue) {\n const localName =\n specifierPath.node.local?.name ?? specifierPath.node.local?.value ?? exportedName;\n exportBindings.set(exportedName, {\n reexportSource: resolveImportSource(filename, sourceValue, context),\n importedName: localName === \"default\" ? \"default\" : localName,\n });\n return;\n }\n\n const localName =\n specifierPath.node.local?.name ?? specifierPath.node.local?.value ?? null;\n if (localName) {\n exportBindings.set(exportedName, { localName });\n }\n });\n\n return;\n }\n\n if (!nodePath.isExportDefaultDeclaration()) {\n return;\n }\n\n const declarationPath = nodePath.get(\"declaration\");\n if (declarationPath.isIdentifier()) {\n exportBindings.set(\"default\", { localName: declarationPath.node.name });\n return;\n }\n\n if (\n declarationPath.isFunctionDeclaration() ||\n declarationPath.isClassDeclaration()\n ) {\n const localName = declarationPath.node.id?.name;\n if (localName) {\n exportBindings.set(\"default\", { localName });\n } else {\n exportBindings.set(\"default\", { path: declarationPath });\n }\n return;\n }\n\n if (\n declarationPath.isArrowFunctionExpression() ||\n declarationPath.isFunctionExpression()\n ) {\n exportBindings.set(\"default\", { path: declarationPath });\n }\n });\n\n return {\n filename,\n programPath,\n availableNames,\n helperPaths,\n importBindings,\n exportBindings,\n compatPascalNames: new Set(),\n };\n}\n\nfunction getOrCreateModuleAnalysis(filename, context) {\n const normalizedFilename = normalizeFilePath(filename);\n if (!normalizedFilename) {\n return null;\n }\n\n if (context.moduleAnalysisCache.has(normalizedFilename)) {\n return context.moduleAnalysisCache.get(normalizedFilename);\n }\n\n let source;\n try {\n source = fs.readFileSync(normalizedFilename, \"utf8\");\n } catch {\n return null;\n }\n\n let programPath = null;\n try {\n const ast = parser.parse(source, { sourceType: \"module\" });\n traverse(ast, {\n Program(path) {\n if (!programPath) {\n programPath = path;\n path.scope.crawl();\n }\n },\n });\n } catch {\n return null;\n }\n\n if (!programPath) {\n return null;\n }\n\n const analysis = buildModuleAnalysis(programPath, normalizedFilename, context);\n context.moduleAnalysisCache.set(normalizedFilename, analysis);\n return analysis;\n}\n\nfunction isCapitalizedName(name) {\n if (typeof name !== \"string\" || name.length === 0) {\n return false;\n }\n\n const first = name[0];\n return first === first.toUpperCase() && first !== first.toLowerCase();\n}\n\nfunction isProgramLevelBinding(binding) {\n return binding?.scope?.path?.isProgram?.() === true;\n}\n\nfunction validateComponentName(nameNode, pathForErrors, context) {\n if (!nameNode || nameNode.type !== \"JSXIdentifier\") return null;\n const originalName = nameNode.__scopedOriginal || nameNode.name;\n if (!isCapitalizedName(originalName)) return null;\n\n const binding = pathForErrors?.scope?.getBinding?.(originalName) || null;\n if (!binding) {\n if (context.availableNames.has(originalName)) {\n return originalName;\n }\n if (context.compatPascalNames.has(originalName)) {\n return null;\n }\n if (context.options?.allowUnknownPascalCase === true) {\n return null;\n }\n throw (pathForErrors?.buildCodeFrameError?.(\n `Unknown LitSX component \"${originalName}\". Add an import or declare it in this module before using it in JSX.`\n ) || new Error(\n `Unknown LitSX component \"${originalName}\". Add an import or declare it in this module before using it in JSX.`\n ));\n }\n\n if (!isProgramLevelBinding(binding)) {\n return null;\n }\n\n return originalName;\n}\n\nfunction resolveImportedHelper(moduleAnalysis, helperName, context, seen = new Set()) {\n const importInfo = moduleAnalysis.importBindings.get(helperName);\n if (!importInfo?.resolvedSource || importInfo.importedName === \"*\") {\n return null;\n }\n\n const visitedKey = `${moduleAnalysis.filename}:${helperName}:${importInfo.resolvedSource}:${importInfo.importedName}`;\n if (seen.has(visitedKey)) {\n return null;\n }\n const nextSeen = new Set(seen);\n nextSeen.add(visitedKey);\n\n const importedModule = getOrCreateModuleAnalysis(importInfo.resolvedSource, context);\n if (!importedModule) {\n return null;\n }\n\n return resolveExportedHelper(importedModule, importInfo.importedName, context, nextSeen);\n}\n\nfunction resolveExportedHelper(moduleAnalysis, exportedName, context, seen = new Set()) {\n const exportInfo = moduleAnalysis.exportBindings.get(exportedName);\n if (!exportInfo) {\n return null;\n }\n\n if (exportInfo.path?.node) {\n return {\n moduleAnalysis,\n path: exportInfo.path,\n };\n }\n\n if (exportInfo.localName) {\n const helperPath = moduleAnalysis.helperPaths.get(exportInfo.localName);\n if (!helperPath?.node) {\n if (moduleAnalysis.importBindings.has(exportInfo.localName)) {\n return resolveImportedHelper(moduleAnalysis, exportInfo.localName, context, seen);\n }\n return null;\n }\n return {\n moduleAnalysis,\n path: helperPath,\n };\n }\n\n if (exportInfo.reexportSource) {\n const reexportedModule = getOrCreateModuleAnalysis(exportInfo.reexportSource, context);\n if (!reexportedModule) {\n return null;\n }\n return resolveExportedHelper(\n reexportedModule,\n exportInfo.importedName,\n context,\n seen\n );\n }\n\n return null;\n}\n\nfunction resolveImportedElementRequirement(candidateName, moduleAnalysis, context, rootFilename) {\n const binding = moduleAnalysis.programPath.scope.getBinding(candidateName);\n if (!binding || !isProgramLevelBinding(binding)) {\n return null;\n }\n\n if (\n binding.path.isImportSpecifier?.() ||\n binding.path.isImportDefaultSpecifier?.()\n ) {\n const importInfo = moduleAnalysis.importBindings.get(candidateName);\n if (!importInfo?.resolvedSource || importInfo.importedName === \"*\") {\n return null;\n }\n\n return {\n sourceFile: importInfo.resolvedSource,\n sourceSpecifier: isRelativeSpecifier(importInfo.sourceValue)\n ? null\n : importInfo.sourceValue,\n importedName: importInfo.importedName,\n originalName: candidateName,\n tagName: candidateName.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase(),\n rootFilename,\n };\n }\n\n const exportInfo =\n moduleAnalysis.exportBindings.get(candidateName) ||\n moduleAnalysis.exportBindings.get(\"default\");\n if (!exportInfo) {\n throw new Error(\n `Imported renderer helper transitively renders \"${candidateName}\" from \"${moduleAnalysis.filename}\", but that symbol is not exported and cannot be added to static elements in \"${rootFilename}\".`\n );\n }\n\n const importedName = exportInfo.localName === candidateName\n ? candidateName\n : [...moduleAnalysis.exportBindings.entries()].find(\n ([, entry]) => entry.localName === candidateName\n )?.[0] ?? null;\n\n if (!importedName) {\n throw new Error(\n `Imported renderer helper transitively renders \"${candidateName}\" from \"${moduleAnalysis.filename}\", but that symbol cannot be resolved as an importable export for \"${rootFilename}\".`\n );\n }\n\n return {\n sourceFile: moduleAnalysis.filename,\n sourceSpecifier: null,\n importedName,\n originalName: candidateName,\n tagName: candidateName.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase(),\n rootFilename,\n };\n}\n\nfunction collectCandidateResult(functionPath, programPath, options = {}) {\n const result = createEmptyCandidateResult();\n if (!programPath || !functionPath?.node) return result;\n programPath.scope.crawl();\n const compilationSession = options.__litsxCompilationSession || null;\n\n const rootFilename = normalizeFilePath(\n options.filename || programPath.hub.file?.opts?.filename || \"\"\n );\n const helperCandidateCache =\n programPath.getData(\"__litsxHelperCandidateCache\") || new WeakMap();\n programPath.setData(\"__litsxHelperCandidateCache\", helperCandidateCache);\n const moduleAnalysisCache =\n compilationSession?.importedModuleAnalysisCache ||\n programPath.getData(\"__litsxImportedModuleAnalyses\") ||\n new Map();\n programPath.setData(\"__litsxImportedModuleAnalyses\", moduleAnalysisCache);\n const resolvedImportCache =\n compilationSession?.resolvedImportCache ||\n programPath.getData(\"__litsxResolvedImports\") ||\n new Map();\n programPath.setData(\"__litsxResolvedImports\", resolvedImportCache);\n\n const rootModule = {\n filename: rootFilename,\n programPath,\n availableNames: getOrCreateAvailableNames(programPath),\n helperPaths: getOrCreateHelperPaths(programPath),\n compatPascalNames: programPath.getData(\"__litsxCompatPascalNames\") || new Set(),\n importBindings: new Map(),\n exportBindings: new Map(),\n };\n\n programPath.get(\"body\").forEach((nodePath) => {\n if (!nodePath.isImportDeclaration()) {\n return;\n }\n\n const sourceValue = nodePath.node.source.value;\n const resolvedSource = resolveImportSource(rootFilename, sourceValue, {\n moduleAnalysisCache,\n resolvedImportCache,\n });\n\n nodePath.node.specifiers.forEach((specifier) => {\n if (!specifier.local?.name) {\n return;\n }\n\n let importedName = null;\n if (specifier.type === \"ImportDefaultSpecifier\") {\n importedName = \"default\";\n } else if (specifier.type === \"ImportSpecifier\") {\n importedName = specifier.imported?.name ?? specifier.imported?.value ?? null;\n } else if (specifier.type === \"ImportNamespaceSpecifier\") {\n importedName = \"*\";\n }\n\n rootModule.importBindings.set(specifier.local.name, {\n localName: specifier.local.name,\n importedName,\n sourceValue,\n resolvedSource,\n });\n });\n });\n\n const context = {\n rootFilename,\n rootModule,\n options,\n helperCandidateCache,\n moduleAnalysisCache,\n resolvedImportCache,\n ...createCompilerContextResolver(options),\n };\n\n function scanFunction(path, moduleAnalysis, seen = new Set()) {\n if (!path?.node) {\n return createEmptyCandidateResult();\n }\n\n if (context.helperCandidateCache.has(path.node)) {\n return cloneCandidateResult(context.helperCandidateCache.get(path.node));\n }\n\n if (seen.has(path.node)) {\n return createEmptyCandidateResult();\n }\n\n const nextSeen = new Set(seen);\n nextSeen.add(path.node);\n const localResult = createEmptyCandidateResult();\n const referencedHelpers = [];\n const scanContext = {\n availableNames: moduleAnalysis.availableNames,\n helperPaths: moduleAnalysis.helperPaths,\n compatPascalNames: moduleAnalysis.compatPascalNames,\n options,\n };\n\n path.traverse({\n JSXOpeningElement(jsxPath) {\n const candidate = validateComponentName(jsxPath.node.name, jsxPath, scanContext);\n if (candidate) {\n if (moduleAnalysis.filename === context.rootFilename) {\n localResult.localCandidates.add(candidate);\n } else {\n const requirement = resolveImportedElementRequirement(\n candidate,\n moduleAnalysis,\n context,\n context.rootFilename\n );\n if (requirement) {\n localResult.importedCandidates.set(\n toImportRecordKey(requirement),\n requirement\n );\n }\n }\n }\n },\n JSXClosingElement(jsxPath) {\n validateComponentName(jsxPath.node.name, jsxPath, scanContext);\n },\n Identifier(identifierPath) {\n if (!identifierPath.isReferencedIdentifier()) {\n return;\n }\n\n if (moduleAnalysis.helperPaths.has(identifierPath.node.name)) {\n referencedHelpers.push({\n moduleAnalysis,\n path: moduleAnalysis.helperPaths.get(identifierPath.node.name),\n });\n return;\n }\n\n const binding = identifierPath.scope.getBinding(identifierPath.node.name);\n if (!binding) {\n return;\n }\n\n if (\n !binding.path.isImportSpecifier?.() &&\n !binding.path.isImportDefaultSpecifier?.()\n ) {\n return;\n }\n\n const resolvedHelper = resolveImportedHelper(\n moduleAnalysis,\n identifierPath.node.name,\n context\n );\n if (!resolvedHelper?.path?.node) {\n return;\n }\n\n referencedHelpers.push(resolvedHelper);\n },\n });\n\n referencedHelpers.forEach((helperEntry) => {\n const helperCandidates = scanFunction(\n helperEntry.path,\n helperEntry.moduleAnalysis,\n nextSeen\n );\n mergeCandidateResults(localResult, helperCandidates);\n });\n\n context.helperCandidateCache.set(path.node, cloneCandidateResult(localResult));\n return localResult;\n }\n\n return scanFunction(functionPath, rootModule);\n}\n\nexport function getAnnotatedElementCandidates(path, programPath, options = {}) {\n if (path?.node?._litsxElementCandidates instanceof Set) {\n return new Set(path.node._litsxElementCandidates);\n }\n\n return collectCandidateResult(path, programPath, options).localCandidates;\n}\n\nexport function getAnnotatedImportedElementCandidates(path, programPath, options = {}) {\n if (Array.isArray(path?.node?._litsxImportedElementCandidates)) {\n return [...path.node._litsxImportedElementCandidates];\n }\n\n return [...collectCandidateResult(path, programPath, options).importedCandidates.values()];\n}\n\nexport function importedBindingNeedsRendererContext(programPath, localName, options = {}) {\n if (!programPath?.node || !localName) {\n return false;\n }\n\n programPath.scope.crawl();\n const compilationSession = options.__litsxCompilationSession || null;\n const rootFilename = normalizeFilePath(\n options.filename || programPath.hub.file?.opts?.filename || \"\"\n );\n const helperCandidateCache =\n programPath.getData(\"__litsxHelperCandidateCache\") || new WeakMap();\n programPath.setData(\"__litsxHelperCandidateCache\", helperCandidateCache);\n const moduleAnalysisCache =\n compilationSession?.importedModuleAnalysisCache ||\n programPath.getData(\"__litsxImportedModuleAnalyses\") ||\n new Map();\n programPath.setData(\"__litsxImportedModuleAnalyses\", moduleAnalysisCache);\n const resolvedImportCache =\n compilationSession?.resolvedImportCache ||\n programPath.getData(\"__litsxResolvedImports\") ||\n new Map();\n programPath.setData(\"__litsxResolvedImports\", resolvedImportCache);\n\n const rootModule = {\n filename: rootFilename,\n programPath,\n availableNames: getOrCreateAvailableNames(programPath),\n helperPaths: getOrCreateHelperPaths(programPath),\n compatPascalNames: programPath.getData(\"__litsxCompatPascalNames\") || new Set(),\n importBindings: new Map(),\n exportBindings: new Map(),\n };\n\n programPath.get(\"body\").forEach((nodePath) => {\n if (!nodePath.isImportDeclaration()) {\n return;\n }\n\n const sourceValue = nodePath.node.source.value;\n const resolvedSource = resolveImportSource(rootFilename, sourceValue, {\n moduleAnalysisCache,\n resolvedImportCache,\n });\n\n nodePath.node.specifiers.forEach((specifier) => {\n if (!specifier.local?.name) {\n return;\n }\n\n let importedName = null;\n if (specifier.type === \"ImportDefaultSpecifier\") {\n importedName = \"default\";\n } else if (specifier.type === \"ImportSpecifier\") {\n importedName = specifier.imported?.name ?? specifier.imported?.value ?? null;\n } else if (specifier.type === \"ImportNamespaceSpecifier\") {\n importedName = \"*\";\n }\n\n rootModule.importBindings.set(specifier.local.name, {\n localName: specifier.local.name,\n importedName,\n sourceValue,\n resolvedSource,\n });\n });\n });\n\n const context = {\n rootFilename,\n rootModule,\n options,\n helperCandidateCache,\n moduleAnalysisCache,\n resolvedImportCache,\n ...createCompilerContextResolver(options),\n };\n\n const resolvedHelper = resolveImportedHelper(rootModule, localName, context);\n if (!resolvedHelper?.path?.node) {\n return false;\n }\n\n function scanFunction(path, moduleAnalysis, seen = new Set()) {\n if (!path?.node) {\n return false;\n }\n\n const cacheKey = path.node;\n if (context.helperCandidateCache.has(cacheKey)) {\n const cached = context.helperCandidateCache.get(cacheKey);\n return cached.localCandidates.size > 0 || cached.importedCandidates.size > 0;\n }\n\n if (seen.has(path.node)) {\n return false;\n }\n\n const nextSeen = new Set(seen);\n nextSeen.add(path.node);\n let needsContext = false;\n const referencedHelpers = [];\n const scanContext = {\n availableNames: moduleAnalysis.availableNames,\n helperPaths: moduleAnalysis.helperPaths,\n compatPascalNames: moduleAnalysis.compatPascalNames,\n options,\n };\n\n path.traverse({\n JSXOpeningElement(jsxPath) {\n const candidate = validateComponentName(jsxPath.node.name, jsxPath, scanContext);\n if (candidate) {\n needsContext = true;\n }\n },\n JSXClosingElement(jsxPath) {\n validateComponentName(jsxPath.node.name, jsxPath, scanContext);\n },\n Identifier(identifierPath) {\n if (!identifierPath.isReferencedIdentifier()) {\n return;\n }\n\n if (moduleAnalysis.helperPaths.has(identifierPath.node.name)) {\n referencedHelpers.push({\n moduleAnalysis,\n path: moduleAnalysis.helperPaths.get(identifierPath.node.name),\n });\n return;\n }\n\n const binding = identifierPath.scope.getBinding(identifierPath.node.name);\n if (\n !binding ||\n (\n !binding.path.isImportSpecifier?.() &&\n !binding.path.isImportDefaultSpecifier?.()\n )\n ) {\n return;\n }\n\n const importedHelper = resolveImportedHelper(\n moduleAnalysis,\n identifierPath.node.name,\n context\n );\n if (importedHelper?.path?.node) {\n referencedHelpers.push(importedHelper);\n }\n },\n });\n\n if (!needsContext) {\n needsContext = referencedHelpers.some((helperEntry) =>\n scanFunction(helperEntry.path, helperEntry.moduleAnalysis, nextSeen)\n );\n }\n\n context.helperCandidateCache.set(cacheKey, needsContext\n ? {\n localCandidates: new Set([\"__context\"]),\n importedCandidates: new Map(),\n }\n : createEmptyCandidateResult()\n );\n\n return needsContext;\n }\n\n return scanFunction(resolvedHelper.path, resolvedHelper.moduleAnalysis);\n}\n\nexport default declare((api) => {\n api.assertVersion(7);\n t = api.types;\n\n return {\n name: \"transform-litsx-element-candidates\",\n inherits: jsxSyntaxPlugin.default || jsxSyntaxPlugin,\n visitor: {\n Program: {\n enter(path) {\n path.scope.crawl();\n path.setData(\"__litsxAvailableNames\", null);\n path.setData(\"__litsxHelperPaths\", null);\n path.setData(\"__litsxHelperCandidateCache\", new WeakMap());\n path.setData(\"__litsxImportedModuleAnalyses\", new Map());\n path.setData(\"__litsxResolvedImports\", new Map());\n },\n },\n FunctionDeclaration: {\n exit(path, state) {\n if (isInsideFunctionOrClass(path)) {\n return;\n }\n\n const programPath = path.findParent((entry) => entry.isProgram());\n const result = collectCandidateResult(\n path,\n programPath,\n {\n ...(state.opts || {}),\n filename: state.file?.opts?.filename || \"\",\n }\n );\n path.node._litsxElementCandidates = result.localCandidates;\n path.node._litsxImportedElementCandidates = [...result.importedCandidates.values()];\n },\n },\n ArrowFunctionExpression: {\n exit(path, state) {\n if (isInsideFunctionOrClass(path)) {\n return;\n }\n\n const programPath = path.findParent((entry) => entry.isProgram());\n const result = collectCandidateResult(\n path,\n programPath,\n {\n ...(state.opts || {}),\n filename: state.file?.opts?.filename || \"\",\n }\n );\n path.node._litsxElementCandidates = result.localCandidates;\n path.node._litsxImportedElementCandidates = [...result.importedCandidates.values()];\n },\n },\n FunctionExpression: {\n exit(path, state) {\n if (isInsideFunctionOrClass(path)) {\n return;\n }\n\n const programPath = path.findParent((entry) => entry.isProgram());\n const result = collectCandidateResult(\n path,\n programPath,\n {\n ...(state.opts || {}),\n filename: state.file?.opts?.filename || \"\",\n }\n );\n path.node._litsxElementCandidates = result.localCandidates;\n path.node._litsxImportedElementCandidates = [...result.importedCandidates.values()];\n },\n },\n },\n };\n});\n"],"names":["normalizeFilePath","ensureTypescriptModule"],"mappings":";;;;;;;;;;;AASA,MAAM,EAAE,OAAO,EAAE,GAAG,iBAAiB;AACrC,MAAM,QAAQ,GAAG,aAAa,CAAC,OAAO,IAAI,aAAa;AACvD,MAAM,4BAA4B,GAAG;AACrC,EAAE,QAAQ;AACV,EAAE,YAAY;AACd,EAAE,MAAM;AACR,EAAE,KAAK;AACP,EAAE,MAAM;AACR,EAAE,KAAK;AACP,CAAC;AACD,MAAM,iCAAiC,GAAG;AAC1C,EAAE,gBAAgB,EAAE,GAAG;AACvB,EAAE,OAAO,EAAE,IAAI;AACf,EAAE,OAAO,EAAE,KAAK;AAChB,EAAE,GAAG,EAAE,CAAC;AACR,EAAE,MAAM,EAAE,EAAE;AACZ,EAAE,MAAM,EAAE,EAAE;AACZ,EAAE,eAAe,EAAE,IAAI;AACvB,EAAE,4BAA4B,EAAE,IAAI;AACpC,CAAC;;AAED,IAAI,CAAC;;AAEE,SAAS,8BAA8B,CAAC,SAAS,EAAE;AAC1D,EAAE,CAAC,GAAG,SAAS;AACf;;AAEA,SAAS,uBAAuB,CAAC,IAAI,EAAE;AACvC,EAAE,OAAO,IAAI,CAAC,UAAU;AACxB,IAAI,CAAC,CAAC;AACN,MAAM,CAAC,CAAC,qBAAqB,EAAE;AAC/B,MAAM,CAAC,CAAC,oBAAoB,EAAE;AAC9B,MAAM,CAAC,CAAC,yBAAyB,EAAE;AACnC,MAAM,CAAC,CAAC,kBAAkB;AAC1B,GAAG;AACH;;AAEA,SAAS,mBAAmB,CAAC,KAAK,EAAE;AACpC,EAAE,OAAO,OAAO,KAAK,KAAK,QAAQ;AAClC,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC;AAC1B,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CA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U,IAAI,CAAC,IAAI,CAAC,uBAAuB,GAAG,MAAM,CAAC,eAAe;AACpE,UAAU,IAAI,CAAC,IAAI,CAAC,+BAA+B,GAAG,CAAC,GAAG,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC;AAC7F,QAAQ,CAAC;AACT,OAAO;AACP,KAAK;AACL,GAAG;AACH,CAAC,CAAC;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@litsx/babel-preset-litsx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Canonical native Babel preset for LitSX-authored source",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -73,13 +73,15 @@
|
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@babel/helper-plugin-utils": "^7.28.6",
|
|
75
75
|
"@babel/plugin-syntax-jsx": "^7.28.6",
|
|
76
|
+
"@babel/traverse": "^7.28.5",
|
|
77
|
+
"@litsx/babel-parser": "^0.2.1",
|
|
76
78
|
"@litsx/babel-plugin-shared-hooks": "^0.2.1",
|
|
77
79
|
"@litsx/babel-plugin-transform-jsx-html-template": "^0.3.0",
|
|
78
80
|
"@litsx/babel-plugin-transform-litsx-scoped-elements": "^0.2.1",
|
|
79
81
|
"@litsx/typescript-session": "^0.2.1"
|
|
80
82
|
},
|
|
81
83
|
"scripts": {
|
|
82
|
-
"build": "../../node_modules/.bin/rollup --config rollup.config.
|
|
84
|
+
"build": "../../node_modules/.bin/rollup --config rollup.config.js",
|
|
83
85
|
"prepack": "yarn build"
|
|
84
86
|
}
|
|
85
87
|
}
|
|
@@ -22,9 +22,6 @@ import {
|
|
|
22
22
|
setWrapperUtilsBabelTypes,
|
|
23
23
|
} from "./transform-litsx-wrapper-utils.js";
|
|
24
24
|
import {
|
|
25
|
-
createComponentInstanceRefSyncStatement,
|
|
26
|
-
hasRefProp,
|
|
27
|
-
lowerForwardedElementRefs,
|
|
28
25
|
setRefsBabelTypes,
|
|
29
26
|
} from "./transform-litsx-refs.js";
|
|
30
27
|
import {
|
|
@@ -33,10 +30,20 @@ import {
|
|
|
33
30
|
setClassGenerationBabelTypes,
|
|
34
31
|
} from "./transform-litsx-class-generation.js";
|
|
35
32
|
import {
|
|
36
|
-
replaceParamReferences,
|
|
37
33
|
setParamRewriteBabelTypes,
|
|
38
|
-
transformJSXExpressions,
|
|
39
34
|
} from "./transform-litsx-param-rewrites.js";
|
|
35
|
+
import {
|
|
36
|
+
setRendererCallsBabelTypes,
|
|
37
|
+
} from "./transform-litsx-renderer-calls.js";
|
|
38
|
+
import {
|
|
39
|
+
getAnnotatedElementCandidates,
|
|
40
|
+
getAnnotatedImportedElementCandidates,
|
|
41
|
+
setElementCandidatesBabelTypes,
|
|
42
|
+
} from "./transform-litsx-element-candidates.js";
|
|
43
|
+
import {
|
|
44
|
+
prepareComponentRender,
|
|
45
|
+
setRenderBodyBabelTypes,
|
|
46
|
+
} from "./transform-litsx-render-body.js";
|
|
40
47
|
import {
|
|
41
48
|
finalizeProgram,
|
|
42
49
|
setProgramBabelTypes,
|
|
@@ -64,6 +71,9 @@ export function createTransformFunctionToClassPlugin(defaultPluginOptions = {})
|
|
|
64
71
|
setRefsBabelTypes(t);
|
|
65
72
|
setClassGenerationBabelTypes(t);
|
|
66
73
|
setParamRewriteBabelTypes(t);
|
|
74
|
+
setRendererCallsBabelTypes(t);
|
|
75
|
+
setElementCandidatesBabelTypes(t);
|
|
76
|
+
setRenderBodyBabelTypes(t);
|
|
67
77
|
setProgramBabelTypes(t);
|
|
68
78
|
const resolvedPluginOptions = {
|
|
69
79
|
...defaultPluginOptions,
|
|
@@ -365,8 +375,8 @@ function getTypeResolverForFunction(functionPath, state) {
|
|
|
365
375
|
|
|
366
376
|
function transformFunction(functionPath, programPath, className, options = {}) {
|
|
367
377
|
const { node } = functionPath;
|
|
368
|
-
const elementCandidates =
|
|
369
|
-
const
|
|
378
|
+
const elementCandidates = getAnnotatedElementCandidates(functionPath, programPath, options);
|
|
379
|
+
const importedElementCandidates = getAnnotatedImportedElementCandidates(functionPath, programPath, options);
|
|
370
380
|
let resolvedName = className;
|
|
371
381
|
if (!resolvedName && node && node.id && t.isIdentifier(node.id)) {
|
|
372
382
|
resolvedName = node.id.name;
|
|
@@ -392,19 +402,21 @@ function transformFunction(functionPath, programPath, className, options = {}) {
|
|
|
392
402
|
assertStaticHoistsStayTopLevel(functionPath);
|
|
393
403
|
collectNativeClassNameWarnings(functionPath, options.warn, options);
|
|
394
404
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
});
|
|
405
|
+
const renderPreparation = prepareComponentRender(
|
|
406
|
+
functionPath,
|
|
407
|
+
node,
|
|
408
|
+
propertyNames,
|
|
409
|
+
bindings,
|
|
410
|
+
nestedInitializers,
|
|
411
|
+
options
|
|
412
|
+
);
|
|
404
413
|
|
|
405
|
-
if (!returnStatement) return;
|
|
414
|
+
if (!renderPreparation?.returnStatement) return;
|
|
406
415
|
|
|
407
|
-
const
|
|
416
|
+
const {
|
|
417
|
+
needsCallbackRef,
|
|
418
|
+
prefixStatements,
|
|
419
|
+
} = renderPreparation;
|
|
408
420
|
|
|
409
421
|
const usedNames = new Set([
|
|
410
422
|
...Object.keys(functionPath.scope.bindings || {}),
|
|
@@ -414,41 +426,12 @@ function transformFunction(functionPath, programPath, className, options = {}) {
|
|
|
414
426
|
]);
|
|
415
427
|
|
|
416
428
|
const handlerInfos = processHandlers(functionPath, usedNames);
|
|
417
|
-
|
|
418
429
|
const renderStatements = t.isBlockStatement(node.body)
|
|
419
430
|
? [...node.body.body]
|
|
420
431
|
: [t.returnStatement(node.body)];
|
|
421
432
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
let needsCallbackRef = false;
|
|
425
|
-
|
|
426
|
-
if (resolvedRefPropName) {
|
|
427
|
-
renderStatements.unshift(
|
|
428
|
-
...lowerForwardedElementRefs(functionPath, resolvedRefPropName)
|
|
429
|
-
);
|
|
430
|
-
needsCallbackRef = renderStatements.some(
|
|
431
|
-
(statement) =>
|
|
432
|
-
t.isExpressionStatement(statement) &&
|
|
433
|
-
t.isCallExpression(statement.expression) &&
|
|
434
|
-
t.isIdentifier(statement.expression.callee, { name: "useCallbackRef" })
|
|
435
|
-
) || needsCallbackRef;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
if (resolvedRefPropName && !forwardRefOptions) {
|
|
439
|
-
renderStatements.unshift(createComponentInstanceRefSyncStatement());
|
|
440
|
-
needsCallbackRef = true;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
if (capturedPropAliasStatements.length > 0) {
|
|
444
|
-
renderStatements.unshift(...capturedPropAliasStatements);
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
if (nestedInitializers.length > 0) {
|
|
448
|
-
const initializerStatements = nestedInitializers.map(({ pattern, root, defaultValue }) =>
|
|
449
|
-
createNestedInitializerStatement(pattern, root, defaultValue, t)
|
|
450
|
-
);
|
|
451
|
-
renderStatements.unshift(...initializerStatements);
|
|
433
|
+
if (prefixStatements.length > 0) {
|
|
434
|
+
renderStatements.unshift(...prefixStatements);
|
|
452
435
|
}
|
|
453
436
|
|
|
454
437
|
const classMembers = [];
|
|
@@ -497,6 +480,20 @@ function transformFunction(functionPath, programPath, className, options = {}) {
|
|
|
497
480
|
elementCandidates.forEach((candidate) => elementSet.add(candidate));
|
|
498
481
|
}
|
|
499
482
|
|
|
483
|
+
if (classNode && importedElementCandidates.length > 0) {
|
|
484
|
+
classNode._litsxImportedElementCandidates ||= [];
|
|
485
|
+
importedElementCandidates.forEach((candidate) => {
|
|
486
|
+
if (!classNode._litsxImportedElementCandidates.some(
|
|
487
|
+
(entry) =>
|
|
488
|
+
entry.sourceFile === candidate.sourceFile &&
|
|
489
|
+
entry.importedName === candidate.importedName &&
|
|
490
|
+
entry.tagName === candidate.tagName
|
|
491
|
+
)) {
|
|
492
|
+
classNode._litsxImportedElementCandidates.push(candidate);
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
|
|
500
497
|
return classNode;
|
|
501
498
|
}
|
|
502
499
|
|
|
@@ -513,185 +510,3 @@ function ensureClassIdentifier(classNode, fallbackName) {
|
|
|
513
510
|
classNode.id = identifier;
|
|
514
511
|
return identifier;
|
|
515
512
|
}
|
|
516
|
-
|
|
517
|
-
function createThisMemberExpression(propName) {
|
|
518
|
-
return t.memberExpression(t.thisExpression(), t.identifier(propName));
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
function createNestedInitializerStatement(pattern, root, defaultValue, t) {
|
|
522
|
-
const rootAccess = createThisMemberExpression(root);
|
|
523
|
-
let sourceExpression = rootAccess;
|
|
524
|
-
|
|
525
|
-
if (defaultValue) {
|
|
526
|
-
sourceExpression = t.logicalExpression(
|
|
527
|
-
"??",
|
|
528
|
-
t.cloneNode(rootAccess),
|
|
529
|
-
t.cloneNode(defaultValue)
|
|
530
|
-
);
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
return t.variableDeclaration("const", [
|
|
534
|
-
t.variableDeclarator(t.cloneNode(pattern), sourceExpression),
|
|
535
|
-
]);
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
function collectElementCandidates(functionPath, programPath, options = {}) {
|
|
539
|
-
const candidates = new Set();
|
|
540
|
-
if (!programPath) return candidates;
|
|
541
|
-
programPath.scope.crawl();
|
|
542
|
-
const compatPascalNames =
|
|
543
|
-
programPath.getData("__litsxCompatPascalNames") || new Set();
|
|
544
|
-
|
|
545
|
-
const availableNames = new Set();
|
|
546
|
-
const helperPaths = new Map();
|
|
547
|
-
programPath.get("body").forEach((nodePath) => {
|
|
548
|
-
if (nodePath.isImportDeclaration()) {
|
|
549
|
-
nodePath.node.specifiers.forEach((specifier) => {
|
|
550
|
-
if (specifier.local?.name) {
|
|
551
|
-
availableNames.add(specifier.local.name);
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
return;
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
if (nodePath.isClassDeclaration() && nodePath.node.id?.name) {
|
|
558
|
-
availableNames.add(nodePath.node.id.name);
|
|
559
|
-
return;
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
if (
|
|
563
|
-
(nodePath.isExportNamedDeclaration() || nodePath.isExportDefaultDeclaration()) &&
|
|
564
|
-
nodePath.get("declaration")?.isClassDeclaration?.() &&
|
|
565
|
-
nodePath.node.declaration?.id?.name
|
|
566
|
-
) {
|
|
567
|
-
availableNames.add(nodePath.node.declaration.id.name);
|
|
568
|
-
return;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
if (nodePath.isFunctionDeclaration() && nodePath.node.id?.name) {
|
|
572
|
-
availableNames.add(nodePath.node.id.name);
|
|
573
|
-
helperPaths.set(nodePath.node.id.name, nodePath);
|
|
574
|
-
return;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
if (!nodePath.isVariableDeclaration()) return;
|
|
578
|
-
nodePath.get("declarations").forEach((declaratorPath) => {
|
|
579
|
-
const declarator = declaratorPath.node;
|
|
580
|
-
if (!t.isIdentifier(declarator.id)) {
|
|
581
|
-
return;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
availableNames.add(declarator.id.name);
|
|
585
|
-
|
|
586
|
-
const initPath = declaratorPath.get("init");
|
|
587
|
-
if (
|
|
588
|
-
initPath?.isArrowFunctionExpression?.() ||
|
|
589
|
-
initPath?.isFunctionExpression?.()
|
|
590
|
-
) {
|
|
591
|
-
helperPaths.set(declarator.id.name, initPath);
|
|
592
|
-
}
|
|
593
|
-
});
|
|
594
|
-
});
|
|
595
|
-
|
|
596
|
-
const helperCandidateCache = new Map();
|
|
597
|
-
|
|
598
|
-
function isCapitalizedName(name) {
|
|
599
|
-
if (typeof name !== "string" || name.length === 0) {
|
|
600
|
-
return false;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
const first = name[0];
|
|
604
|
-
return first === first.toUpperCase() && first !== first.toLowerCase();
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
function toKebab(name) {
|
|
608
|
-
return name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
function isProgramLevelBinding(binding) {
|
|
612
|
-
return binding?.scope?.path?.isProgram?.() === true;
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
function maybeRewriteComponentName(nameNode, pathForErrors = null) {
|
|
616
|
-
if (!nameNode || nameNode.type !== "JSXIdentifier") return null;
|
|
617
|
-
const originalName = nameNode.__scopedOriginal || nameNode.name;
|
|
618
|
-
if (!isCapitalizedName(originalName)) return null;
|
|
619
|
-
const binding = pathForErrors?.scope?.getBinding?.(originalName) || null;
|
|
620
|
-
if (!binding) {
|
|
621
|
-
if (availableNames.has(originalName)) {
|
|
622
|
-
return originalName;
|
|
623
|
-
}
|
|
624
|
-
if (compatPascalNames.has(originalName)) {
|
|
625
|
-
return null;
|
|
626
|
-
}
|
|
627
|
-
if (options?.allowUnknownPascalCase === true) {
|
|
628
|
-
return null;
|
|
629
|
-
}
|
|
630
|
-
throw (pathForErrors?.buildCodeFrameError?.(
|
|
631
|
-
`Unknown LitSX component "${originalName}". Add an import or declare it in this module before using it in JSX.`
|
|
632
|
-
) || new Error(
|
|
633
|
-
`Unknown LitSX component "${originalName}". Add an import or declare it in this module before using it in JSX.`
|
|
634
|
-
));
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
if (!isProgramLevelBinding(binding)) {
|
|
638
|
-
return null;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
return originalName;
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
function scanFunction(path, seen = new Set()) {
|
|
645
|
-
if (!path?.node) {
|
|
646
|
-
return new Set();
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
if (helperCandidateCache.has(path.node)) {
|
|
650
|
-
return new Set(helperCandidateCache.get(path.node));
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
if (seen.has(path.node)) {
|
|
654
|
-
return new Set();
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
const nextSeen = new Set(seen);
|
|
658
|
-
nextSeen.add(path.node);
|
|
659
|
-
const localCandidates = new Set();
|
|
660
|
-
const referencedHelpers = new Set();
|
|
661
|
-
|
|
662
|
-
path.traverse({
|
|
663
|
-
JSXOpeningElement(jsxPath) {
|
|
664
|
-
const candidate = maybeRewriteComponentName(jsxPath.node.name, jsxPath);
|
|
665
|
-
if (candidate) {
|
|
666
|
-
localCandidates.add(candidate);
|
|
667
|
-
}
|
|
668
|
-
},
|
|
669
|
-
JSXClosingElement(jsxPath) {
|
|
670
|
-
maybeRewriteComponentName(jsxPath.node.name, jsxPath);
|
|
671
|
-
},
|
|
672
|
-
Identifier(identifierPath) {
|
|
673
|
-
if (!identifierPath.isReferencedIdentifier()) {
|
|
674
|
-
return;
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
if (!helperPaths.has(identifierPath.node.name)) {
|
|
678
|
-
return;
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
referencedHelpers.add(identifierPath.node.name);
|
|
682
|
-
},
|
|
683
|
-
});
|
|
684
|
-
|
|
685
|
-
referencedHelpers.forEach((helperName) => {
|
|
686
|
-
const helperCandidates = scanFunction(helperPaths.get(helperName), nextSeen);
|
|
687
|
-
helperCandidates.forEach((candidate) => localCandidates.add(candidate));
|
|
688
|
-
});
|
|
689
|
-
|
|
690
|
-
helperCandidateCache.set(path.node, new Set(localCandidates));
|
|
691
|
-
return localCandidates;
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
scanFunction(functionPath).forEach((candidate) => candidates.add(candidate));
|
|
695
|
-
|
|
696
|
-
return candidates;
|
|
697
|
-
}
|