@roots/bud-client 6.5.3 → 6.6.0

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 (75) hide show
  1. package/lib/hot/client.d.ts +9 -0
  2. package/lib/hot/client.d.ts.map +1 -0
  3. package/lib/hot/client.js +170 -0
  4. package/lib/hot/components/index.d.ts +2 -0
  5. package/lib/hot/components/index.d.ts.map +1 -0
  6. package/lib/hot/components/index.js +28 -0
  7. package/lib/hot/components/indicator/index.d.ts +4 -0
  8. package/lib/hot/components/indicator/index.d.ts.map +1 -0
  9. package/lib/{components → hot/components}/indicator/index.js +0 -0
  10. package/lib/{components → hot/components}/indicator/indicator.component.d.ts +0 -0
  11. package/lib/hot/components/indicator/indicator.component.d.ts.map +1 -0
  12. package/lib/{components → hot/components}/indicator/indicator.component.js +0 -0
  13. package/lib/{components → hot/components}/indicator/indicator.controller.d.ts +0 -0
  14. package/lib/hot/components/indicator/indicator.controller.d.ts.map +1 -0
  15. package/lib/{components → hot/components}/indicator/indicator.controller.js +0 -0
  16. package/lib/{components → hot/components}/indicator/indicator.pulse.d.ts +0 -0
  17. package/lib/hot/components/indicator/indicator.pulse.d.ts.map +1 -0
  18. package/lib/{components → hot/components}/indicator/indicator.pulse.js +0 -0
  19. package/lib/hot/components/overlay/index.d.ts +4 -0
  20. package/lib/hot/components/overlay/index.d.ts.map +1 -0
  21. package/lib/{components → hot/components}/overlay/index.js +0 -0
  22. package/lib/{components → hot/components}/overlay/overlay.component.d.ts +0 -0
  23. package/lib/hot/components/overlay/overlay.component.d.ts.map +1 -0
  24. package/lib/{components → hot/components}/overlay/overlay.component.js +0 -0
  25. package/lib/{components → hot/components}/overlay/overlay.controller.d.ts +0 -0
  26. package/lib/hot/components/overlay/overlay.controller.d.ts.map +1 -0
  27. package/lib/{components → hot/components}/overlay/overlay.controller.js +10 -6
  28. package/lib/hot/events.d.ts +98 -0
  29. package/lib/hot/events.d.ts.map +1 -0
  30. package/lib/hot/events.js +95 -0
  31. package/lib/hot/index.d.ts +2 -0
  32. package/lib/hot/index.d.ts.map +1 -0
  33. package/lib/hot/index.js +23 -0
  34. package/lib/hot/log.d.ts +11 -0
  35. package/lib/hot/log.d.ts.map +1 -0
  36. package/lib/hot/log.js +45 -0
  37. package/lib/{options.d.ts → hot/options.d.ts} +2 -1
  38. package/lib/hot/options.d.ts.map +1 -0
  39. package/lib/{options.js → hot/options.js} +10 -11
  40. package/lib/index.d.mts +12 -1
  41. package/lib/index.d.mts.map +1 -1
  42. package/lib/index.d.ts +12 -1
  43. package/lib/index.d.ts.map +1 -1
  44. package/lib/index.js +2 -115
  45. package/lib/index.mjs +2 -1
  46. package/lib/{intercept.d.ts → intercept/index.d.ts} +1 -1
  47. package/lib/intercept/index.d.ts.map +1 -0
  48. package/lib/{intercept.js → intercept/index.js} +0 -0
  49. package/lib/{proxy-click-interceptor.d.ts → intercept/proxy-click-interceptor.d.ts} +0 -0
  50. package/lib/intercept/proxy-click-interceptor.d.ts.map +1 -0
  51. package/lib/{proxy-click-interceptor.js → intercept/proxy-click-interceptor.js} +2 -2
  52. package/lib/{interface.d.ts → types/index.d.ts} +27 -28
  53. package/lib/types/index.d.ts.map +1 -0
  54. package/lib/types/index.js +0 -0
  55. package/package.json +5 -13
  56. package/lib/components/index.d.ts +0 -4
  57. package/lib/components/index.d.ts.map +0 -1
  58. package/lib/components/index.js +0 -49
  59. package/lib/components/indicator/index.d.ts +0 -4
  60. package/lib/components/indicator/index.d.ts.map +0 -1
  61. package/lib/components/indicator/indicator.component.d.ts.map +0 -1
  62. package/lib/components/indicator/indicator.controller.d.ts.map +0 -1
  63. package/lib/components/indicator/indicator.pulse.d.ts.map +0 -1
  64. package/lib/components/overlay/index.d.ts +0 -4
  65. package/lib/components/overlay/index.d.ts.map +0 -1
  66. package/lib/components/overlay/overlay.component.d.ts.map +0 -1
  67. package/lib/components/overlay/overlay.controller.d.ts.map +0 -1
  68. package/lib/hmr/events.d.ts +0 -52
  69. package/lib/hmr/events.d.ts.map +0 -1
  70. package/lib/hmr/events.js +0 -100
  71. package/lib/intercept.d.ts.map +0 -1
  72. package/lib/interface.d.ts.map +0 -1
  73. package/lib/interface.js +0 -4
  74. package/lib/options.d.ts.map +0 -1
  75. package/lib/proxy-click-interceptor.d.ts.map +0 -1
