@builder.io/sdk 3.0.2-2 → 3.0.2

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 (40) hide show
  1. package/.yarnrc.yml +1 -0
  2. package/CHANGELOG.md +6 -0
  3. package/dist/index.browser.js +13 -5
  4. package/dist/index.browser.js.map +1 -1
  5. package/dist/index.cjs.js +13 -5
  6. package/dist/index.cjs.js.map +1 -1
  7. package/dist/index.esm.js +13 -5
  8. package/dist/index.esm.js.map +1 -1
  9. package/dist/index.js +13 -49
  10. package/dist/index.umd.js +13 -5
  11. package/dist/index.umd.js.map +1 -1
  12. package/dist/package.json +3 -3
  13. package/dist/src/builder.class.js +12 -4
  14. package/dist/src/builder.class.js.map +1 -1
  15. package/dist/src/builder.class.test.js +153 -171
  16. package/dist/src/classes/animator.class.js +195 -218
  17. package/dist/src/classes/observable.class.js +97 -102
  18. package/dist/src/classes/promise.class.js +154 -150
  19. package/dist/src/classes/query-string.class.js +74 -73
  20. package/dist/src/classes/query-string.class.test.js +20 -20
  21. package/dist/src/constants/builder.js +4 -4
  22. package/dist/src/functions/assign.function.js +19 -19
  23. package/dist/src/functions/fetch.function.js +75 -97
  24. package/dist/src/functions/finder.function.js +274 -389
  25. package/dist/src/functions/next-tick.function.js +23 -26
  26. package/dist/src/functions/omit.function.js +13 -13
  27. package/dist/src/functions/server-only-require.function.js +9 -10
  28. package/dist/src/functions/throttle.function.js +37 -35
  29. package/dist/src/functions/to-error.js +6 -5
  30. package/dist/src/functions/uuid.js +8 -9
  31. package/dist/src/types/api-version.js +3 -3
  32. package/dist/src/types/content.js +3 -3
  33. package/dist/src/types/element.js +3 -3
  34. package/dist/src/url.js +42 -41
  35. package/dist/src/url.test.js +118 -222
  36. package/dist/tsconfig.tsbuildinfo +1 -1
  37. package/package.json +5 -6
  38. package/dist/src/functions/get-top-level-domain.d.ts +0 -6
  39. package/dist/src/functions/get-top-level-domain.js +0 -17
  40. package/dist/src/functions/get-top-level-domain.js.map +0 -1
@@ -1,107 +1,85 @@
1
- 'use strict';
2
- var __importDefault =
3
- (this && this.__importDefault) ||
4
- function (mod) {
5
- return mod && mod.__esModule ? mod : { default: mod };
6
- };
7
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
8
6
  exports.getFetch = void 0;
9
- var promise_class_1 = __importDefault(require('../classes/promise.class'));
10
- var server_only_require_function_1 = __importDefault(require('./server-only-require.function'));
7
+ var promise_class_1 = __importDefault(require("../classes/promise.class"));
8
+ var server_only_require_function_1 = __importDefault(require("./server-only-require.function"));
11
9
  function promiseResolve(value) {
12
- return new promise_class_1.default(function (resolve) {
13
- return resolve(value);
14
- });
10
+ return new promise_class_1.default(function (resolve) { return resolve(value); });
15
11
  }
16
12
  // Adapted from https://raw.githubusercontent.com/developit/unfetch/master/src/index.mjs
