Skip to content

Commit

Permalink
remove xip (#2065)
Browse files Browse the repository at this point in the history
Co-authored-by: Shane Osbourne <sosbourne@duckduckgo.com>
  • Loading branch information
shakyShane and Shane Osbourne authored Apr 7, 2024
1 parent bf5db7a commit 791e991
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 131 deletions.
72 changes: 41 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
1 change: 0 additions & 1 deletion packages/browser-sync-client/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export interface InitOptions {
serveStatic: any[];
scrollElementMapping: any[];
scrollProportionally: boolean;
xip: boolean;
}

interface ISnippetOptions {
Expand Down
1 change: 0 additions & 1 deletion packages/browser-sync-client/lib/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ interface IBrowserSyncOptions {
serveStatic: any[];
scrollElementMapping: any[];
scrollProportionally: boolean;
xip: boolean;
}
interface ISnippetOptions {
async: boolean;
Expand Down
3 changes: 1 addition & 2 deletions packages/browser-sync-ui/test/opts.server.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
},
"open": false,
"browser": "default",
"xip": false,
"hostnameSuffix": false,
"notify": true,
"scrollProportionally": true,
Expand Down Expand Up @@ -95,4 +94,4 @@
"path": "/browser-sync/browser-sync-client.js",
"versioned": "/browser-sync/browser-sync-client.1.8.1.js"
}
}
}
4 changes: 0 additions & 4 deletions packages/browser-sync/cli-options/opts.start.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
17 changes: 0 additions & 17 deletions packages/browser-sync/lib/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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,

/**
Expand Down
17 changes: 4 additions & 13 deletions packages/browser-sync/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,8 @@ export function getUrlOptions(options: BsTempOptions): Map<string, string> {
}

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));
}
Expand Down Expand Up @@ -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;
}
Expand Down
27 changes: 0 additions & 27 deletions packages/browser-sync/test/specs/utils/utils.setUrlOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
34 changes: 0 additions & 34 deletions packages/browser-sync/test/specs/utils/utils.xip.js

This file was deleted.

0 comments on commit 791e991

Please sign in to comment.