@@ -6,16 +6,14 @@ exports.setFromParameters = exports.get = exports.data = void 0;
6
6
  * @public
7
7
  */
8
8
  let data = {
9
- [`default`]: {
10
- timeout: 20 * 1000,
11
- reload: true,
12
- name: `default`,
13
- debug: true,
14
- log: true,
15
- path: `/__bud/hmr`,
16
- indicator: true,
17
- overlay: true,
18
- },
9
+ timeout: 2000,
10
+ reload: true,
11
+ name: `@roots/bud-client`,
12
+ debug: true,
13
+ log: true,
14
+ indicator: true,
15
+ overlay: true,
16
+ path: `/bud/hot`,
19
17
  };
20
18
  exports.data = data;
21
19
  /**
@@ -26,6 +24,7 @@ const get = (name, key) => key ? data[name][key] : data[name];
26
24
  exports.get = get;
27
25
  /**
28
26
  * Set client data based on URL parameters
27
+ * @public
29
28
  */
30
29
  const setFromParameters = (query) => {
31
30
  let parsedParams = {};
@@ -33,7 +32,7 @@ const setFromParameters = (query) => {
33
32
  parsedParams[key] =
34
33
  value === `true` ? true : value === `false` ? false : value;
35
34
  });
36
- data[parsedParams.name] = Object.assign(Object.assign({}, data.default), parsedParams);
35
+ data[parsedParams.name] = Object.assign(Object.assign({}, data), parsedParams);
37
36
  return data[parsedParams.name];
38
37
  };
39
38
  exports.setFromParameters = setFromParameters;
package/lib/index.d.mts CHANGED
@@ -1,2 +1,13 @@
1
- import './index.js';
1
+ /**
2
+ * `@roots/bud` client scripts
3
+ *
4
+ * You should not import this root module.
5
+ * Import the components from the submodules instead.
6
+ *
7
+ * @see https://bud.js.org
8
+ * @see https://github.com/roots/bud
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ export {};
2
13
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAA"}
package/lib/index.d.ts CHANGED
@@ -1,2 +1,13 @@
1
- import './interface';
1
+ /**
2
+ * `@roots/bud` client scripts
3
+ *
4
+ * You should not import this root module.
5
+ * Import the components from the submodules instead.
6
+ *
7
+ * @see https://bud.js.org
8
+ * @see https://github.com/roots/bud
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ export {};
2
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAA"}
package/lib/index.js CHANGED
@@ -1,117 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable no-console */
3
- /* global __resourceQuery */
4
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
- if (k2 === undefined) k2 = k;
6
- var desc = Object.getOwnPropertyDescriptor(m, k);
7
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
- desc = { enumerable: true, get: function() { return m[k]; } };
9
- }
10
- Object.defineProperty(o, k2, desc);
11
- }) : (function(o, m, k, k2) {
12
- if (k2 === undefined) k2 = k;
13
- o[k2] = m[k];
14
- }));
15
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
- Object.defineProperty(o, "default", { enumerable: true, value: v });
17
- }) : function(o, v) {
18
- o["default"] = v;
19
- });
20
- var __importStar = (this && this.__importStar) || function (mod) {
21
- if (mod && mod.__esModule) return mod;
22
- var result = {};
23
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
- __setModuleDefault(result, mod);
25
- return result;
26
- };
27
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
28
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
29
- return new (P || (P = Promise))(function (resolve, reject) {
30
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
31
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
32
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
33
- step((generator = generator.apply(thisArg, _arguments || [])).next());
34
- });
35
- };
2
+ // Copyright © Roots Software Foundation LLC
3
+ // Licensed under the MIT license.
36
4
  Object.defineProperty(exports, "__esModule", { value: true });