17
13
  function tinyFetch(url, options) {
18
- if (options === void 0) {
19
- options = {};
20
- }
21
- return new promise_class_1.default(function (resolve, reject) {
22
- var request = new XMLHttpRequest();
23
- request.open(options.method || 'get', url, true);
24
- if (options.headers) {
25
- for (var i in options.headers) {
26
- request.setRequestHeader(i, options.headers[i]);
27
- }
28
- }
29
- request.withCredentials = options.credentials === 'include';
30
- request.onload = function () {
31
- resolve(response());
32
- };
33
- request.onerror = reject;
34
- request.send(options.body);
35
- function response() {
36
- var keys = [];
37
- var all = [];
38
- var headers = {};
39
- var header = undefined;
40
- request
41
- .getAllResponseHeaders()
42
- .replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function (_match, _key, value) {
43
- var key = _key;
44
- keys.push((key = key.toLowerCase()));
45
- all.push([key, value]);
46
- header = headers[key];
47
- headers[key] = header ? ''.concat(header, ',').concat(value) : value;
48
- return '';
49
- });
50
- return {
51
- ok: ((request.status / 100) | 0) === 2,
52
- status: request.status,
53
- statusText: request.statusText,
54
- url: request.responseURL,
55
- clone: response,
56
- text: function () {
57
- return promiseResolve(request.responseText);
58
- },
59
- json: function () {
60
- return promiseResolve(request.responseText).then(JSON.parse);
61
- },
62
- blob: function () {
63
- return promiseResolve(new Blob([request.response]));
64
- },
65
- headers: {
66
- keys: function () {
67
- return keys;
68
- },
69
- entries: function () {
70
- return all;
71
- },
72
- get: function (n) {
73
- return headers[n.toLowerCase()];
74
- },
75
- has: function (n) {
76
- return n.toLowerCase() in headers;
77
- },
78
- },
79
- };
80
- }
81
- });
14
+ if (options === void 0) { options = {}; }
15
+ return new promise_class_1.default(function (resolve, reject) {
16
+ var request = new XMLHttpRequest();
17
+ request.open(options.method || 'get', url, true);
18
+ if (options.headers) {
19
+ for (var i in options.headers) {
20
+ request.setRequestHeader(i, options.headers[i]);
21
+ }
22
+ }
23
+ request.withCredentials = options.credentials === 'include';
24
+ request.onload = function () {
25
+ resolve(response());
26
+ };
27
+ request.onerror = reject;
28
+ request.send(options.body);
29
+ function response() {
30
+ var keys = [];
31
+ var all = [];
32
+ var headers = {};
33
+ var header = undefined;
34
+ request
35
+ .getAllResponseHeaders()
36
+ .replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function (_match, _key, value) {
37
+ var key = _key;
38
+ keys.push((key = key.toLowerCase()));
39
+ all.push([key, value]);
40
+ header = headers[key];
41
+ headers[key] = header ? "".concat(header, ",").concat(value) : value;
42
+ return '';
43
+ });
44
+ return {
45
+ ok: ((request.status / 100) | 0) === 2,
46
+ status: request.status,
47
+ statusText: request.statusText,
48
+ url: request.responseURL,
49
+ clone: response,
50
+ text: function () { return promiseResolve(request.responseText); },
51
+ json: function () { return promiseResolve(request.responseText).then(JSON.parse); },
52
+ blob: function () { return promiseResolve(new Blob([request.response])); },
53
+ headers: {
54
+ keys: function () { return keys; },
55
+ entries: function () { return all; },
56
+ get: function (n) { return headers[n.toLowerCase()]; },
57
+ has: function (n) { return n.toLowerCase() in headers; },
58
+ },
59
+ };
60
+ }
61
+ });
82
62
  }
83
63
  function getFetch() {
84
- // If fetch is defined, in the browser, via polyfill, or in a Cloudflare worker, use it.
85
- var _fetch = undefined;
86
- if (globalThis.fetch) {
87
- _fetch !== null && _fetch !== void 0 ? _fetch : (_fetch = globalThis.fetch);
88
- } else if (typeof window === 'undefined') {
89
- // If fetch is not defined, in a Node.js environment, use node-fetch.
90
- try {
91
- // node-fetch@^3 is ESM only, and will throw error on require.
92
- _fetch !== null && _fetch !== void 0
93
- ? _fetch
94
- : (_fetch = (0, server_only_require_function_1.default)('node-fetch'));
95
- } catch (e) {
96
- // If node-fetch is not installed, use tiny-fetch.
97
- console.warn(
98
- 'node-fetch is not installed. consider polyfilling fetch or installing node-fetch.'
99
- );
100
- console.warn(e);
64
+ // If fetch is defined, in the browser, via polyfill, or in a Cloudflare worker, use it.
65
+ var _fetch = undefined;
66
+ if (globalThis.fetch) {
67
+ _fetch !== null && _fetch !== void 0 ? _fetch : (_fetch = globalThis.fetch);
68
+ }
69
+ else if (typeof window === 'undefined') {
70
+ // If fetch is not defined, in a Node.js environment, use node-fetch.
71
+ try {
72
+ // node-fetch@^3 is ESM only, and will throw error on require.
73
+ _fetch !== null && _fetch !== void 0 ? _fetch : (_fetch = (0, server_only_require_function_1.default)('node-fetch'));
74
+ }
75
+ catch (e) {
76
+ // If node-fetch is not installed, use tiny-fetch.
77
+ console.warn('node-fetch is not installed. consider polyfilling fetch or installing node-fetch.');
78
+ console.warn(e);
79
+ }
101
80
  }
102
- }
103
- // Otherwise, use tiny-fetch.
104
- return _fetch !== null && _fetch !== void 0 ? _fetch : tinyFetch;
81
+ // Otherwise, use tiny-fetch.
82
+ return _fetch !== null && _fetch !== void 0 ? _fetch : tinyFetch;
105
83
  }
106
84
  exports.getFetch = getFetch;
107
- //# sourceMappingURL=fetch.function.js.map
85
+ //# sourceMappingURL=fetch.function.js.map