Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(wire-service): re-expose wire-service package #3515

Merged
merged 3 commits into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/@lwc/wire-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,15 @@
{
"name": "@lwc/wire-service",
"path": "dist/index.js"
},
{
"name": "wire-service",
"path": "dist/index.js"
}
],
"expose": [
"@lwc/wire-service"
"@lwc/wire-service",
"wire-service"
]
}
}
26 changes: 14 additions & 12 deletions scripts/tasks/check-and-rewrite-package-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ const IGNORED_PACKAGES = [

// This is the same list as in @lwc/rollup-plugin/src/index.ts
const LWC_EXPOSED_MODULES = {
'@lwc/engine-dom': 'lwc',
'@lwc/synthetic-shadow': '@lwc/synthetic-shadow',
'@lwc/wire-service': '@lwc/wire-service',
'@lwc/engine-dom': ['lwc'],
'@lwc/synthetic-shadow': ['@lwc/synthetic-shadow'],
'@lwc/wire-service': [
'@lwc/wire-service',
// TODO [#3517]: remove support for deprecated 'wire-service' import
'wire-service',
],
};

const directories = globSync('./packages/@lwc/*').filter(
Expand Down Expand Up @@ -92,19 +96,17 @@ for (const dir of directories) {
peerDependencies,
};

const exposedModule = LWC_EXPOSED_MODULES[name];
if (exposedModule) {
const exposedModules = LWC_EXPOSED_MODULES[name];
if (exposedModules) {
// Special case - consumers can do `import { LightningElement } from 'lwc'` and have it resolve to
// `@lwc/engine-dom`. As for @lwc/synthetic-shadow and @lwc/wire-service, we have historically included these in
// the "default modules" defined in @lwc/rollup-plugin.
expectedJson.lwc = {
modules: [
{
name: exposedModule,
path: 'dist/index.js',
},
],
expose: [exposedModule],
modules: exposedModules.map((exposedModule) => ({
name: exposedModule,
path: 'dist/index.js',
})),
expose: exposedModules,
};
}

Expand Down