37
- require("./interface");
38
- const components = __importStar(require("./components/index.js"));
39
- const events_js_1 = require("./hmr/events.js");
40
- const clientOptions = __importStar(require("./options"));
41
- ((queryString) => __awaiter(void 0, void 0, void 0, function* () {
42
- /**
43
- * Webpack hot interface
44
- */
45
- const webpackHot = module.hot;
46
- /* Set client options from URL params */
47
- const options = clientOptions.setFromParameters(queryString);
48
- /**
49
- * Returns true if environment supports HMR
50
- */
51
- if (typeof (window === null || window === void 0 ? void 0 : window.EventSource) === `undefined`) {
52
- console.error(`[bud] hot module reload requires EventSource to work. https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events#Tools`);
53
- return false;
54
- }
55
- /**
56
- * Webpack HMR check handler
57
- */
58
- const check = () => __awaiter(void 0, void 0, void 0, function* () {
59
- return webpackHot.status() === `idle` &&
60
- (yield webpackHot.check(false).then((modules) => __awaiter(void 0, void 0, void 0, function* () {
61
- modules && (yield update());
62
- })));
63
- });
64
- /**
65
- * Webpack HMR unaccepted module handler
66
- */
67
- const onUnacceptedOrDeclined = (info) => {
68
- console.warn(`[${options.name}] ${info.type}`, info);
69
- options.reload && window.location.reload();
70
- };
71
- /**
72
- * Webpack HMR error handler
73
- */
74
- const onErrored = error => {
75
- var _a, _b;
76
- const message = `[${(_a = error === null || error === void 0 ? void 0 : error.moduleId) !== null && _a !== void 0 ? _a : options.name}] ${(_b = error === null || error === void 0 ? void 0 : error.error) !== null && _b !== void 0 ? _b : `error`}`;
77
- console.error(message);
78
- components.controllers.map(controller => controller.update({
79
- type: `accept-errored`,
80
- action: `built`,
81
- errors: [{ message }],
82
- }));
83
- };
84
- /**
85
- * Webpack HMR update handler
86
- */
87
- const update = () => __awaiter(void 0, void 0, void 0, function* () {
88
- webpackHot.status() === `ready` &&
89
- (yield webpackHot.apply({
90
- autoApply: false,
91
- ignoreUnaccepted: true,
92
- ignoreDeclined: true,
93
- ignoreErrored: true,
94
- onErrored,
95
- onUnaccepted: onUnacceptedOrDeclined,
96
- onDeclined: onUnacceptedOrDeclined,
97
- }));
98
- });
99
- /* Instantiate eventSource */
100
- const eventSource = events_js_1.Events.make(options);
101
- /* Instantiate indicator, overlay */
102
- yield components.make(options);
103
- /* Instantiate HMR event source and register client listeners */
104
- eventSource.addMessageListener((event) => __awaiter(void 0, void 0, void 0, function* () {
105
- try {
106
- const data = JSON.parse(event.data);
107
- if (!data)
108
- return;
109
- if (data.action === `reload`)
110
- window.location.reload();
111
- components.controllers.map(controller => controller.update(data));
112
- if (__webpack_hash__ !== eventSource.currentHash)
113
- yield check();
114
- }
115
- catch (error) { }
116
- }));
117
- }))(__resourceQuery);
package/lib/index.mjs CHANGED
@@ -1,3 +1,4 @@
1
1
  "use strict";
2
+ // Copyright © Roots Software Foundation LLC
3
+ // Licensed under the MIT license.
2
4
  Object.defineProperty(exports, "__esModule", { value: true });
3
- require("./index.js");
@@ -1,3 +1,3 @@
1
1
  declare const intercept: (args_0: string, args_1: string) => void;
2
2
  export default intercept;
