Skip to content

Commit fb29c06

Browse files
committed
Revert "chore: resolve merge conflicts and update dependencies"
This reverts commit 08c566e, reversing changes made to 827868a.
1 parent 51386dd commit fb29c06

File tree

18 files changed

+1626
-2051
lines changed

18 files changed

+1626
-2051
lines changed

.husky/check-versions.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
import fs from 'node:fs';
2-
import semver from 'semver';
32

43
// Read package.json
54
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
65

76
// Extract versions
87
const devServerDependencyVersion = packageJson.dependencies['@lwc/lwc-dev-server'];
9-
const devServerTargetVersionRange = packageJson.apiVersionMetadata?.target?.matchingDevServerVersion;
8+
const devServerTargetVersion = packageJson.apiVersionMetadata?.target?.matchingDevServerVersion;
109

11-
if (!devServerDependencyVersion || !devServerTargetVersionRange) {
10+
if (!devServerDependencyVersion || !devServerTargetVersion) {
1211
console.error('Error: missing @lwc/lwc-dev-server or matchingDevServerVersion');
1312
process.exit(1); // Fail the check
1413
}
1514

1615
// Compare versions
17-
if (semver.intersects(devServerTargetVersionRange, devServerDependencyVersion)) {
16+
if (devServerDependencyVersion === devServerTargetVersion) {
1817
process.exit(0); // Pass the check
1918
} else {
2019
console.error(
21-
`Error: @lwc/lwc-dev-server versions do not match between 'dependencies' and 'apiVersionMetadata' in package.json. Expected ${devServerDependencyVersion} in apiVersionMetadata > target > matchingDevServerVersion. Got ${devServerTargetVersionRange} instead. When updating the @lwc/lwc-dev-server dependency, you must ensure that it is compatible with the supported API version in this branch, then update apiVersionMetadata > target > matchingDevServerVersion to match, in order to "sign off" on this dependency change.`
20+
`Error: @lwc/lwc-dev-server versions do not match between 'dependencies' and 'apiVersionMetadata' in package.json. Expected ${devServerDependencyVersion} in apiVersionMetadata > target > matchingDevServerVersion. Got ${devServerTargetVersion} instead. When updating the @lwc/lwc-dev-server dependency, you must ensure that it is compatible with the supported API version in this branch, then update apiVersionMetadata > target > matchingDevServerVersion to match, in order to "sign off" on this dependency change.`
2221
);
2322
process.exit(1); // Fail the check
2423
}

CHANGELOG.md

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,3 @@
1-
# [4.3.0](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.2.0...4.3.0) (2025-07-11)
2-
3-
### Features
4-
5-
- move component preview to org ([#447](https://github.com/salesforcecli/plugin-lightning-dev/issues/447)) ([2d9fb17](https://github.com/salesforcecli/plugin-lightning-dev/commit/2d9fb17e09a5fb68356e688335180e36d3a4f1dc))
6-
7-
# [4.2.0](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.1.7...4.2.0) (2025-07-11)
8-
9-
### Features
10-
11-
- launch site preview @W-18283821 ([#449](https://github.com/salesforcecli/plugin-lightning-dev/issues/449)) ([b8a8844](https://github.com/salesforcecli/plugin-lightning-dev/commit/b8a884405214e79d6d7186d89b658bee447a7cd7))
12-
13-
## [4.1.7](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.1.6...4.1.7) (2025-07-09)
14-
15-
### Bug Fixes
16-
17-
- bump LWC to 13.0.29 @W-18283826 ([#448](https://github.com/salesforcecli/plugin-lightning-dev/issues/448)) ([e40b7fc](https://github.com/salesforcecli/plugin-lightning-dev/commit/e40b7fcdf33ecd1e6f89240eb9e44f568afba6e9))
18-
19-
## [4.1.6](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.1.5...4.1.6) (2025-07-08)
20-
21-
### Bug Fixes
22-
23-
- bump LWC @W-18283826 ([#446](https://github.com/salesforcecli/plugin-lightning-dev/issues/446)) ([d161c35](https://github.com/salesforcecli/plugin-lightning-dev/commit/d161c351842926b12c472ab8d5e5c73219360958))
24-
25-
## [4.1.5](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.1.4...4.1.5) (2025-07-07)
26-
27-
### Bug Fixes
28-
29-
- eccn compliance ([#441](https://github.com/salesforcecli/plugin-lightning-dev/issues/441)) ([3c8dd4b](https://github.com/salesforcecli/plugin-lightning-dev/commit/3c8dd4b5baffaa5569d6fab6f98483842ddd0acc))
30-
31-
## [4.1.4](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.1.3...4.1.4) (2025-07-06)
32-
33-
### Bug Fixes
34-
35-
- **deps:** bump @oclif/core from 4.4.0 to 4.4.1 ([#442](https://github.com/salesforcecli/plugin-lightning-dev/issues/442)) ([08a1b88](https://github.com/salesforcecli/plugin-lightning-dev/commit/08a1b8892c0ca10e6e8c1bb0e32f28342ab72e9f))
36-
37-
## [4.1.3](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.1.2...4.1.3) (2025-07-06)
38-
39-
### Bug Fixes
40-
41-
- **deps:** bump lwc from 8.20.0 to 8.20.1 ([#444](https://github.com/salesforcecli/plugin-lightning-dev/issues/444)) ([4d9624f](https://github.com/salesforcecli/plugin-lightning-dev/commit/4d9624fb4a9b764cbb5a195c30c6ac2b6ec5f6df))
42-
43-
## [4.1.2](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.1.1...4.1.2) (2025-06-29)
44-
45-
### Bug Fixes
46-
47-
- **deps:** bump axios from 1.8.2 to 1.10.0 ([#437](https://github.com/salesforcecli/plugin-lightning-dev/issues/437)) ([571499d](https://github.com/salesforcecli/plugin-lightning-dev/commit/571499d0f9901049b045450d8003d3ec9bf58dd3))
48-
49-
## [4.1.1](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.1.0...4.1.1) (2025-06-29)
50-
51-
### Bug Fixes
52-
53-
- **deps:** bump @salesforce/core from 8.14.0 to 8.15.0 ([#438](https://github.com/salesforcecli/plugin-lightning-dev/issues/438)) ([ca23095](https://github.com/salesforcecli/plugin-lightning-dev/commit/ca23095e4214c29d12d4521433db16310050c41c))
54-
551
# [4.1.0](https://github.com/salesforcecli/plugin-lightning-dev/compare/4.0.5...4.1.0) (2025-06-27)
562

573
### Features

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Comment line immediately above ownership line is reserved for related other information. Please be careful while editing.
22

3-
#GUSINFO: Web Application Runtime, LWR CLI and Local Development
3+
#GUSINFO: Web Application Runtime, Lightning Web Runtime (Container)
44
* @salesforcecli/lwr @salesforcecli/lex @salesforcecli/mobile-platform-experience

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,21 +201,20 @@ EXAMPLES
201201
$ sf lightning dev app --target-org myOrg --device-type ios --device-id "iPhone 15 Pro Max"
202202
```
203203

204-
_See code: [src/commands/lightning/dev/app.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/4.3.0/src/commands/lightning/dev/app.ts)_
204+
_See code: [src/commands/lightning/dev/app.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/4.1.0/src/commands/lightning/dev/app.ts)_
205205

206206
## `sf lightning dev component`
207207

208208
[Beta] Preview LWC components in isolation.
209209

210210
```
211211
USAGE
212-
$ sf lightning dev component -o <value> [--json] [--flags-dir <value>] [-n <value>] [-c]
212+
$ sf lightning dev component [--json] [--flags-dir <value>] [-n <value>] [-c] [-o <value>]
213213
214214
FLAGS
215215
-c, --client-select Launch component preview without selecting a component
216216
-n, --name=<value> Name of a component to preview.
217-
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
218-
configuration variable is already set.
217+
-o, --target-org=<value> Username or alias of the target org.
219218
220219
GLOBAL FLAGS
221220
--flags-dir=<value> Import flag values from a directory.
@@ -248,15 +247,15 @@ EXAMPLES
248247
$ sf lightning dev component --name myComponent
249248
```
250249

251-
_See code: [src/commands/lightning/dev/component.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/4.3.0/src/commands/lightning/dev/component.ts)_
250+
_See code: [src/commands/lightning/dev/component.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/4.1.0/src/commands/lightning/dev/component.ts)_
252251

253252
## `sf lightning dev site`
254253

255254
[Beta] Preview an Experience Builder site locally and in real-time, without deploying it.
256255

257256
```
258257
USAGE
259-
$ sf lightning dev site -o <value> [--flags-dir <value>] [-n <value>] [-l] [--guest] [--ssr]
258+
$ sf lightning dev site -o <value> [--flags-dir <value>] [-n <value>] [-l] [--guest]
260259
261260
FLAGS
262261
-l, --get-latest Download the latest version of the specified site from your org, instead of using any local
@@ -266,7 +265,6 @@ FLAGS
266265
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
267266
configuration variable is already set.
268267
--guest Preview the site as a guest user (rather than an authenticated user).
269-
--ssr Preview the SSR bundle
270268
271269
GLOBAL FLAGS
272270
--flags-dir=<value> Import flag values from a directory.
@@ -304,7 +302,7 @@ EXAMPLES
304302
$ sf lightning dev site --name "Partner Central" --target-org myOrg --get-latest
305303
```
306304

307-
_See code: [src/commands/lightning/dev/site.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/4.3.0/src/commands/lightning/dev/site.ts)_
305+
_See code: [src/commands/lightning/dev/site.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/4.1.0/src/commands/lightning/dev/site.ts)_
308306

309307
## Integration Testing
310308

command-snapshot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"command": "lightning:dev:site",
2121
"flagAliases": [],
2222
"flagChars": ["l", "n", "o"],
23-
"flags": ["flags-dir", "get-latest", "guest", "name", "target-org", "ssr"],
23+
"flags": ["flags-dir", "get-latest", "guest", "name", "target-org"],
2424
"plugin": "@salesforce/plugin-lightning-dev"
2525
}
2626
]

messages/lightning.dev.app.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@ Type of device to display the app preview.
3131

3232
ID of the mobile device to display the preview if device type is set to `ios` or `android`. The default value is the ID of the first available mobile device.
3333

34+
# error.username
35+
36+
Org must have a valid user
37+
38+
# error.identitydata
39+
40+
Couldn't find identity data while generating preview arguments
41+
42+
# error.identitydata.entityid
43+
44+
Couldn't find entity ID while generating preview arguments
45+
46+
# error.no-project
47+
48+
This command is required to run from within a Salesforce project directory. %s
49+
3450
# error.fetching.app-id
3551

3652
Unable to determine App Id for %s

messages/lightning.dev.site.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ Download the latest version of the specified site from your org, instead of usin
2929

3030
Preview the site as a guest user (rather than an authenticated user).
3131

32-
# flags.ssr.summary
33-
34-
Preview the SSR bundle
35-
3632
# examples
3733

3834
- Select a site to preview from the org "myOrg":

messages/shared.utils.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,3 @@ Your org is on API version %s, but this version of the CLI plugin supports API v
3737
# error.org.api-mismatch.remediation
3838

3939
To use the plugin with this org, you can reinstall or update the plugin using the "%s" tag. For example: "sf plugins install %s".
40-
41-
# error.username
42-
43-
Org must have a valid user
44-
45-
# error.identitydata
46-
47-
Couldn't find identity data while generating preview arguments
48-
49-
# error.identitydata.entityid
50-
51-
Couldn't find entity ID while generating preview arguments
52-
53-
# error.no-project
54-
55-
This command is required to run from within a Salesforce project directory. %s

package.json

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
11
{
22
"name": "@salesforce/plugin-lightning-dev",
33
"description": "Lightning development tools for LEX, Mobile, and Experience Sites",
4-
"version": "4.3.0",
4+
"version": "4.1.0",
55
"author": "Salesforce",
66
"bugs": "https://github.com/forcedotcom/cli/issues",
77
"dependencies": {
88
"@inquirer/prompts": "^5.3.8",
99
"@inquirer/select": "^2.4.7",
10-
"@lwc/lwc-dev-server": "~13.0.29",
11-
"@lwc/sfdc-lwc-compiler": "~13.0.29",
10+
"@lwc/lwc-dev-server": "~12.3.4",
11+
"@lwc/sfdc-lwc-compiler": "~12.3.4",
1212
"@lwrjs/api": "0.18.3",
13-
"@oclif/core": "^4.4.1",
14-
"@salesforce/core": "^8.15.0",
13+
"@oclif/core": "^4.4.0",
14+
"@salesforce/core": "^8.12.0",
1515
"@salesforce/kit": "^3.1.6",
1616
"@salesforce/lwc-dev-mobile-core": "4.0.0-alpha.10",
1717
"@salesforce/sf-plugins-core": "^11.2.4",
18-
"axios": "^1.10.0",
18+
"axios": "^1.8.2",
1919
"glob": "^10.4.5",
2020
"lightning-base-components": "1.27.2-alpha",
21-
"lwc": "~8.20.1",
21+
"lwc": "~8.20.0",
2222
"node-fetch": "^3.3.2",
23-
"open": "^10.1.0",
2423
"xml2js": "^0.6.2"
2524
},
2625
"devDependencies": {
26+
"@oclif/plugin-command-snapshot": "^5.3.2",
2727
"@salesforce/cli": "^2.93.7",
28-
"@oclif/plugin-command-snapshot": "^5.3.3",
2928
"@salesforce/cli-plugins-testkit": "^5.3.39",
3029
"@salesforce/dev-scripts": "^11.0.2",
3130
"@salesforce/plugin-command-reference": "^3.1.58",
@@ -39,8 +38,8 @@
3938
"eslint-plugin-jsdoc": "^46.10.1",
4039
"eslint-plugin-sf-plugin": "^1.20.26",
4140
"eslint-plugin-unicorn": "^50.0.1",
42-
"esmock": "^2.7.1",
43-
"oclif": "^4.20.1",
41+
"esmock": "^2.7.0",
42+
"oclif": "^4.20.0",
4443
"ts-node": "^10.9.2",
4544
"typescript": "^5.5.4"
4645
},
@@ -237,7 +236,7 @@
237236
],
238237
"target": {
239238
"versionNumber": "65.0",
240-
"matchingDevServerVersion": "~13.0.27"
239+
"matchingDevServerVersion": "~12.3.4"
241240
},
242241
"versionToTagMappings": [
243242
{

src/commands/lightning/dev/app.ts

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
Platform,
1818
} from '@salesforce/lwc-dev-mobile-core';
1919
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
20+
import { OrgUtils } from '../../../shared/orgUtils.js';
2021
import { startLWCServer } from '../../../lwc-dev-server/index.js';
2122
import { PreviewUtils } from '../../../shared/previewUtils.js';
2223
import { PromptUtils } from '../../../shared/promptUtils.js';
@@ -73,14 +74,32 @@ export default class LightningDevApp extends SfCommand<void> {
7374
try {
7475
sfdxProjectRootPath = await SfProject.resolveProjectPath();
7576
} catch (error) {
76-
throw new Error(sharedMessages.getMessage('error.no-project', [(error as Error)?.message ?? '']));
77+
return Promise.reject(new Error(messages.getMessage('error.no-project', [(error as Error)?.message ?? ''])));
7778
}
7879

79-
logger.debug('Initalizing preview connection and configuring local web server identity');
80-
const { connection, ldpServerId, ldpServerToken } = await PreviewUtils.initializePreviewConnection(targetOrg);
80+
const connection = targetOrg.getConnection(undefined);
81+
const username = connection.getUsername();
82+
if (!username) {
83+
return Promise.reject(new Error(messages.getMessage('error.username')));
84+
}
85+
86+
const localDevEnabled = await OrgUtils.isLocalDevEnabled(connection);
87+
if (!localDevEnabled) {
88+
return Promise.reject(new Error(sharedMessages.getMessage('error.localdev.not.enabled')));
89+
}
90+
91+
OrgUtils.ensureMatchingAPIVersion(connection);
8192

8293
const platform = flags['device-type'] ?? (await PromptUtils.promptUserToSelectPlatform());
8394

95+
logger.debug('Configuring local web server identity');
96+
const appServerIdentity = await PreviewUtils.getOrCreateAppServerIdentity(connection);
97+
const ldpServerToken = appServerIdentity.identityToken;
98+
const ldpServerId = appServerIdentity.usernameToServerEntityIdMap[username];
99+
if (!ldpServerId) {
100+
return Promise.reject(new Error(messages.getMessage('error.identitydata.entityid')));
101+
}
102+
84103
const appId = await PreviewUtils.getLightningExperienceAppId(connection, appName, logger);
85104

86105
logger.debug('Determining the next available port for Local Dev Server');
@@ -130,7 +149,25 @@ export default class LightningDevApp extends SfCommand<void> {
130149
logger.debug('No Lightning Experience application name provided.... using the default app instead.');
131150
}
132151

133-
const targetOrg = PreviewUtils.getTargetOrgFromArguments(this.argv);
152+
// There are various ways to pass in a target org (as an alias, as a username, etc).
153+
// We could have LightningPreviewApp parse its --target-org flag which will be resolved
154+
// to an Org object (see https://github.com/forcedotcom/sfdx-core/blob/main/src/org/org.ts)
155+
// then write a bunch of code to look at this Org object to try to determine whether
156+
// it was initialized using Alias, Username, etc. and get a string representation of the
157+
// org to be forwarded to OrgOpenCommand.
158+
//
159+
// Or we could simply look at the raw arguments passed to the LightningPreviewApp command,
160+
// find the raw value for --target-org flag and forward that raw value to OrgOpenCommand.
161+
// The OrgOpenCommand will then parse the raw value automatically. If the value is
162+
// valid then OrgOpenCommand will consume it and continue. And if the value is invalid then
163+
// OrgOpenCommand simply throws an error which will get bubbled up to LightningPreviewApp.
164+
//
165+
// Here we've chosen the second approach
166+
const idx = this.argv.findIndex((item) => item.toLowerCase() === '-o' || item.toLowerCase() === '--target-org');
167+
let targetOrg: string | undefined;
168+
if (idx >= 0 && idx < this.argv.length - 1) {
169+
targetOrg = this.argv[idx + 1];
170+
}
134171

135172
if (ldpServerUrl.startsWith('wss')) {
136173
this.log(`\n${messages.getMessage('trust.local.dev.server')}`);

0 commit comments

Comments
 (0)