@roots/bud-client 6.6.4 → 6.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/lib/hot/client.d.ts +1 -2
  2. package/lib/hot/client.d.ts.map +1 -1
  3. package/lib/hot/client.js +7 -32
  4. package/lib/hot/components/index.d.ts.map +1 -1
  5. package/lib/hot/components/index.js +15 -11
  6. package/lib/hot/components/indicator/index.d.ts.map +1 -1
  7. package/lib/hot/components/indicator/index.js +5 -9
  8. package/lib/hot/components/indicator/indicator.component.js +27 -31
  9. package/lib/hot/components/indicator/indicator.controller.js +1 -5
  10. package/lib/hot/components/indicator/indicator.pulse.js +1 -5
  11. package/lib/hot/components/overlay/index.js +5 -9
  12. package/lib/hot/components/overlay/overlay.component.js +4 -8
  13. package/lib/hot/components/overlay/overlay.controller.js +10 -14
  14. package/lib/hot/events.js +1 -5
  15. package/lib/hot/index.cjs +5 -0
  16. package/lib/hot/index.d.cts +2 -0
  17. package/lib/hot/index.d.cts.map +1 -0
  18. package/lib/hot/index.d.mts +2 -0
  19. package/lib/hot/index.d.mts.map +1 -0
  20. package/lib/hot/{index.js → index.mjs} +6 -12
  21. package/lib/hot/log.js +9 -17
  22. package/lib/hot/options.js +1 -6
  23. package/lib/{index.js → index.cjs} +1 -2
  24. package/lib/{index.d.ts → index.d.cts} +1 -1
  25. package/lib/index.d.cts.map +1 -0
  26. package/lib/index.mjs +1 -2
  27. package/lib/intercept/index.js +1 -3
  28. package/lib/intercept/proxy-click-interceptor.js +2 -7
  29. package/package.json +12 -14
  30. package/lib/hot/index.d.ts +0 -2
  31. package/lib/hot/index.d.ts.map +0 -1
  32. package/lib/index.d.ts.map +0 -1
  33. package/lib/types/index.d.ts +0 -52
  34. package/lib/types/index.d.ts.map +0 -1
  35. package/lib/types/index.js +0 -0
@@ -4,6 +4,5 @@
4
4
  *
5
5
  * @public
6
6
  */
7
- declare const _default: (queryString: string, webpackHot: __WebpackModuleApi.Hot) => Promise<boolean>;
8
- export default _default;
7
+ export declare const client: (queryString: string, webpackHot: __WebpackModuleApi.Hot) => Promise<boolean>;
9
8
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/hot/client.ts"],"names":[],"mappings":";AASA;;;;GAIG;sCAEY,MAAM,cACP,mBAAmB,GAAG;AAFpC,wBA+IC"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/hot/client.ts"],"names":[],"mappings":";AASA;;;;GAIG;AACH,eAAO,MAAM,MAAM,gBACJ,MAAM,cACP,mBAAmB,GAAG,qBA6InC,CAAA"}
package/lib/hot/client.js CHANGED
@@ -1,30 +1,6 @@
1
- "use strict";
2
1
  /* eslint-disable no-console */
3
2
  /* global __resourceQuery */
4
3
  /* global __webpack_hash__ */
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = { enumerable: true, get: function() { return m[k]; } };
10
- }
11
- Object.defineProperty(o, k2, desc);
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
4
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
5
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
6
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -34,17 +10,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
34
10
  step((generator = generator.apply(thisArg, _arguments || [])).next());
35
11
  });
36
12
  };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- const components = __importStar(require("./components/index.js"));
39
- const events_js_1 = require("./events.js");
40
- const log_js_1 = require("./log.js");
41
- const clientOptions = __importStar(require("./options.js"));
13
+ import * as components from './components/index.js';
14
+ import { injectEvents } from './events.js';
15
+ import { makeLogger } from './log.js';
16
+ import * as clientOptions from './options.js';
42
17
  /**
43
18
  * Initializes bud.js HMR handling
44
19
  *
45
20
  * @public
46
21
  */