3
- //# sourceMappingURL=intercept.d.ts.map
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/intercept/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,SAAS,0CA2Bd,CAAA;AAED,eAAe,SAAS,CAAA"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy-click-interceptor.d.ts","sourceRoot":"","sources":["../../src/intercept/proxy-click-interceptor.ts"],"names":[],"mappings":""}
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- const intercept_1 = __importDefault(require("./intercept"));
17
+ const index_js_1 = __importDefault(require("./index.js"));
18
18
  window.requestAnimationFrame(function ready() {
19
19
  return __awaiter(this, void 0, void 0, function* () {
20
20
  if (!__resourceQuery)
@@ -25,7 +25,7 @@ window.requestAnimationFrame(function ready() {
25
25
  const search = decodeURI(params.get(`search`));
26
26
  const replace = decodeURI(params.get(`replace`));
27
27
  return document.body
28
- ? (0, intercept_1.default)(search, replace)
28
+ ? (0, index_js_1.default)(search, replace)
29
29
  : window.requestAnimationFrame(ready);
30
30
  });
31
31
  });
@@ -1,44 +1,32 @@
1
- /// <reference types="node" />
2
1
  /// <reference types="webpack-env" />
3
2
  declare var __resourceQuery: string;
4
3
  declare var __webpack_hash__: string;
5
- declare var bud: {
6
- hmr?: Record<string, Events>;
7
- };
8
- declare var module: NodeJS.Module & {
9
- hot?: {
10
- check?: CallableFunction;
11
- accept?: CallableFunction;
12
- apply?: CallableFunction;
13
- status?: CallableFunction;
14
- };
15
- };
16
- declare module global {
17
- interface Window {
18
- bud: typeof bud;
19
- }
4
+ interface Listener {
5
+ (event: Payload): void;
20
6
  }
21
- declare interface Events extends EventSource {
22
- messages: Set<string>;
23
- options: Options;
24
- currentHash: string;
25
- listeners: Set<((ev: MessageEvent) => any) | null>;
26
- addMessageListener(fn: (ev: MessageEvent) => unknown): this;
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;
27
16
  }
28
17
  declare interface Payload {
18
+ name: string;
29
19
  type: `middleware` | __WebpackModuleApi.HotNotifierInfo[`type`];
30
20
  action: 'reload' | 'sync' | 'building' | 'built';
31
21
  hash?: string;
32
22
  time?: number;
33
- errors?: Array<{
34
- title?: string;
35
- message: string;
36
- }>;
23
+ errors?: Array<Record<string, any>>;
37
24
  warnings?: Array<string>;
38
25
  message?: string;
26
+ modules?: Record<string, Array<string>>;
39
27
  }
40
28
  declare interface Controller {
41
- update: (payload: Payload) => void;
29
+ update: (payload: Partial<Payload>) => void;
42
30
  }
43
31
  declare interface Options {
44
32
  timeout: number;
@@ -50,4 +38,15 @@ declare interface Options {
50
38
  indicator: boolean;
51
39
  overlay: boolean;
52
40
  }
53
- //# sourceMappingURL=interface.d.ts.map
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
@@ -0,0 +1 @@
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
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.5.3",
4
+ "version": "6.6.0",
5
5
  "homepage": "https://roots.io/bud",
6
6
  "repository": {
7
7
  "type": "git",
@@ -37,12 +37,10 @@
37
37
  "lib/"
38
38
  ],
39
39
  "main": "./lib/index.js",
40
+ "module": "./lib/index.mjs",
40
41
  "types": "./lib/index.d.ts",
41
42
  "exports": {
42
- ".": {
43
- "import": "./lib/index.mjs",
44
- "require": "./lib/index.js"
45
- },
43
+ ".": "./lib/index.js",
46
44
  "./lib/*": "./lib/*"
47
45
  },
48
46
  "typesVersions": {
@@ -56,15 +54,9 @@
56
54
  }
57
55
  },
58
56
  "devDependencies": {
59
- "@jest/globals": "29.0.3",
60
57
  "@skypack/package-check": "0.2.2",
61
- "@types/node": "16.11.68",
62
- "@types/webpack-env": "1.18.0",
63
- "webpack": "5.74.0"
64
- },
65
- "dependencies": {
66
- "strip-ansi": "7.0.1",
67
- "tslib": "2.4.0"
58
+ "@types/node": "16.18.3",
59
+ "@types/webpack-env": "1.18.0"
68
60
  },
69
61
  "volta": {
70
62
  "extends": "../../../package.json"
@@ -1,4 +0,0 @@
1
- declare let controllers: Array<Controller>;
2
- declare const make: (options: Options) => Promise<Array<Controller>>;
3
- export { controllers, make };
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,QAAA,IAAI,WAAW,EAAE,KAAK,CAAC,UAAU,CAAM,CAAA;AAEvC,QAAA,MAAM,IAAI,EAAE,CACV,OAAO,EAAE,OAAO,KACb,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAc7B,CAAA;AAED,OAAO,EAAC,WAAW,EAAE,IAAI,EAAC,CAAA"}
@@ -1,49 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.make = exports.controllers = void 0;
36
- let controllers = [];
37
- exports.controllers = controllers;
38
- const make = (options) => __awaiter(void 0, void 0, void 0, function* () {
39
- if (options.indicator && !customElements.get(`bud-activity-indicator`)) {
40
- yield Promise.resolve().then(() => __importStar(require(`./indicator/index.js`))).then((controller) => __awaiter(void 0, void 0, void 0, function* () { return yield controller.make(); }))
41
- .then(controller => controllers.push(controller));
42
- }
43
- if (options.overlay && !customElements.get(`bud-error`)) {
44
- yield Promise.resolve().then(() => __importStar(require(`./overlay/index.js`))).then((controller) => __awaiter(void 0, void 0, void 0, function* () { return yield controller.make(); }))
45
- .then(controller => controllers.push(controller));
46
- }
47
- return controllers;
48
- });
49
- exports.make = make;
@@ -1,4 +0,0 @@
1
- export declare const make: () => Promise<{
2
- update: (data: any) => void;
3
- }>;
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/indicator/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI;2BAAwC,IAAI;EAM5D,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"indicator.component.d.ts","sourceRoot":"","sources":["../../../src/components/indicator/indicator.component.ts"],"names":[],"mappings":";AAEA;;;GAGG;AACH,qBAAa,SAAU,SAAQ,WAAW;IACxC;;;OAGG;IACI,QAAQ,EAAE,OAAO,CAAA;IAExB;;;OAGG;IACI,IAAI,EAAE,MAAM,CAA2B;IAE9C;;;OAGG;IACH,IAAW,QAAQ,WAElB;IAED;;;OAGG;IACI,WAAW,EAAE,MAAM,CAAC,KAAK,CAAA;IAEhC;;;OAGG;IACH,IAAW,SAAS,IAAI,OAAO,CAE9B;IAED;;;OAGG;IACH,IAAW,WAAW,IAAI,OAAO,CAEhC;IAED;;;OAGG;IACI,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAK9D;IAED;;;OAGG;;IAMH;;;OAGG;IACI,YAAY;IA4CnB;;;OAGG;IACI,IAAI;IAKX;;OAEG;IACI,IAAI;IAMX;;;OAGG;IACI,SAAS;IAYhB;;;OAGG;IACI,SAAS;IAYhB;;;OAGG;IACI,OAAO;IASd;;;OAGG;IACI,SAAS;IAUhB,WAAkB,kBAAkB,aAEnC;IAEM,wBAAwB;CAiBhC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"indicator.controller.d.ts","sourceRoot":"","sources":["../../../src/components/indicator/indicator.controller.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,qBAAa,UAAU;IACrB;;;OAGG;IACI,IAAI,EAAE,WAAW,CAAA;IAExB;;;OAGG;IACI,OAAO,MAAO;IAErB;;;OAGG;IACI,KAAK,EAAE,MAAM,CAAC,OAAO,CAAA;IAE5B;;;OAGG;;IAMH;;;;OAIG;IACI,OAAO;IAUd;;;;OAIG;IACI,UAAU;IAIjB;;;OAGG;IACI,MAAM,CAAC,OAAO,EAAE,OAAO;CAe/B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"indicator.pulse.d.ts","sourceRoot":"","sources":["../../../src/components/indicator/indicator.pulse.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAA;CACxD;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,SACV,MAAM,SACL,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,KACtC,MA+BF,CAAA"}
@@ -1,4 +0,0 @@
1
- export declare const make: () => Promise<{
2
- update: (data: any) => void;
3
- }>;
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/overlay/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI;2BAAwC,IAAI;EAM5D,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"overlay.component.d.ts","sourceRoot":"","sources":["../../../src/components/overlay/overlay.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,WAAW;IACjC,IAAI,EAAE,MAAM,CAAgB;IAEnC;;;;OAIG;IACI,OAAO,EAAE,GAAG,CAAA;IAEZ,iBAAiB,EAAE,GAAG,CAAA;IAE7B,IAAW,OAAO,WAEjB;;IAOM,YAAY,IAAI,IAAI;IA+G3B,WAAkB,kBAAkB,aAEnC;IAEM,wBAAwB;IAsBxB,iBAAiB;CAGzB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"overlay.controller.d.ts","sourceRoot":"","sources":["../../../src/components/overlay/overlay.controller.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,qBAAa,UAAU;IACrB;;;OAGG;IACI,OAAO,EAAE,WAAW,CAAA;IAE3B;;;OAGG;IACI,OAAO,EAAE,OAAO,CAAA;IAEvB;;;OAGG;IACH,IAAW,OAAO,IAAI,MAAM,CAQ3B;IAED;;;;OAIG;;IAMH;;;;OAIG;IACI,WAAW;IAKlB;;;;OAIG;IACI,WAAW;IAIlB;;;;OAIG;IACI,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;CAWtC"}
@@ -1,52 +0,0 @@
1
- declare type Listener = ((ev: MessageEvent) => any) | null;
2
- /**
3
- * HMR EventSource
4
- *
5
- * @public
6
- */
7
- export declare class Events extends EventSource {
8
- options: Options;
9
- /**
10
- * Current hash
11
- * @public
12
- */
13
- currentHash: string;
14
- /**
15
- * Messages
16
- */
17
- messages: Set<string>;
18
- /**
19
- * Registered listeners
20
- * @public
21
- */
22
- listeners: Set<Listener>;
23
- /**
24
- * Class constructor
25
- *
26
- * @remarks
27
- * Singleton interface, so this is private.
28
- */
29
- private constructor();
30
- /**
31
- * Singleton constructor
32
- * @public
33
- */
34
- static make(options: Options): Events;
35
- /**
36
- * EventSource `onopen` handler
37
- * @public
38
- */
39
- onopen: (ev?: Event) => Promise<void>;
40
- /**
41
- * EventSource `onmessage` handler
42
- * @public
43
- */
44
- onmessage: (payload: MessageEvent) => Promise<void>;
45
- /**
46
- * EventSource `addMessageListener` handler
47
- * @public
48
- */
49
- addMessageListener(callback: (ev: MessageEvent) => unknown): this;
50
- }
51
- export {};
52
- //# sourceMappingURL=events.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/hmr/events.ts"],"names":[],"mappings":"AAEA,aAAK,QAAQ,GAAG,CAAC,CAAC,EAAE,EAAE,YAAY,KAAK,GAAG,CAAC,GAAG,IAAI,CAAA;AAElD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IAwBV,OAAO,EAAE,OAAO;IAvB3C;;;OAGG;IACI,WAAW,EAAE,MAAM,CAAA;IAE1B;;OAEG;IACI,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAY;IAExC;;;OAGG;IACI,SAAS,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAsB;IAErD;;;;;OAKG;IACH,OAAO;IAQP;;;OAGG;WACW,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAU5C;;;OAGG;IACI,MAAM,QAAwB,KAAK,mBAEzC;IAED;;;OAGG;IACI,SAAS,YAA4B,YAAY,mBAuBvD;IAED;;;OAGG;IACI,kBAAkB,CACvB,QAAQ,EAAE,CAAC,EAAE,EAAE,YAAY,KAAK,OAAO,GACtC,IAAI;CAIR"}
package/lib/hmr/events.js DELETED
@@ -1,100 +0,0 @@
1
- "use strict";
2
- /* eslint-disable no-console */
3
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
- return new (P || (P = Promise))(function (resolve, reject) {
6
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10
- });
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.Events = void 0;
14
- /**
15
- * HMR EventSource
16
- *
17
- * @public
18
- */
19
- class Events extends EventSource {
20
- /**
21
- * Class constructor
22
- *
23
- * @remarks
24
- * Singleton interface, so this is private.
25
- */
26
- constructor(options) {
27
- super(options.path);
28
- this.options = options;
29
- /**
30
- * Messages
31
- */
32
- this.messages = new Set();
33
- /**
34
- * Registered listeners
35
- * @public
36
- */
37
- this.listeners = new Set();
38
- /**
39
- * EventSource `onopen` handler
40
- * @public
41
- */
42
- this.onopen = function (ev) {
43
- return __awaiter(this, void 0, void 0, function* () {
44
- console.log(`[bud] connected`);
45
- });
46
- };
47
- /**
48
- * EventSource `onmessage` handler
49
- * @public
50
- */
51
- this.onmessage = function (payload) {
52
- var _a, _b, _c, _d;
53
- return __awaiter(this, void 0, void 0, function* () {
54
- // @ts-ignore
55
- if (!payload)
56
- return;
57
- try {
58
- this.payload = JSON.parse(payload.data);
59
- ((_a = this.payload) === null || _a === void 0 ? void 0 : _a.action) === `reload` &&
60
- this.options.reload &&
61
- window.location.reload();
62
- if ((_b = this.payload) === null || _b === void 0 ? void 0 : _b.hash) {
63
- if (this.messages.has((_c = this.payload) === null || _c === void 0 ? void 0 : _c.hash))
64
- return;
65
- this.currentHash = (_d = this.payload) === null || _d === void 0 ? void 0 : _d.hash;
66
- this.messages.add(this.currentHash);
67
- }
68
- if (this.messages.size <= 1)
69
- return;
70
- yield Promise.all([...this.listeners].map((listener) => __awaiter(this, void 0, void 0, function* () { return yield listener(payload); })));
71
- }
72
- catch (error) { }
73
- });
74
- };
75
- this.onopen = this.onopen.bind(this);
76
- this.onmessage = this.onmessage.bind(this);
77
- this.addMessageListener = this.addMessageListener.bind(this);
78
- }
79
- /**
80
- * Singleton constructor
81
- * @public
82
- */
83
- static make(options) {
84
- if (!window.bud)
85
- window.bud = { hmr: {} };
86
- if (!window.bud.hmr[options.path]) {
87
- window.bud.hmr[options.path] = new Events(options);
88
- }
89
- return window.bud.hmr[options.path];
90
- }
91
- /**
92
- * EventSource `addMessageListener` handler
93
- * @public
94
- */
95
- addMessageListener(callback) {
96
- this.listeners.add(callback);
97
- return this;
98
- }
99
- }
100
- exports.Events = Events;
@@ -1 +0,0 @@
1
- {"version":3,"file":"intercept.d.ts","sourceRoot":"","sources":["../src/intercept.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,SAAS,0CA2Bd,CAAA;AAED,eAAe,SAAS,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":";;AAAA,QAAA,IAAI,eAAe,EAAE,MAAM,CAAA;AAE3B,QAAA,IAAI,gBAAgB,EAAE,MAAM,CAAA;AAE5B,QAAA,IAAI,GAAG,EAAE;IACP,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC7B,CAAA;AAED,QAAA,IAAI,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG;IAC1B,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,gBAAgB,CAAA;QACxB,MAAM,CAAC,EAAE,gBAAgB,CAAA;QACzB,KAAK,CAAC,EAAE,gBAAgB,CAAA;QACxB,MAAM,CAAC,EAAE,gBAAgB,CAAA;KAC1B,CAAA;CACF,CAAA;AAED,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAU,MAAM;QACd,GAAG,EAAE,OAAO,GAAG,CAAA;KAChB;CACF;AAED,OAAO,WAAW,MAAO,SAAQ,WAAW;IAC1C,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACrB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,YAAY,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,CAAA;IAClD,kBAAkB,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,YAAY,KAAK,OAAO,GAAG,IAAI,CAAA;CAC5D;AAED,OAAO,WAAW,OAAO;IACvB,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;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,CAAC,CAAA;IACjD,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACxB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,OAAO,WAAW,UAAU;IAC1B,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;CACnC;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"}
package/lib/interface.js DELETED
@@ -1,4 +0,0 @@
1
- var __resourceQuery;
2
- var __webpack_hash__;
3
- var bud;
4
- var module;
@@ -1 +0,0 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,QAAA,IAAI,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAW/B,CAAA;AAED;;;GAGG;AACH,QAAA,MAAM,GAAG,UAAW,MAAM,QAAQ,MAAM,QACJ,CAAA;AAEpC;;GAEG;AACH,QAAA,MAAM,iBAAiB,UAAW,MAAM,KAAG,OAW1C,CAAA;AAED,OAAO,EAAC,IAAI,EAAE,GAAG,EAAE,iBAAiB,EAAC,CAAA"}