diff --git a/package.json b/package.json index 7242736..a78872d 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "bugs": "https://github.com/forcedotcom/cli/issues", "dependencies": { "@lwrjs/api": "0.13.0-alpha.22", - "@lwc/lwc-dev-server": "^8.1.1", + "@lwc/lwc-dev-server": "^9.0.0", "@lwc/sfdc-lwc-compiler": "^8.1.1", "@oclif/core": "^4.0.7", "@salesforce/core": "^8.1.0", diff --git a/src/commands/lightning/preview/app.ts b/src/commands/lightning/preview/app.ts index 96d414f..a50c3f2 100644 --- a/src/commands/lightning/preview/app.ts +++ b/src/commands/lightning/preview/app.ts @@ -226,15 +226,14 @@ export default class LightningPreviewApp extends SfCommand { targetOrg = this.argv[idx + 1]; } - const protocol = new URL(ldpServerUrl).protocol.replace(':', '').toLowerCase(); - if (protocol === 'wss') { + if (ldpServerUrl.startsWith('wss')) { this.log(`\n${messages.getMessage('trust.local.dev.server')}`); } const launchArguments = PreviewUtils.generateDesktopPreviewLaunchArguments(ldpServerUrl, appId, targetOrg); // Start the LWC Dev Server - await startLWCServer(logger, sfdxProjectRootPath, serverPort, protocol); + await startLWCServer(logger, sfdxProjectRootPath, serverPort); // Open the browser and navigate to the right page await this.config.runCommand('org:open', launchArguments); @@ -317,8 +316,7 @@ export default class LightningPreviewApp extends SfCommand { } // Start the LWC Dev Server - const protocol = new URL(ldpServerUrl).protocol.replace(':', '').toLowerCase(); - await startLWCServer(logger, sfdxProjectRootPath, serverPort, protocol, certData); + await startLWCServer(logger, sfdxProjectRootPath, serverPort, certData); // Launch the native app for previewing (launchMobileApp will show its own spinner) // eslint-disable-next-line camelcase diff --git a/src/lwc-dev-server/index.ts b/src/lwc-dev-server/index.ts index 2678afc..bccbc1c 100644 --- a/src/lwc-dev-server/index.ts +++ b/src/lwc-dev-server/index.ts @@ -47,7 +47,6 @@ async function createLWCServerConfig( logger: Logger, rootDir: string, serverPort?: number, - serverProtocol?: string, certData?: SSLCertificateData, workspace?: Workspace, token?: string @@ -81,12 +80,9 @@ async function createLWCServerConfig( rootDir, // use custom port if any is provided, or fetch from config file (if any), otherwise use the default port port: serverPort ?? (await ConfigUtils.getLocalDevServerPort()) ?? LOCAL_DEV_SERVER_DEFAULT_PORT, - protocol: serverProtocol ?? 'ws', - host: 'localhost', paths: namespacePaths, // use custom workspace if any is provided, or fetch from config file (if any), otherwise use the default workspace workspace: workspace ?? (await ConfigUtils.getLocalDevServerWorkspace()) ?? LOCAL_DEV_SERVER_DEFAULT_WORKSPACE, - targets: ['LEX'], // should this be something else? identityToken: token ?? (await ConfigUtils.getOrCreateIdentityToken()), logLevel: mapLogLevel(logger.getLevel()), }; @@ -105,12 +101,11 @@ export async function startLWCServer( logger: Logger, rootDir: string, serverPort?: number, - serverProtocol?: string, certData?: SSLCertificateData, workspace?: Workspace, token?: string ): Promise { - const config = await createLWCServerConfig(logger, rootDir, serverPort, serverProtocol, certData, workspace, token); + const config = await createLWCServerConfig(logger, rootDir, serverPort, certData, workspace, token); logger.trace(`Starting LWC Dev Server with config: ${JSON.stringify(config)}`); let lwcDevServer: LWCServer | null = await startLwcDevServer(config); diff --git a/yarn.lock b/yarn.lock index b426c20..2c39e57 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2851,6 +2851,13 @@ dependencies: magic-string "~0.30.10" +"@lwc/dev-server-plugin-lex@9.0.0": + version "9.0.0" + resolved "https://registry.yarnpkg.com/@lwc/dev-server-plugin-lex/-/dev-server-plugin-lex-9.0.0.tgz#9bbafe454e6356c9a4109f72356d6f0ed2a20875" + integrity sha512-1+cPX0zA+GxxXI9LTEDcD8c0w3mjY3OIzeVqkueMh0rhxUkE2v3BYhs9+r2bFniyzLKPpY9SCHZav+vmlt+B3Q== + dependencies: + magic-string "~0.30.10" + "@lwc/engine-core@7.0.1": version "7.0.1" resolved "https://registry.yarnpkg.com/@lwc/engine-core/-/engine-core-7.0.1.tgz#eecd67e829355778da01575713fbadd4f8c1856c" @@ -2897,12 +2904,12 @@ dependencies: "@lwc/shared" "7.0.1" -"@lwc/lwc-dev-server@^8.1.1": - version "8.1.1" - resolved "https://registry.yarnpkg.com/@lwc/lwc-dev-server/-/lwc-dev-server-8.1.1.tgz#316b8f528c45a7f6d59e5690da3aed7c1b584cf1" - integrity sha512-UEVwli86NOIcXqvSRprq0OwUWun2VXBdExo6pB7MV+dsPLQr4ipekWlrq28XMSqhao0ONQeqWSvN39ZDoEnW9w== +"@lwc/lwc-dev-server@^9.0.0": + version "9.0.0" + resolved "https://registry.yarnpkg.com/@lwc/lwc-dev-server/-/lwc-dev-server-9.0.0.tgz#a47c6fab5da1990d4734d5346f611ca70a63951c" + integrity sha512-T3wKTOlbmYOPzqm8IJYe/MYTpR8xyaOQa08FGkrn4sKqg/w5MplSTYUX66mWVGFPb1aqtox7YzmybY630MZPKg== dependencies: - "@lwc/sfdc-lwc-compiler" "8.1.1" + "@lwc/sfdc-lwc-compiler" "9.0.0" chalk "~5.3.0" chokidar "~3.6.0" commander "~10.0.0" @@ -2921,6 +2928,19 @@ postcss-selector-parser "~6.0.16" postcss-value-parser "~4.2.0" +"@lwc/metadata@9.0.0": + version "9.0.0" + resolved "https://registry.yarnpkg.com/@lwc/metadata/-/metadata-9.0.0.tgz#1c63ae6604fd427860a68fd0bb32bb80bf708df7" + integrity sha512-Go1LKYHM4wlv7i/fbWN5GGV9WzrmGZCjFPI4m+o0kFGRE643ei7vPAQeBpHolM9Ama5PBzy+eOnAq6qqt7zncQ== + dependencies: + "@babel/parser" "~7.24.4" + "@babel/traverse" "~7.24.1" + "@babel/types" "~7.24.0" + "@lwc/sfdc-compiler-utils" "9.0.0" + postcss "~8.4.38" + postcss-selector-parser "~6.0.16" + postcss-value-parser "~4.2.0" + "@lwc/module-resolver@7.0.1": version "7.0.1" resolved "https://registry.yarnpkg.com/@lwc/module-resolver/-/module-resolver-7.0.1.tgz#e681418b6976c9781673e218436983d1cc41b711" @@ -2942,7 +2962,49 @@ resolved "https://registry.yarnpkg.com/@lwc/sfdc-compiler-utils/-/sfdc-compiler-utils-8.1.1.tgz#56de49fc198722935f0c156495ec584335d2965c" integrity sha512-SZIz5JJwroiC4IxwU55YC5cJf4EQQzF4Z6sxFYG2KK8bPAf7Qx2+7h8SJ0sTkU1E12hqGncj33Zdrr65G5UBmg== -"@lwc/sfdc-lwc-compiler@8.1.1", "@lwc/sfdc-lwc-compiler@^8.1.1": +"@lwc/sfdc-compiler-utils@9.0.0": + version "9.0.0" + resolved "https://registry.yarnpkg.com/@lwc/sfdc-compiler-utils/-/sfdc-compiler-utils-9.0.0.tgz#d7b1245db3066cd5a5ec394cb9f528a162cb1f15" + integrity sha512-O/KUuM9lTMh5X2Z9A//06b6WgV+Ht7qQBbMoehPoUeEv9Gg0o0s350a5UcHfi4D16d8QrpmiKZT6khkAJwFy7A== + +"@lwc/sfdc-lwc-compiler@9.0.0": + version "9.0.0" + resolved "https://registry.yarnpkg.com/@lwc/sfdc-lwc-compiler/-/sfdc-lwc-compiler-9.0.0.tgz#75b42064249ba5ca8bd8469c951b3cc989c06958" + integrity sha512-oKJxY3JP0hbTglrW2ThSK/VzGpFREdgAq+daS+91NKmtBZaNuFzSZARPQa5lqzHhNl2fj6t8mgyMlJPnKDo70g== + dependencies: + "@babel/core" "7.24.5" + "@babel/parser" "7.24.5" + "@babel/plugin-syntax-decorators" "7.24.1" + "@babel/preset-typescript" "7.24.1" + "@babel/traverse" "7.24.5" + "@babel/types" "7.24.5" + "@komaci/esm-generator" "250.0.0" + "@lwc/dev-server-plugin-lex" "9.0.0" + "@lwc/eslint-plugin-lwc" "~1.8.1" + "@lwc/eslint-plugin-lwc-platform" "~4.1.3" + "@lwc/metadata" "9.0.0" + "@lwc/sfdc-compiler-utils" "9.0.0" + "@rollup/plugin-babel" "^6.0.3" + "@rollup/plugin-replace" "^5.0.5" + "@salesforce/eslint-config-lwc" "~3.5.3" + "@salesforce/eslint-plugin-lightning" "~1.0.0" + "@swc/wasm" "1.4.16" + astring "~1.8.6" + doctrine "~3.0.0" + eslint "~8.57.0" + eslint-plugin-import "~2.29.1" + eslint-plugin-jest "~27.9.0" + gray-matter "~4.0.3" + line-column "~1.0.2" + magic-string "~0.30.10" + markdown-it "~14.1.0" + parse5-sax-parser "~6.0.1" + postcss "~8.4.38" + postcss-selector-parser "~6.0.16" + rollup "~3.29.2" + terser "~5.30.4" + +"@lwc/sfdc-lwc-compiler@^8.1.1": version "8.1.1" resolved "https://registry.yarnpkg.com/@lwc/sfdc-lwc-compiler/-/sfdc-lwc-compiler-8.1.1.tgz#6beef2132129b1599b77bd61a74bfd577f0c53fb" integrity sha512-hDop0pDPFbe1I8nI3GFud0cxqQxhNDBmxez3OHVcvAU1IVxcUkJY9bcF/sUa/Fm8GVJojju+3zuSFu7w9rK/gg== @@ -14078,16 +14140,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -14183,14 +14236,7 @@ stringify-entities@^3.0.1: character-entities-legacy "^1.0.0" xtend "^4.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -15480,7 +15526,7 @@ workerpool@6.2.1: resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -15498,15 +15544,6 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"