Repository navigation
Conversation
❌ Deploy Preview for custom-elements-manifest-analyzer failed.
|
Co-authored-by: thepassle <17054057+thepassle@users.noreply.github.com> Agent-Logs-Url: https://github.com/open-wc/custom-elements-manifest/sessions/68ccbb38-e40c-4209-b61d-1c5d4af1eb8e
…and analysis Co-authored-by: thepassle <17054057+thepassle@users.noreply.github.com> Agent-Logs-Url: https://github.com/open-wc/custom-elements-manifest/sessions/68ccbb38-e40c-4209-b61d-1c5d4af1eb8e
|
@copilot make sure all tests pass |
Co-authored-by: thepassle <17054057+thepassle@users.noreply.github.com> Agent-Logs-Url: https://github.com/open-wc/custom-elements-manifest/sessions/29fb13d0-2df5-4eaf-b0c9-75038ccb3156
All 26 integration tests now pass (1 skipped with Key fixes:
|
|
@copilot some pipelines failing: 11:51:05 AM: build-image version: c2b8ae031d22ab4c62dd61deb4eac30945db824f (noble-new-builds) fix them also, am fine with doing a breaking change (we can release this as a 2.0 version) and have breaking changes in the AST nodes passed to plugins, but update internal plugin code to the new ast structure. But maybe we can provide a kind of adaptor to existing plugins that want to be available for use in the new major version. Maybe something so people on a newer version of @CEM/A can use "legacy" plugins like: legacy(oldPlugin) or legacy(oldPlugin(opts)) or something? not sure if thats doable but figure it out |
Co-authored-by: thepassle <17054057+thepassle@users.noreply.github.com> Agent-Logs-Url: https://github.com/open-wc/custom-elements-manifest/sessions/c493bf41-34ab-40ec-82c9-42b2c149067b
Fixed in commit CI fix: Updated
import { legacy } from '@custom-elements-manifest/analyzer';
export default {
plugins: [
legacy(myOldPlugin()), // already-instantiated plugin
legacy(myOldPlugin), // factory function (called with no args)
legacy([plugin1(), plugin2()]), // array of plugins
]
};The wrapper re-injects the oxc-adapter |
|
@copilot ok but so internal plugins dont need the legacy adapter then? make sure internal code is only using new AST structure, make sure tests pass |
Replace all ts.SyntaxKind.X and ts.isX() calls in internal plugins with direct node.kind string comparisons using native ESTree/augmented node properties from the oxc-adapter. - utils/index.js: decorator uses decorator?.type === 'Decorator' - utils/ast-helpers.js: all ts.isX/ts.SyntaxKind replaced with kind strings - utils/exports.js: ExportKeyword/DefaultKeyword as strings - utils/mixins.js: all type predicates replaced with kind comparisons - creators/handlers.js: all SyntaxKind/type predicates replaced - creators/createClass.js: import forEachChild named export, replace all ts usages - creators/createFunctionLike.js: FunctionDeclaration/MethodDeclaration as strings - creators/createArrowFunction.js: ArrowFunctionExpression as string - analyse-phase plugins: remove ts from destructuring, use string literals - collect-phase/collect-imports.js: Program instead of SourceFile - framework-plugins/lit/*: remove ts import/destructuring, use string literals - framework-plugins/catalyst*/controller.js: ClassDeclaration as string - framework-plugins/stencil/stencil.js: ClassDeclaration as string - framework-plugins/decorators/attr.js: ClassDeclaration as string Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Done in commit Only three files still import
The |
Replaces the TypeScript compiler API (
typescriptpackage) withoxc-parserfor all AST parsing and traversal. oxc-parser is significantly faster and produces a standard ESTree-compatible AST, enabling a browser build without shipping the full TypeScript compiler.This is a breaking change intended for a v2 major release. Internal plugin code now uses the native ESTree AST structure directly. External plugins written against the old TypeScript-compiler-API interface can use the new
legacy()adapter to remain compatible.New:
src/utils/oxc-adapter.jsA compatibility shim that bridges oxc-parser's ESTree output to the TypeScript AST interface used by
create.jsand external plugins vialegacy().Key responsibilities:
SyntaxKindconstants — string-based, matching ESTree node type names ('ClassDeclaration','MethodDeclaration', etc.)isClassDeclaration(node),isMethodDeclaration(node), etc. delegating tonode.kindforEachChild()— depth-first traversal via an explicitCHILD_PROPSlist; aliased properties (callee→expression,object→expression,property→name) are intentionally excluded to avoid visiting the same node twice; exported as a named export for use by internal traversal codecreateSourceFile(filename, source)— parses with oxc-parser (.tsextension forced so TypeScript syntax is accepted in.jsfiles), then augments every nodegetText(),kind,parent,getSourceFile(),jsDoc, and structural aliases to bridge ESTree ↔ TypeScript API differences:VariableDeclaration→ addsdeclarationList.declarations,initializer,namealiasesMethodDefinition→ remapped toConstructor/GetAccessor/SetAccessor/MethodDeclarationbased on its originalkind(saved beforeaugmentKindoverwrites it)ImportDeclaration→ synthesizesimportClausewith.name,.namedBindings,.isTypeOnlyExportNamedDeclaration/ExportDefaultDeclaration→ synthesizesexportClause,moduleSpecifier, and injectsexport/defaultmodifiers onto wrapped declarationsCallExpression.expression = .callee,MemberExpression.expression = .object,MemberExpression.name = .propertyresult.commentsviacomment-parserwithspacing: 'preserve'; inline{@link symbol text}tags resolved tosymboltextmatching TypeScript's outputNew:
src/utils/legacy.js— adapter for old pluginsProvides a
legacy()helper so plugins written against the old TypeScript-compiler-API interface continue to work after upgrading to v2. The wrapper re-injects the oxc-adaptertsshim into every phase callback (initialize,collectPhase,analyzePhase,moduleLinkPhase,packageLinkPhase).Internal plugins updated to native ESTree
All internal plugin files and utilities (
features/,utils/ast-helpers.js,utils/exports.js,utils/mixins.js,utils/index.js, and all framework plugins) have been updated to use native ESTree/augmented node properties directly:ts.SyntaxKind.X— replaced with string literals (e.g.,'ClassDeclaration','StaticKeyword')ts.isX(node)— replaced withnode.kind === 'X'ornode.type === 'X'comparisonsts.forEachChild()— internal traversal code uses the namedforEachChildexport from the adapterOnly three files still import
tsfrom the adapter (all appropriate):create.js— core traversal engine; passeststo plugins for legacy compatibilitylegacy.js— the adapter wrapper for old external pluginsbrowser-entrypoint.jsNode.js version requirement
oxc-parserrequires Node.js^20.19.0 || >=22.12.0. The minimum Node.js version has been updated accordingly:.nvmrcupdated fromv16.3.0tov20.19.0engines.nodeset to>=20.19.0in both the root and analyzerpackage.jsonNotable bugs fixed during adaptation
MethodDefinition.kind('constructor'/'get'/'set') overwritten to'MethodDefinition'before it could be usedaugmentKind, use saved value inaugmentMethodDefinitioncustomElements.define()export emitted twicecalleeandexpressionboth inCHILD_PROPScaused the calleeMemberExpressionto be visited twice; removedcallee/object/propertyfromCHILD_PROPS!exprinferred asnumberinstead ofbooleanSyntaxKind.ExclamationTokenset to'!'(operator string) not'ExclamationToken'exportstatementaugmentClassnow merges decorators into existing modifiers rather than overwriting theExportKeywordinjected byaugmentExportNamedDeclarationaugmentArrowFunctionnow setsreturnTypeNodefromnode.returnType.typeAnnotation_paramAugmentedidempotency guard;Identifierparam names stay as strings (handled directly byhandleParametersAndReturnType)isUnnamedincustom-elements-define-calls.jsnow matches original TypeScript behavior:!isAnonymousClass || classArg?.name === undefined, so the counter increments for all define calls as before@ignore/@internalnot filteringvardeclarations'VariableStatement'toattachableTypesinattachJsDocproperty?.typeNode(the actual type annotation) instead ofproperty?.type(the ESTree node discriminant string)Scope of changes
All files that previously imported from
typescriptnow import from./oxc-adapteror../utils/oxc-adapter. Internal plugin code uses native ESTree properties directly. Thelegacyhelper is exported from the main package entry point alongsidecreateandts. The only breaking change for plugin authors is the new Node.js minimum version requirement and the updated AST node structure passed to plugin callbacks (mitigated bylegacy()).All 26 integration tests pass.
⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.