From 791e9919938fb0bc69fdcaee98d56b461dc83ea6 Mon Sep 17 00:00:00 2001 From: Shane Osbourne Date: Sun, 7 Apr 2024 08:04:07 +0100 Subject: [PATCH] remove xip (#2065) Co-authored-by: Shane Osbourne --- package-lock.json | 72 +++++++++++-------- package.json | 2 +- packages/browser-sync-client/lib/types.ts | 1 - .../browser-sync-client/lib/types/types.d.ts | 1 - .../browser-sync-ui/test/opts.server.json | 3 +- .../browser-sync/cli-options/opts.start.json | 4 -- packages/browser-sync/lib/default-config.js | 17 ----- packages/browser-sync/lib/utils.ts | 17 ++--- .../test/specs/utils/utils.setUrlOptions.js | 27 ------- .../test/specs/utils/utils.xip.js | 34 --------- 10 files changed, 47 insertions(+), 131 deletions(-) delete mode 100644 packages/browser-sync/test/specs/utils/utils.xip.js diff --git a/package-lock.json b/package-lock.json index 8d97e7d01..a9c7a444f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,7 @@ "name": "browser-sync-mono", "hasInstallScript": true, "dependencies": { - "@playwright/test": "^1.37.1", + "@playwright/test": "^1.43.0", "rxjs": "^7.5.4", "zod": "^3.22.2" }, @@ -1727,21 +1727,17 @@ } }, "node_modules/@playwright/test": { - "version": "1.37.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.37.1.tgz", - "integrity": "sha512-bq9zTli3vWJo8S3LwB91U0qDNQDpEXnw7knhxLM0nwDvexQAwx9tO8iKDZSqqneVq+URd/WIoz+BALMqUTgdSg==", + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.43.0.tgz", + "integrity": "sha512-Ebw0+MCqoYflop7wVKj711ccbNlrwTBCtjY5rlbiY9kHL2bCYxq+qltK6uPsVBGGAOb033H2VO0YobcQVxoW7Q==", "dependencies": { - "@types/node": "*", - "playwright-core": "1.37.1" + "playwright": "1.43.0" }, "bin": { "playwright": "cli.js" }, "engines": { "node": ">=16" - }, - "optionalDependencies": { - "fsevents": "2.3.2" } }, "node_modules/@tootallnate/once": { @@ -1771,11 +1767,6 @@ "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", "dev": true }, - "node_modules/@types/node": { - "version": "14.18.12", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.12.tgz", - "integrity": "sha512-q4jlIR71hUpWTnGhXWcakgkZeHa3CCjcQcnuzU8M891BAWA2jHiziiWEPEkdS5pFsz7H9HJiy8BrK7tBRNrY7A==" - }, "node_modules/@types/normalize-package-data": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", @@ -6360,10 +6351,27 @@ "node": ">=8" } }, + "node_modules/playwright": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.43.0.tgz", + "integrity": "sha512-SiOKHbVjTSf6wHuGCbqrEyzlm6qvXcv7mENP+OZon1I07brfZLGdfWV0l/efAzVx7TF3Z45ov1gPEkku9q25YQ==", + "dependencies": { + "playwright-core": "1.43.0" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, "node_modules/playwright-core": { - "version": "1.37.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.37.1.tgz", - "integrity": "sha512-17EuQxlSIYCmEMwzMqusJ2ztDgJePjrbttaefgdsiqeLWidjYz9BxXaTaZWxH1J95SHGk6tjE+dwgWILJoUZfA==", + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.43.0.tgz", + "integrity": "sha512-iWFjyBUH97+pUFiyTqSLd8cDMMOS0r2ZYz2qEsPjH8/bX++sbIJT35MSwKnp1r/OQBAqC5XO99xFbJ9XClhf4w==", "bin": { "playwright-core": "cli.js" }, @@ -9403,13 +9411,11 @@ } }, "@playwright/test": { - "version": "1.37.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.37.1.tgz", - "integrity": "sha512-bq9zTli3vWJo8S3LwB91U0qDNQDpEXnw7knhxLM0nwDvexQAwx9tO8iKDZSqqneVq+URd/WIoz+BALMqUTgdSg==", + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.43.0.tgz", + "integrity": "sha512-Ebw0+MCqoYflop7wVKj711ccbNlrwTBCtjY5rlbiY9kHL2bCYxq+qltK6uPsVBGGAOb033H2VO0YobcQVxoW7Q==", "requires": { - "@types/node": "*", - "fsevents": "2.3.2", - "playwright-core": "1.37.1" + "playwright": "1.43.0" } }, "@tootallnate/once": { @@ -9436,11 +9442,6 @@ "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", "dev": true }, - "@types/node": { - "version": "14.18.12", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.12.tgz", - "integrity": "sha512-q4jlIR71hUpWTnGhXWcakgkZeHa3CCjcQcnuzU8M891BAWA2jHiziiWEPEkdS5pFsz7H9HJiy8BrK7tBRNrY7A==" - }, "@types/normalize-package-data": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", @@ -12940,10 +12941,19 @@ "find-up": "^4.0.0" } }, + "playwright": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.43.0.tgz", + "integrity": "sha512-SiOKHbVjTSf6wHuGCbqrEyzlm6qvXcv7mENP+OZon1I07brfZLGdfWV0l/efAzVx7TF3Z45ov1gPEkku9q25YQ==", + "requires": { + "fsevents": "2.3.2", + "playwright-core": "1.43.0" + } + }, "playwright-core": { - "version": "1.37.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.37.1.tgz", - "integrity": "sha512-17EuQxlSIYCmEMwzMqusJ2ztDgJePjrbttaefgdsiqeLWidjYz9BxXaTaZWxH1J95SHGk6tjE+dwgWILJoUZfA==" + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.43.0.tgz", + "integrity": "sha512-iWFjyBUH97+pUFiyTqSLd8cDMMOS0r2ZYz2qEsPjH8/bX++sbIJT35MSwKnp1r/OQBAqC5XO99xFbJ9XClhf4w==" }, "proc-log": { "version": "2.0.1", diff --git a/package.json b/package.json index 5ea7e9095..e5f20a9d8 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "lerna": "^6.1.0" }, "dependencies": { - "@playwright/test": "^1.37.1", + "@playwright/test": "^1.43.0", "rxjs": "^7.5.4", "zod": "^3.22.2" }, diff --git a/packages/browser-sync-client/lib/types.ts b/packages/browser-sync-client/lib/types.ts index 953320bb5..a498c0700 100644 --- a/packages/browser-sync-client/lib/types.ts +++ b/packages/browser-sync-client/lib/types.ts @@ -56,7 +56,6 @@ export interface InitOptions { serveStatic: any[]; scrollElementMapping: any[]; scrollProportionally: boolean; - xip: boolean; } interface ISnippetOptions { diff --git a/packages/browser-sync-client/lib/types/types.d.ts b/packages/browser-sync-client/lib/types/types.d.ts index 04164645d..e1c231bdb 100644 --- a/packages/browser-sync-client/lib/types/types.d.ts +++ b/packages/browser-sync-client/lib/types/types.d.ts @@ -60,7 +60,6 @@ interface IBrowserSyncOptions { serveStatic: any[]; scrollElementMapping: any[]; scrollProportionally: boolean; - xip: boolean; } interface ISnippetOptions { async: boolean; diff --git a/packages/browser-sync-ui/test/opts.server.json b/packages/browser-sync-ui/test/opts.server.json index bb683e416..e64551e6e 100644 --- a/packages/browser-sync-ui/test/opts.server.json +++ b/packages/browser-sync-ui/test/opts.server.json @@ -27,7 +27,6 @@ }, "open": false, "browser": "default", - "xip": false, "hostnameSuffix": false, "notify": true, "scrollProportionally": true, @@ -95,4 +94,4 @@ "path": "/browser-sync/browser-sync-client.js", "versioned": "/browser-sync/browser-sync-client.1.8.1.js" } -} \ No newline at end of file +} diff --git a/packages/browser-sync/cli-options/opts.start.json b/packages/browser-sync/cli-options/opts.start.json index f3afdce7e..e75373a00 100644 --- a/packages/browser-sync/cli-options/opts.start.json +++ b/packages/browser-sync/cli-options/opts.start.json @@ -75,10 +75,6 @@ "type": "boolean", "desc": "Show a directory listing for the server" }, - "xip": { - "type": "boolean", - "desc": "Use xip.io domain routing" - }, "tunnel": { "desc": "Use a public URL" }, diff --git a/packages/browser-sync/lib/default-config.js b/packages/browser-sync/lib/default-config.js index eca62e1c9..608d43561 100644 --- a/packages/browser-sync/lib/default-config.js +++ b/packages/browser-sync/lib/default-config.js @@ -303,14 +303,6 @@ module.exports = { * @default null */ - /** - * Some features of Browsersync (such as `xip` & `tunnel`) require an internet connection, but if you're - * working offline, you can reduce start-up time by setting this option to `false` - * @property online - * @type Boolean - * @default undefined - */ - /** * Decide which URL to open automatically when Browsersync starts. Defaults to "local" if none set. * Can be `true`, `local`, `external`, `ui`, `ui-external`, `tunnel` or `false` @@ -336,15 +328,6 @@ module.exports = { */ cors: false, - /** - * Requires an internet connection - useful for services such as [Typekit](https://typekit.com/) - * as it allows you to configure domains such as `*.xip.io` in your kit settings - * @property xip - * @type Boolean - * @default false - */ - xip: false, - hostnameSuffix: false, /** diff --git a/packages/browser-sync/lib/utils.ts b/packages/browser-sync/lib/utils.ts index bb540782a..0b4543212 100644 --- a/packages/browser-sync/lib/utils.ts +++ b/packages/browser-sync/lib/utils.ts @@ -46,14 +46,8 @@ export function getUrlOptions(options: BsTempOptions): Map { } const fn: typeof getHostIp = exports.getHostIp; - const external = xip(fn(options, devIp()), options); - let localhost = "localhost"; - - if (options.get("xip")) { - localhost = "127.0.0.1"; - } - - localhost = xip(localhost, options); + const external = hostnameSuffix(fn(options, devIp()), options); + const localhost = hostnameSuffix("localhost", options); return Immutable.fromJS(getUrls(external, localhost, scheme, options)); } @@ -231,16 +225,13 @@ export function fail(kill, errMessage, cb) { } /** - * Add support for xip.io urls + * hostnameSuffix * @param {String} host * @param {Object} options * @returns {String} */ -export function xip(host, options) { +export function hostnameSuffix(host, options) { var suffix = options.get("hostnameSuffix"); - if (options.get("xip")) { - return host + ".xip.io"; - } if (suffix) { return host + suffix; } diff --git a/packages/browser-sync/test/specs/utils/utils.setUrlOptions.js b/packages/browser-sync/test/specs/utils/utils.setUrlOptions.js index ac48d56c1..38c2098c6 100644 --- a/packages/browser-sync/test/specs/utils/utils.setUrlOptions.js +++ b/packages/browser-sync/test/specs/utils/utils.setUrlOptions.js @@ -48,33 +48,6 @@ describe("Utils: creating URLs", function() { external: "http://" + external + ":3000" }); }); - it("should return the external/local with xip", function() { - var [opts, errors] = merge({ - port: 3000, - server: true, - https: true, - online: true, - xip: true - }); - var out = utils.getUrlOptions(opts); - assert.equal(out.get("local"), "https://127.0.0.1.xip.io:3000"); - assert.equal( - out.get("external"), - "https://" + external + ".xip.io:3000" - ); - }); - it("should return the URLs when OFFLINE & XIP set", function() { - var [opts, errors] = merge({ - port: 3000, - server: true, - scheme: "http", - online: false, - xip: true - }); - assert.deepEqual(utils.getUrlOptions(opts).toJS(), { - local: "http://localhost:3000" - }); - }); it("should NOT ALLOW 'listen' and 'host' options if they differ", function() { var [opts, errors] = merge({ port: 3000, diff --git a/packages/browser-sync/test/specs/utils/utils.xip.js b/packages/browser-sync/test/specs/utils/utils.xip.js deleted file mode 100644 index 7445a69b9..000000000 --- a/packages/browser-sync/test/specs/utils/utils.xip.js +++ /dev/null @@ -1,34 +0,0 @@ -var utils = require("../../../dist/utils"); -var merge = require("../../../dist/cli/cli-options").merge; - -var assert = require("chai").assert; - -describe("Utils: Adding xip", function() { - it("can add xip.io when set in options", function() { - var host = "192.15.122.9"; - var expected = "192.15.122.9.xip.io"; - var actual = utils.xip(host, merge({ xip: true })[0]); - assert.equal(actual, expected); - }); - it("can add xip.io using hostnameSuffix", function() { - var host = "192.15.122.9"; - var expected = "192.15.122.9.xip.io"; - var actual = utils.xip(host, merge({ hostnameSuffix: ".xip.io" })[0]); - assert.equal(actual, expected); - }); - it("can add random.io using hostnameSuffix", function() { - var host = "192.15.122.9"; - var expected = "192.15.122.9.random.io"; - var actual = utils.xip( - host, - merge({ hostnameSuffix: ".random.io" })[0] - ); - assert.equal(actual, expected); - }); - it("does not add xip.io when using default option", function() { - var host = "192.15.122.9"; - var expected = "192.15.122.9"; - var actual = utils.xip(host, merge()[0]); - assert.equal(actual, expected); - }); -});