47
- exports.default = (queryString, webpackHot) => __awaiter(void 0, void 0, void 0, function* () {
22
+ export const client = (queryString, webpackHot) => __awaiter(void 0, void 0, void 0, function* () {
48
23
  /* Guard: EventSource browser support */
49
24
  if (typeof (window === null || window === void 0 ? void 0 : window.EventSource) === `undefined`) {
50
25
  console.error(`[bud] hot module reload requires EventSource to work. https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events#Tools`);
@@ -58,7 +33,7 @@ exports.default = (queryString, webpackHot) => __awaiter(void 0, void 0, void 0,
58
33
  /* Set client options from URL params */
59
34
  const options = clientOptions.setFromParameters(queryString);
60
35
  /* Setup logger */
61
- const logger = (0, log_js_1.makeLogger)(options);
36
+ const logger = makeLogger(options);
62
37
  if (typeof window.bud === `undefined`) {
63
38
  window.bud = {
64
39
  current: {},
@@ -139,7 +114,7 @@ exports.default = (queryString, webpackHot) => __awaiter(void 0, void 0, void 0,
139
114
  /* Instantiate indicator, overlay */
140
115
  yield components.make(options);
141
116
  /* Instantiate eventSource */
142
- const events = (0, events_js_1.injectEvents)(EventSource).make(options);
117
+ const events = injectEvents(EventSource).make(options);
143
118
  if (!window.bud.listeners[options.name]) {
144
119
  window.bud.listeners[options.name] = (payload) => __awaiter(void 0, void 0, void 0, function* () {
145
120
  var _a;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hot/components/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,EAAE,CACjB,OAAO,EAAE,OAAO,KACb,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAgB7B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hot/components/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,EAAE,CACjB,OAAO,EAAE,OAAO,KACb,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAc7B,CAAA"}
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,21 +7,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.make = void 0;
13
- const make = (options) => __awaiter(void 0, void 0, void 0, function* () {
14
- if (window.bud.controllers.length > 0)
15
- return window.bud.controllers;
10
+ export const make = (options) => __awaiter(void 0, void 0, void 0, function* () {
16
11
  if (options.indicator && !customElements.get(`bud-activity-indicator`)) {
17
12
  yield import(`./indicator/index.js`)
18
- .then((controller) => __awaiter(void 0, void 0, void 0, function* () { return yield controller.make(); }))
19
- .then(controller => window.bud.controllers.push(controller));
13
+ .then(makeController)
14
+ .then(maybePushController);
20
15
  }
21
16
  if (options.overlay && !customElements.get(`bud-error`)) {
22
17
  yield import(`./overlay/index.js`)
23
- .then((controller) => __awaiter(void 0, void 0, void 0, function* () { return yield controller.make(); }))
24
- .then(controller => window.bud.controllers.push(controller));
18
+ .then(makeController)
19
+ .then(maybePushController);
25
20
  }
26
21
  return window.bud.controllers;
27
22
  });
28
- exports.make = make;
23
+ const makeController = (module) => __awaiter(void 0, void 0, void 0, function* () {
24
+ if (!module)
25
+ return;
26
+ return yield module.make();
27
+ });
28
+ const maybePushController = (controller) => {
29
+ if (!controller)
30
+ return;
31
+ window.bud.controllers.push(controller);
32
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hot/components/indicator/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI;mBACA,OAAO,KAAK,IAAI;EAOhC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hot/components/indicator/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI;mBACA,OAAO,KAAK,IAAI;EAMhC,CAAA"}
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,14 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.make = void 0;
13
- const indicator_component_js_1 = require("./indicator.component.js");
14
- const indicator_controller_js_1 = require("./indicator.controller.js");
15
- const make = () => __awaiter(void 0, void 0, void 0, function* () {
10
+ import { Component } from './indicator.component.js';
11
+ import { Controller } from './indicator.controller.js';
12
+ export const make = () => __awaiter(void 0, void 0, void 0, function* () {
16
13
  if (customElements.get(`bud-activity-indicator`))
17
14
  return;
18
- customElements.define(`bud-activity-indicator`, indicator_component_js_1.Component);
19
- return new indicator_controller_js_1.Controller();
15
+ customElements.define(`bud-activity-indicator`, Component);
16
+ return new Controller();
20
17
  });
21
- exports.make = make;
@@ -1,12 +1,30 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Component = void 0;
4
- const indicator_pulse_js_1 = require("./indicator.pulse.js");
1
+ import { pulse } from './indicator.pulse.js';
5
2
  /**
6
3
  * Indicator web component
7
4
  * @public
8
5
  */
9
- class Component extends HTMLElement {
6
+ export class Component extends HTMLElement {
7
+ /**
8
+ * Root div querySelector selector
9
+ * @public
10
+ */
11
+ get selector() {
12
+ return `.${this.name}`;
13
+ }
14
+ /**
15
+ * Get accessor: has errors
16
+ * @public
17
+ */
18
+ get hasErrors() {
19
+ return this.getAttribute(`has-errors`) == `true`;
20
+ }
21
+ /**
22
+ * Get accessor: has warnings
23
+ * @public
24
+ */
25
+ get hasWarnings() {
26
+ return this.getAttribute(`has-warnings`) == `true`;
27
+ }
10
28
  /**
11
29
  * Class constructor
12
30
  * @public
@@ -30,27 +48,6 @@ class Component extends HTMLElement {
30
48
  };
31
49
  this.renderShadow();
32
50
  }
33
- /**
34
- * Root div querySelector selector
35
- * @public
36
- */
37
- get selector() {
38
- return `.${this.name}`;
39
- }
40
- /**
41
- * Get accessor: has errors
42
- * @public
43
- */
44
- get hasErrors() {
45
- return this.getAttribute(`has-errors`) == `true`;
46
- }
47
- /**
48
- * Get accessor: has warnings
49
- * @public
50
- */
51
- get hasWarnings() {
52
- return this.getAttribute(`has-warnings`) == `true`;
53
- }
54
51
  /**
55
52
  * Render status indicator
56
53
  * @public
@@ -88,10 +85,10 @@ class Component extends HTMLElement {
88
85
  all .6s ease-in-out;
89
86
  }
90
87
 
91
- ${(0, indicator_pulse_js_1.pulse)(`success`, this.colors.success)}
92
- ${(0, indicator_pulse_js_1.pulse)(`error`, this.colors.error)}
93
- ${(0, indicator_pulse_js_1.pulse)(`warning`, this.colors.warn)}
94
- ${(0, indicator_pulse_js_1.pulse)(`pending`, this.colors.pending)}
88
+ ${pulse(`success`, this.colors.success)}
89
+ ${pulse(`error`, this.colors.error)}
90
+ ${pulse(`warning`, this.colors.warn)}
91
+ ${pulse(`pending`, this.colors.pending)}
95
92
 
96
93
  </style>
97
94
  `;
@@ -176,4 +173,3 @@ class Component extends HTMLElement {
176
173
  return this.onPending();
177
174
  }
178
175
  }
179
- exports.Component = Component;
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Controller = void 0;
4
1
  /**
5
2
  * Activity indicator controller
6
3
  * @public
7
4
  */
8
- class Controller {
5
+ export class Controller {
9
6
  /**
10
7
  * Initialization
11
8
  * @public
@@ -55,4 +52,3 @@ class Controller {
55
52
  this.addNode();
56
53
  }
57
54
  }
58
- exports.Controller = Controller;
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pulse = void 0;
4
1
  /**
5
2
  * CSS animation for reload indicator
6
3
  * @public
7
4
  */
8
- const pulse = (name, color) => `
5
+ export const pulse = (name, color) => `
9
6
  .${name} {
10
7
  box-shadow: 0 0 0 0 rgba(${color[0]}, ${color[1]}, ${color[2]}, ${color[3]});
11
8
  animation: ${name}__pulse 2s infinite;
@@ -37,4 +34,3 @@ const pulse = (name, color) => `
37
34
  }
38
35
  }
39
36
  `;
40
- exports.pulse = pulse;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,14 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.make = void 0;
13
- const overlay_component_js_1 = require("./overlay.component.js");
14
- const overlay_controller_js_1 = require("./overlay.controller.js");
15
- const make = () => __awaiter(void 0, void 0, void 0, function* () {
10
+ import { Component } from './overlay.component.js';
11
+ import { Controller } from './overlay.controller.js';
12
+ export const make = () => __awaiter(void 0, void 0, void 0, function* () {
16
13
  if (customElements.get(`bud-error`))
17
14
  return;
18
- customElements.define(`bud-error`, overlay_component_js_1.Component);
19
- return new overlay_controller_js_1.Controller();
15
+ customElements.define(`bud-error`, Component);
16
+ return new Controller();
20
17
  });
21
- exports.make = make;
@@ -1,20 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Component = void 0;
4
1
  /**
5
2
  * Component container
6
3
  *
7
4
  * @public
8
5
  */
9
- class Component extends HTMLElement {
6
+ export class Component extends HTMLElement {
7
+ get message() {
8
+ return this.getAttribute(`message`);
9
+ }
10
10
  constructor() {
11
11
  super();
12
12
  this.name = `bud-overlay`;
13
13
  this.renderShadow();
14
14
  }
15
- get message() {
16
- return this.getAttribute(`message`);
17
- }
18
15
  renderShadow() {
19
16
  const container = document.createElement(`div`);
20
17
  container.classList.add(`overlay`);
@@ -149,4 +146,3 @@ class Component extends HTMLElement {
149
146
  this.documentBodyStyle = document.body.style;
150
147
  }
151
148
  }
152
- exports.Component = Component;
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Controller = void 0;
4
1
  const ansiPattern = [
5
2
  `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)`,
6
3
  `(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))`,
@@ -10,16 +7,7 @@ const stripAnsi = (body) => { var _a, _b; return (_b = (_a = body === null || bo
10
7
  * Overlay controller
11
8
  * @public
12
9
  */
13
- class Controller {
14
- /**
15
- * Class constructor
16
- *
17
- * @public
18
- */
19
- constructor() {
20
- this.update = this.update.bind(this);
21
- this.element = document.createElement(`bud-error`);
22
- }
10
+ export class Controller {
23
11
  /**
24
12
  * Formatted error message
25
13
  * @public
@@ -37,6 +25,15 @@ class Controller {
37
25
  </div>`;
38
26
  }, ``);
39
27
  }
28
+ /**
29
+ * Class constructor
30
+ *
31
+ * @public
32
+ */
33
+ constructor() {
34
+ this.update = this.update.bind(this);
35
+ this.element = document.createElement(`bud-error`);
36
+ }
40
37
  /**
41
38
  * Append `bud-error` element to the DOM
42
39
  *
@@ -71,4 +68,3 @@ class Controller {
71
68
  this.removeError();
72
69
  }
73
70
  }
74
- exports.Controller = Controller;
package/lib/hot/events.js CHANGED
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /* eslint-disable no-console */
3
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -9,9 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
10
9
  });
11
10
  };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.injectEvents = void 0;
14
- const injectEvents = (eventSource) => {
11
+ export const injectEvents = (eventSource) => {
15
12
  /**
16
13
  * EventSource wrapper
17
14
  *
@@ -92,4 +89,3 @@ const injectEvents = (eventSource) => {
92
89
  }
93
90
  };
94
91
  };
95
- exports.injectEvents = injectEvents;
@@ -0,0 +1,5 @@
1
+ /* eslint-disable no-console */
2
+ /* global __resourceQuery */
3
+ /* global module */
4
+ import { client } from './client.js';
5
+ client(__resourceQuery, module.hot);
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/hot/index.cts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/hot/index.mts"],"names":[],"mappings":""}
@@ -1,6 +1,6 @@
1
- "use strict";
2
1
  /* eslint-disable no-console */
3
2
  /* global __resourceQuery */
3
+ /* global module */
4
4
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5
5
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6
6
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -10,14 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  step((generator = generator.apply(thisArg, _arguments || [])).next());
11
11
  });
12
12
  };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- const client_js_1 = __importDefault(require("./client.js"));
18
- // @ts-ignore
19
- const webpackHot = import.meta
20
- ? // @ts-ignore
21
- import.meta.webpackHot
22
- : module.hot;
23
- (() => __awaiter(void 0, void 0, void 0, function* () { return yield (0, client_js_1.default)(__resourceQuery, webpackHot); }))();
13
+ ;
14
+ (() => __awaiter(void 0, void 0, void 0, function* () {
15
+ return yield import(`./client.js`).then((module) => __awaiter(void 0, void 0, void 0, function* () { return yield module.client(__resourceQuery, import.meta.webpackHot); }));
16
+ }))();
17
+ export {};
package/lib/hot/log.js CHANGED
@@ -1,18 +1,14 @@
1
- "use strict";
2
1
  /* eslint-disable no-console */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.makeWarn = exports.makeError = exports.makeInfo = exports.makeLog = exports.makeLogger = void 0;
5
- const makeLogger = (options) => {
2
+ export const makeLogger = (options) => {
6
3
  return {
7
- log: (0, exports.makeLog)(options),
8
- error: (0, exports.makeError)(options),
9
- warn: (0, exports.makeWarn)(options),
10
- info: (0, exports.makeInfo)(options),
4
+ log: makeLog(options),
5
+ error: makeError(options),
6
+ warn: makeWarn(options),
7
+ info: makeInfo(options),
11
8
  };
12
9
  };
13
- exports.makeLogger = makeLogger;
14
10
  let lastLog = null;
15
- const makeLog = options => {
11
+ export const makeLog = options => {
16
12
  return (...args) => {
17
13
  if (options.log) {
18
14
  if (lastLog === args.join(``))
@@ -22,24 +18,20 @@ const makeLog = options => {
22
18
  }
23
19
  };
24
20
  };
25
- exports.makeLog = makeLog;
26
- const makeInfo = options => {
21
+ export const makeInfo = options => {
27
22
  return (...args) => {
28
23
  if (options.log) {
29
24
  console.info(`[${options.name}]`, ...args);
30
25
  }
31
26
  };
32
27
  };
33
- exports.makeInfo = makeInfo;
34
- const makeError = options => {
28
+ export const makeError = options => {
35
29
  return (...args) => {
36
30
  console.error(`[${options.name}]`, ...args);
37
31
  };
38
32
  };
39
- exports.makeError = makeError;
40
- const makeWarn = options => {
33
+ export const makeWarn = options => {
41
34
  return (...args) => {
42
35
  console.warn(`[${options.name}]`, ...args);
43
36
  };
44
37
  };
45
- exports.makeWarn = makeWarn;
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setFromParameters = exports.get = exports.data = void 0;
4
1
  /**
5
2
  * Client options
6
3
  * @public
@@ -15,13 +12,11 @@ let data = {
15
12
  overlay: true,
16
13
  path: `/bud/hot`,
17
14
  };
18
- exports.data = data;
19
15
  /**
20
16
  * Get client option
21
17
  * @public
22
18
  */
23
19
  const get = (name, key) => key ? data[name][key] : data[name];
24
- exports.get = get;
25
20
  /**
26
21
  * Set client data based on URL parameters
27
22
  * @public
@@ -35,4 +30,4 @@ const setFromParameters = (query) => {
35
30
  data[parsedParams.name] = Object.assign(Object.assign({}, data), parsedParams);
36
31
  return data[parsedParams.name];
37
32
  };
38
- exports.setFromParameters = setFromParameters;
33
+ export { data, get, setFromParameters };
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright © Roots Software Foundation LLC
3
2
  // Licensed under the MIT license.
4
- Object.defineProperty(exports, "__esModule", { value: true });
3
+ export {};
@@ -10,4 +10,4 @@
10
10
  * @packageDocumentation
11
11
  */
12
12
  export {};
13
- //# sourceMappingURL=index.d.ts.map
13
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.cts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAA"}
package/lib/index.mjs CHANGED
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright © Roots Software Foundation LLC
3
2
  // Licensed under the MIT license.
4
- Object.defineProperty(exports, "__esModule", { value: true });
3
+ export {};
@@ -1,5 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  const intercept = (...args) => {
4
2
  args.every(arg => typeof arg === `string`) &&
5
3
  setInterval(() => [
@@ -17,4 +15,4 @@ const intercept = (...args) => {
17
15
  el.toggleAttribute(`__bud_processed`);
18
16
  })), 1000);
19
17
  };
20
- exports.default = intercept;
18
+ export default intercept;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /* eslint-disable no-console */
3
2
  /* global __resourceQuery */
4
3
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -10,11 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
9
  step((generator = generator.apply(thisArg, _arguments || [])).next());
11
10
  });
12
11
  };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- const index_js_1 = __importDefault(require("./index.js"));
12
+ import intercept from './index.js';
18
13
  window.requestAnimationFrame(function ready() {
19
14
  return __awaiter(this, void 0, void 0, function* () {
20
15
  if (!__resourceQuery)
@@ -25,7 +20,7 @@ window.requestAnimationFrame(function ready() {
25
20
  const search = decodeURI(params.get(`search`));
26
21
  const replace = decodeURI(params.get(`replace`));
27
22
  return document.body
28
- ? (0, index_js_1.default)(search, replace)
23
+ ? intercept(search, replace)
29
24
  : window.requestAnimationFrame(ready);
30
25
  });
31
26
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@roots/bud-client",
3
3
  "description": "Client scripts for @roots/bud",
4
- "version": "6.6.4",
4
+ "version": "6.6.6",
5
5
  "homepage": "https://roots.io/bud",
6
6
  "repository": {
7
7
  "type": "git",
@@ -36,26 +36,24 @@
36
36
  "files": [
37
37
  "lib/"
38
38
  ],
39
- "main": "./lib/index.js",
39
+ "main": "./lib/index.cjs",
40
40
  "module": "./lib/index.mjs",
41
41
  "types": "./lib/index.d.ts",
42
42
  "exports": {
43
- ".": "./lib/index.js",
44
- "./lib/*": "./lib/*"
45
- },
46
- "typesVersions": {
47
- "*": {
48
- ".": [
49
- "./lib/index.d.ts"
50
- ],
51
- "./lib/*": [
52
- "./lib/*.d.ts"
53
- ]
43
+ ".": {
44
+ "types": "./lib/index.d.mts",
45
+ "require": "./lib/index.cjs",
46
+ "default": "./lib/index.mjs"
47
+ },
48
+ "./lib/*": {
49
+ "types": "./lib/*.d.mts",
50
+ "require": "./lib/*",
51
+ "default": "./lib/*"
54
52
  }
55
53
  },
56
54
  "devDependencies": {
57
55
  "@skypack/package-check": "0.2.2",
58
- "@types/node": "16.18.3",
56
+ "@types/node": "16.18.6",
59
57
  "@types/webpack-env": "1.18.0"
60
58
  },
61
59
  "volta": {
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hot/index.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAA"}
@@ -1,52 +0,0 @@
1
- /// <reference types="webpack-env" />
2
- declare var __resourceQuery: string;
3
- declare var __webpack_hash__: string;
4
- interface Listener {
5
- (event: Payload): void;
6
- }
7
- declare interface Events {
8
- options: Partial<Options> & {
9
- name: string;
10
- path: string;
11
- };
12
- listeners: Set<Listener>;
13
- addListener(fn: Listener): this;
14
- onopen: (ev?: Event) => void;
15
- onmessage: (ev?: MessageEvent) => void;
16
- }
17
- declare interface Payload {
18
- name: string;
19
- type: `middleware` | __WebpackModuleApi.HotNotifierInfo[`type`];
20
- action: 'reload' | 'sync' | 'building' | 'built';
21
- hash?: string;
22
- time?: number;
23
- errors?: Array<Record<string, any>>;
24
- warnings?: Array<string>;
25
- message?: string;
26
- modules?: Record<string, Array<string>>;
27
- }
28
- declare interface Controller {
29
- update: (payload: Partial<Payload>) => void;
30
- }
31
- declare interface Options {
32
- timeout: number;
33
- reload: boolean;
34
- debug: boolean;
35
- log: boolean;
36
- name: string;
37
- path: string;
38
- indicator: boolean;
39
- overlay: boolean;
40
- }
41
- declare var bud: {
42
- current?: Record<string, string>;
43
- controllers?: Array<Controller>;
44
- hmr?: Record<string, Events & EventSource>;
45
- listeners?: Record<string, Listener>;
46
- };
47
- declare module global {
48
- interface Window {
49
- bud: typeof bud;
50
- }
51
- }
52
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,IAAI,eAAe,EAAE,MAAM,CAAA;AACnC,OAAO,CAAC,IAAI,gBAAgB,EAAE,MAAM,CAAA;AAEpC,UAAU,QAAQ;IAChB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;CACvB;AAED,OAAO,WAAW,MAAM;IACtB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAA;IACxD,SAAS,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAA;IACxB,WAAW,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAAA;IAC/B,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,KAAK,IAAI,CAAA;IAC5B,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,YAAY,KAAK,IAAI,CAAA;CACvC;AAED,OAAO,WAAW,OAAO;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,YAAY,GAAG,kBAAkB,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;IAC/D,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,CAAA;IAChD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;IACnC,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACxB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAA;CACxC;AAED,OAAO,WAAW,UAAU;IAC1B,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;CAC5C;AAED,OAAO,WAAW,OAAO;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;IACd,GAAG,EAAE,OAAO,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,OAAO,CAAC,IAAI,GAAG,EAAE;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,WAAW,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAA;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,CAAA;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;CACrC,CAAA;AAED,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAU,MAAM;QACd,GAAG,EAAE,OAAO,GAAG,CAAA;KAChB;CACF"}
File without changes