Commit 0a64fab
committed
fix: prevent named imports from merging into namespace imports in SWC plugin
When injecting `registerComponent` into a module that already has
`import * as lwc from 'lwc'`, the import helper was incorrectly appending
the named specifier to the namespace import, producing invalid syntax
(`import * as lwc{ registerComponent } from 'lwc'`). Guard against this
by skipping namespace imports when looking for an existing declaration to
extend, and creating a separate import declaration instead.
Made-with: Cursor1 parent 04a8b6d commit 0a64fab
File tree
214 files changed
+6401
-150
lines changed- .claude
- packages
- @lwc
- babel-plugin-component
- src/__tests__/fixtures
- api-decorator
- @api-setter-on-one-class-member-should-not-conflict-with-@api-getter-on-another
- conflicting-api-properties-with-getter-setter
- conflicting-api-properties-with-method
- detecting-@api-on-both-getter-and-a-setter-should-produce-an-error
- disallowed-props
- class
- is
- slot
- style
- does-not-allow-computed-api-getters-and-setters
- does-not-throw-error-if-property-name-is-data
- does-not-throw-if-property-name-prefixed-with-aria
- duplicate-api-properties
- single-@api-getter-on-one-class-member-should-not-conflict-with-@api-setter-on-another
- throws-correct-error-if-property-name-is-maxlength
- throws-error-if-default-value-is-true
- throws-error-if-property-name-is-ambiguous
- throws-error-if-property-name-is-part
- throws-error-if-property-name-prefixed-with-data
- throws-error-if-property-name-prefixed-with-on
- throws-when-combined-with-@track
- transform-complex-attributes
- transform-nested-classes
- transform-pairs-of-setter-and-getter
- transforms-public-getters
- transforms-public-methods
- transforms-public-props
- w-9927596-public-getter-setter-with-duplicate-property
- w-9927596-public-property-with-duplicate-getter-setter
- component
- allow-to-remap-the-import-to-lightningelement
- allows-importing-supported-apis-from-@lwc-engine-core
- allows-importing-supported-apis-from-@lwc-engine-dom
- allows-importing-supported-apis-from-@lwc-engine-server
- camel-to-kebab-component-name
- component-feature-flag
- does-not-insert-render-method-when-extending-from-legacy-engine-element
- enable-synthetic-element-internals
- export-engine-star
- import-engine-default-and-named
- import-engine-default
- import-engine-star
- inject-render-method
- keep-the-render-method-if-present
- only-inject-render-in-the-exported-class
- decorators
- should-register-decorators-for-anonymous-class-declarations
- should-register-decorators-for-anonymous-class-expressions
- should-throw-if-a-decorator-is-dereferenced
- should-throw-if-a-decorator-is-used-as-a-member-expression
- should-throw-if-a-decorator-is-used-on-a-class
- should-throw-if-an-global-decorator-is-used-on-class-field
- should-throw-if-an-global-decorator-is-used-on-class-methods
- should-throw-when-api-decorator-was-not-imported-from-lwc
- should-throw-when-track-decorator-was-not-imported-from-lwc
- should-throw-when-wire-decorator-was-not-imported-from-lwc
- should-transform-decorators-on-classdeclaration-in-a-large-input-file
- should-transform-decorators-on-classexpression-in-a-large-input-file
- throws-if-a-decorator-is-used-as-a-function
- unnecessary-register-decorators
- latest
- should-not-register-decorators-if-anonymous-class-has-no-superclass
- should-not-register-decorators-if-named-class-has-no-superclass
- should-register-decorators-for-anonymous-class-that-extends-non-lightning-element
- should-register-decorators-for-named-class-that-extends-non-lightning-element
- v59
- should-register-decorators-for-anonymous-class-that-extends-non-lightning-element
- should-register-decorators-for-named-class-that-extends-non-lightning-element
- should-register-decorators-if-anonymous-class-has-no-superclass
- should-register-decorators-if-named-class-has-no-superclass
- dedupe-imports
- should-handle-an-alias-of-an-export
- should-handle-both-default-and-importing-the-entire-contents-for-a-module
- should-handle-multiple-aliases-of-the-same-export
- should-handle-multiple-defaults-of-the-same-export
- should-handle-the-simple-case
- should-support-importing-names-and-default-2
- should-support-importing-names-and-default
- should-support-importing-the-entire-contents-for-a-module
- dynamic-imports
- check-validation-for-strict
- passthough-with-no-config
- test-custom-loader-multiple-imports
- test-custom-loader
- unchanged-dynamic-import-in-strict-mode
- error-recovery-mode
- api
- duplicate-api-property
- invalid-boolean-public-property
- invalid-property-name-on
- invalid-propery-name-data
- reserved-property-name-class
- dynamic-import/invalid-dynamic-import-source
- track/track-only-allowed-on-class-properties
- wire
- adapter-should-be-first-parameter
- config-object-should-be-second-parameter
- conflict-with-another-decorator
- invalid-adapter
- one-wire-decorator-allowed
- implicit-explicit
- api-decorator
- mixin
- noop-implicit-export-const
- noop-implicit-export-function
- test-cmp-anonymous-class
- test-cmp-named-class-with-decorators
- wire
- import-scoped-stylesheet
- observed-fields
- should-add-observed-fields-in-class-expression
- should-be-added-to-the-registercomponentcall-when-a-field-is-not-decorated-with-@api-@track-or-@wire
- should-not-observe-changes-in-a-static-fields
- should-not-observe-changes-in-computed-fields
- should-not-process-reserved-words-as-field-when-decorated-with-@api-@track-or-@wire
- should-transform-export-default-that-is-not-a-class
- track-decorator
- throws-if-track-decorator-is-applied-to-a-class-method
- throws-if-track-decorator-is-applied-to-a-getter
- throws-if-track-decorator-is-applied-to-a-setter
- transform-track-decorator-field
- transform-track-decorator-preserve-initial-value
- wire-decorator
- adapter-function-identifier-works
- adapter-member-expression-works
- basic-field
- basic-method
- config-ignores-method
- config-ignores-spread
- config-imported-values-works
- config-multiple-dynamic-params-works
- config-not-provided-works
- config-numeric-keys-works
- config-string-literal-keys-works
- decorating-multiple-props-works
- decorator-on-getter-alone-works
- decorator-on-getter-works
- decorator-on-setter-alone-works
- decorator-on-setter-works
- reactive-string-2-levels-works
- reactive-string-deep-chain-works
- reactive-string-with-empty-segment-works
- reactive-string-with-non-identifier-works
- throws-on-2-wires
- throws-on-adapter-computed-prop
- throws-on-adapter-function-expression
- throws-on-adapter-local-var
- throws-on-adapter-nested-member-expression
- throws-on-adapter-undeclared-var
- throws-on-config-not-object
- throws-on-decorator-no-args
- throws-on-wired-method-with-@api
- throws-on-wired-prop-with-@api
- throws-on-wired-prop-with-@track
- throws-when-computed-prop-is-expression
- throws-when-computed-prop-is-let-variable
- throws-when-computed-prop-is-regexp-literal
- throws-when-computed-prop-is-template-literal
- transforms-computed-properties-const-from-obj
- transforms-computed-properties
- compiler
- src
- transformers
- __tests__
- integration-wtr/test
- rendering
- dynamic-slots/x/child
- version-mismatch
- template/directive-external/custom-elements
- rollup-plugin/src/__tests__
- ssr-compiler
- src
- swc-plugin-component
- src
- __tests__
- decorators
- lwc
- scripts/tasks
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
214 files changed
+6401
-150
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
0 commit comments