@highstate/designer 0.4.2 → 0.4.4
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.
- package/.output/nitro.json +15 -0
- package/.output/public/_nuxt/B-YqONwZ.js +1 -0
- package/.output/public/_nuxt/COXQCz2I.js +1 -0
- package/.output/public/_nuxt/DNF_Kfc9.js +1 -0
- package/.output/public/_nuxt/DYyPqv2f.js +164 -0
- package/.output/public/_nuxt/builds/latest.json +1 -0
- package/.output/public/_nuxt/builds/meta/c81be379-d98f-426f-8eac-c45f3b97a743.json +1 -0
- package/.output/public/_nuxt/entry.BSAdMt6G.css +5 -0
- package/.output/public/_nuxt/error-404.BJkSn6RI.css +1 -0
- package/.output/public/_nuxt/error-500.TOCKLquH.css +1 -0
- package/.output/public/favicon.ico +0 -0
- package/.output/public/robots.txt +1 -0
- package/.output/server/index.mjs +12266 -0
- package/.output/server/index.mjs.map +1 -0
- package/.output/server/node_modules/@babel/parser/lib/index.js +14183 -0
- package/.output/server/node_modules/@babel/parser/package.json +50 -0
- package/.output/server/node_modules/@trpc/server/dist/http.mjs +7 -0
- package/.output/server/node_modules/@trpc/server/dist/index.mjs +11 -0
- package/.output/server/node_modules/@trpc/server/dist/observable/observable.mjs +175 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/createProxy.mjs +73 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/error/TRPCError.mjs +78 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/error/formatter.mjs +5 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/error/getErrorShape.mjs +29 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/contentType.mjs +224 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/contentTypeParsers.mjs +12 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/getHTTPStatusCode.mjs +76 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/isAbortError.mjs +7 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/parseConnectionParams.mjs +39 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/resolveResponse.mjs +569 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/initTRPC.mjs +80 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/middleware.mjs +90 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/parser.mjs +40 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/procedureBuilder.mjs +194 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/rootConfig.mjs +6 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/router.mjs +176 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/rpc/codes.mjs +54 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/jsonl.mjs +597 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/sse.mjs +359 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/tracked.mjs +25 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/utils/asyncIterable.mjs +167 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/utils/createDeferred.mjs +15 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/utils/disposable.mjs +41 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/utils/mergeAsyncIterables.mjs +239 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/utils/readableStreamFrom.mjs +23 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/utils/timerResource.mjs +23 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/stream/utils/withPing.mjs +127 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/transformer.mjs +101 -0
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import/utils.mjs +83 -0
- package/.output/server/node_modules/@trpc/server/dist/vendor/unpromise/unpromise.mjs +289 -0
- package/.output/server/node_modules/@trpc/server/package.json +156 -0
- package/.output/server/node_modules/@unhead/dom/dist/index.mjs +197 -0
- package/.output/server/node_modules/@unhead/dom/package.json +40 -0
- package/.output/server/node_modules/@unhead/shared/dist/index.mjs +641 -0
- package/.output/server/node_modules/@unhead/shared/package.json +45 -0
- package/.output/server/node_modules/@unhead/ssr/dist/index.mjs +95 -0
- package/.output/server/node_modules/@unhead/ssr/package.json +40 -0
- package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6690 -0
- package/.output/server/node_modules/@vue/compiler-core/package.json +58 -0
- package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +686 -0
- package/.output/server/node_modules/@vue/compiler-dom/package.json +57 -0
- package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1404 -0
- package/.output/server/node_modules/@vue/compiler-ssr/package.json +34 -0
- package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1789 -0
- package/.output/server/node_modules/@vue/reactivity/package.json +55 -0
- package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +6654 -0
- package/.output/server/node_modules/@vue/runtime-core/package.json +52 -0
- package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1669 -0
- package/.output/server/node_modules/@vue/runtime-dom/package.json +60 -0
- package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +857 -0
- package/.output/server/node_modules/@vue/server-renderer/package.json +55 -0
- package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +594 -0
- package/.output/server/node_modules/@vue/shared/package.json +47 -0
- package/.output/server/node_modules/devalue/index.js +3 -0
- package/.output/server/node_modules/devalue/package.json +34 -0
- package/.output/server/node_modules/devalue/src/base64.js +110 -0
- package/.output/server/node_modules/devalue/src/constants.js +6 -0
- package/.output/server/node_modules/devalue/src/parse.js +160 -0
- package/.output/server/node_modules/devalue/src/stringify.js +232 -0
- package/.output/server/node_modules/devalue/src/uneval.js +351 -0
- package/.output/server/node_modules/devalue/src/utils.js +113 -0
- package/.output/server/node_modules/entities/lib/decode.js +536 -0
- package/.output/server/node_modules/entities/lib/decode_codepoint.js +76 -0
- package/.output/server/node_modules/entities/lib/generated/decode-data-html.js +9 -0
- package/.output/server/node_modules/entities/lib/generated/decode-data-xml.js +9 -0
- package/.output/server/node_modules/entities/package.json +90 -0
- package/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
- package/.output/server/node_modules/estree-walker/package.json +37 -0
- package/.output/server/node_modules/hookable/dist/index.mjs +290 -0
- package/.output/server/node_modules/hookable/package.json +49 -0
- package/.output/server/node_modules/packrup/dist/index.mjs +108 -0
- package/.output/server/node_modules/packrup/package.json +58 -0
- package/.output/server/node_modules/source-map-js/lib/array-set.js +121 -0
- package/.output/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
- package/.output/server/node_modules/source-map-js/lib/base64.js +67 -0
- package/.output/server/node_modules/source-map-js/lib/binary-search.js +111 -0
- package/.output/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
- package/.output/server/node_modules/source-map-js/lib/quick-sort.js +132 -0
- package/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
- package/.output/server/node_modules/source-map-js/lib/source-map-generator.js +444 -0
- package/.output/server/node_modules/source-map-js/lib/source-node.js +413 -0
- package/.output/server/node_modules/source-map-js/lib/util.js +594 -0
- package/.output/server/node_modules/source-map-js/package.json +71 -0
- package/.output/server/node_modules/source-map-js/source-map.js +8 -0
- package/.output/server/node_modules/ufo/dist/index.mjs +630 -0
- package/.output/server/node_modules/ufo/package.json +47 -0
- package/.output/server/node_modules/unhead/dist/index.mjs +748 -0
- package/.output/server/node_modules/unhead/package.json +46 -0
- package/.output/server/node_modules/vue/dist/vue.cjs.js +80 -0
- package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
- package/.output/server/node_modules/vue/index.js +7 -0
- package/.output/server/node_modules/vue/index.mjs +1 -0
- package/.output/server/node_modules/vue/package.json +112 -0
- package/.output/server/node_modules/vue/server-renderer/index.mjs +1 -0
- package/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +196 -0
- package/.output/server/node_modules/vue-bundle-renderer/package.json +50 -0
- package/.output/server/node_modules/zod/lib/index.mjs +4382 -0
- package/.output/server/node_modules/zod/package.json +122 -0
- package/.output/server/package.json +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
function flatHooks(configHooks, hooks = {}, parentName) {
|
|
2
|
+
for (const key in configHooks) {
|
|
3
|
+
const subHook = configHooks[key];
|
|
4
|
+
const name = parentName ? `${parentName}:${key}` : key;
|
|
5
|
+
if (typeof subHook === "object" && subHook !== null) {
|
|
6
|
+
flatHooks(subHook, hooks, name);
|
|
7
|
+
} else if (typeof subHook === "function") {
|
|
8
|
+
hooks[name] = subHook;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return hooks;
|
|
12
|
+
}
|
|
13
|
+
function mergeHooks(...hooks) {
|
|
14
|
+
const finalHooks = {};
|
|
15
|
+
for (const hook of hooks) {
|
|
16
|
+
const flatenHook = flatHooks(hook);
|
|
17
|
+
for (const key in flatenHook) {
|
|
18
|
+
if (finalHooks[key]) {
|
|
19
|
+
finalHooks[key].push(flatenHook[key]);
|
|
20
|
+
} else {
|
|
21
|
+
finalHooks[key] = [flatenHook[key]];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
for (const key in finalHooks) {
|
|
26
|
+
if (finalHooks[key].length > 1) {
|
|
27
|
+
const array = finalHooks[key];
|
|
28
|
+
finalHooks[key] = (...arguments_) => serial(array, (function_) => function_(...arguments_));
|
|
29
|
+
} else {
|
|
30
|
+
finalHooks[key] = finalHooks[key][0];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return finalHooks;
|
|
34
|
+
}
|
|
35
|
+
function serial(tasks, function_) {
|
|
36
|
+
return tasks.reduce(
|
|
37
|
+
(promise, task) => promise.then(() => function_(task)),
|
|
38
|
+
Promise.resolve()
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
const defaultTask = { run: (function_) => function_() };
|
|
42
|
+
const _createTask = () => defaultTask;
|
|
43
|
+
const createTask = typeof console.createTask !== "undefined" ? console.createTask : _createTask;
|
|
44
|
+
function serialTaskCaller(hooks, args) {
|
|
45
|
+
const name = args.shift();
|
|
46
|
+
const task = createTask(name);
|
|
47
|
+
return hooks.reduce(
|
|
48
|
+
(promise, hookFunction) => promise.then(() => task.run(() => hookFunction(...args))),
|
|
49
|
+
Promise.resolve()
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
function parallelTaskCaller(hooks, args) {
|
|
53
|
+
const name = args.shift();
|
|
54
|
+
const task = createTask(name);
|
|
55
|
+
return Promise.all(hooks.map((hook) => task.run(() => hook(...args))));
|
|
56
|
+
}
|
|
57
|
+
function serialCaller(hooks, arguments_) {
|
|
58
|
+
return hooks.reduce(
|
|
59
|
+
(promise, hookFunction) => promise.then(() => hookFunction(...arguments_ || [])),
|
|
60
|
+
Promise.resolve()
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
function parallelCaller(hooks, args) {
|
|
64
|
+
return Promise.all(hooks.map((hook) => hook(...args || [])));
|
|
65
|
+
}
|
|
66
|
+
function callEachWith(callbacks, arg0) {
|
|
67
|
+
for (const callback of [...callbacks]) {
|
|
68
|
+
callback(arg0);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
class Hookable {
|
|
73
|
+
constructor() {
|
|
74
|
+
this._hooks = {};
|
|
75
|
+
this._before = void 0;
|
|
76
|
+
this._after = void 0;
|
|
77
|
+
this._deprecatedMessages = void 0;
|
|
78
|
+
this._deprecatedHooks = {};
|
|
79
|
+
this.hook = this.hook.bind(this);
|
|
80
|
+
this.callHook = this.callHook.bind(this);
|
|
81
|
+
this.callHookWith = this.callHookWith.bind(this);
|
|
82
|
+
}
|
|
83
|
+
hook(name, function_, options = {}) {
|
|
84
|
+
if (!name || typeof function_ !== "function") {
|
|
85
|
+
return () => {
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
const originalName = name;
|
|
89
|
+
let dep;
|
|
90
|
+
while (this._deprecatedHooks[name]) {
|
|
91
|
+
dep = this._deprecatedHooks[name];
|
|
92
|
+
name = dep.to;
|
|
93
|
+
}
|
|
94
|
+
if (dep && !options.allowDeprecated) {
|
|
95
|
+
let message = dep.message;
|
|
96
|
+
if (!message) {
|
|
97
|
+
message = `${originalName} hook has been deprecated` + (dep.to ? `, please use ${dep.to}` : "");
|
|
98
|
+
}
|
|
99
|
+
if (!this._deprecatedMessages) {
|
|
100
|
+
this._deprecatedMessages = /* @__PURE__ */ new Set();
|
|
101
|
+
}
|
|
102
|
+
if (!this._deprecatedMessages.has(message)) {
|
|
103
|
+
console.warn(message);
|
|
104
|
+
this._deprecatedMessages.add(message);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (!function_.name) {
|
|
108
|
+
try {
|
|
109
|
+
Object.defineProperty(function_, "name", {
|
|
110
|
+
get: () => "_" + name.replace(/\W+/g, "_") + "_hook_cb",
|
|
111
|
+
configurable: true
|
|
112
|
+
});
|
|
113
|
+
} catch {
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
this._hooks[name] = this._hooks[name] || [];
|
|
117
|
+
this._hooks[name].push(function_);
|
|
118
|
+
return () => {
|
|
119
|
+
if (function_) {
|
|
120
|
+
this.removeHook(name, function_);
|
|
121
|
+
function_ = void 0;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
hookOnce(name, function_) {
|
|
126
|
+
let _unreg;
|
|
127
|
+
let _function = (...arguments_) => {
|
|
128
|
+
if (typeof _unreg === "function") {
|
|
129
|
+
_unreg();
|
|
130
|
+
}
|
|
131
|
+
_unreg = void 0;
|
|
132
|
+
_function = void 0;
|
|
133
|
+
return function_(...arguments_);
|
|
134
|
+
};
|
|
135
|
+
_unreg = this.hook(name, _function);
|
|
136
|
+
return _unreg;
|
|
137
|
+
}
|
|
138
|
+
removeHook(name, function_) {
|
|
139
|
+
if (this._hooks[name]) {
|
|
140
|
+
const index = this._hooks[name].indexOf(function_);
|
|
141
|
+
if (index !== -1) {
|
|
142
|
+
this._hooks[name].splice(index, 1);
|
|
143
|
+
}
|
|
144
|
+
if (this._hooks[name].length === 0) {
|
|
145
|
+
delete this._hooks[name];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
deprecateHook(name, deprecated) {
|
|
150
|
+
this._deprecatedHooks[name] = typeof deprecated === "string" ? { to: deprecated } : deprecated;
|
|
151
|
+
const _hooks = this._hooks[name] || [];
|
|
152
|
+
delete this._hooks[name];
|
|
153
|
+
for (const hook of _hooks) {
|
|
154
|
+
this.hook(name, hook);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
deprecateHooks(deprecatedHooks) {
|
|
158
|
+
Object.assign(this._deprecatedHooks, deprecatedHooks);
|
|
159
|
+
for (const name in deprecatedHooks) {
|
|
160
|
+
this.deprecateHook(name, deprecatedHooks[name]);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
addHooks(configHooks) {
|
|
164
|
+
const hooks = flatHooks(configHooks);
|
|
165
|
+
const removeFns = Object.keys(hooks).map(
|
|
166
|
+
(key) => this.hook(key, hooks[key])
|
|
167
|
+
);
|
|
168
|
+
return () => {
|
|
169
|
+
for (const unreg of removeFns.splice(0, removeFns.length)) {
|
|
170
|
+
unreg();
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
removeHooks(configHooks) {
|
|
175
|
+
const hooks = flatHooks(configHooks);
|
|
176
|
+
for (const key in hooks) {
|
|
177
|
+
this.removeHook(key, hooks[key]);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
removeAllHooks() {
|
|
181
|
+
for (const key in this._hooks) {
|
|
182
|
+
delete this._hooks[key];
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
callHook(name, ...arguments_) {
|
|
186
|
+
arguments_.unshift(name);
|
|
187
|
+
return this.callHookWith(serialTaskCaller, name, ...arguments_);
|
|
188
|
+
}
|
|
189
|
+
callHookParallel(name, ...arguments_) {
|
|
190
|
+
arguments_.unshift(name);
|
|
191
|
+
return this.callHookWith(parallelTaskCaller, name, ...arguments_);
|
|
192
|
+
}
|
|
193
|
+
callHookWith(caller, name, ...arguments_) {
|
|
194
|
+
const event = this._before || this._after ? { name, args: arguments_, context: {} } : void 0;
|
|
195
|
+
if (this._before) {
|
|
196
|
+
callEachWith(this._before, event);
|
|
197
|
+
}
|
|
198
|
+
const result = caller(
|
|
199
|
+
name in this._hooks ? [...this._hooks[name]] : [],
|
|
200
|
+
arguments_
|
|
201
|
+
);
|
|
202
|
+
if (result instanceof Promise) {
|
|
203
|
+
return result.finally(() => {
|
|
204
|
+
if (this._after && event) {
|
|
205
|
+
callEachWith(this._after, event);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
if (this._after && event) {
|
|
210
|
+
callEachWith(this._after, event);
|
|
211
|
+
}
|
|
212
|
+
return result;
|
|
213
|
+
}
|
|
214
|
+
beforeEach(function_) {
|
|
215
|
+
this._before = this._before || [];
|
|
216
|
+
this._before.push(function_);
|
|
217
|
+
return () => {
|
|
218
|
+
if (this._before !== void 0) {
|
|
219
|
+
const index = this._before.indexOf(function_);
|
|
220
|
+
if (index !== -1) {
|
|
221
|
+
this._before.splice(index, 1);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
afterEach(function_) {
|
|
227
|
+
this._after = this._after || [];
|
|
228
|
+
this._after.push(function_);
|
|
229
|
+
return () => {
|
|
230
|
+
if (this._after !== void 0) {
|
|
231
|
+
const index = this._after.indexOf(function_);
|
|
232
|
+
if (index !== -1) {
|
|
233
|
+
this._after.splice(index, 1);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function createHooks() {
|
|
240
|
+
return new Hookable();
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const isBrowser = typeof window !== "undefined";
|
|
244
|
+
function createDebugger(hooks, _options = {}) {
|
|
245
|
+
const options = {
|
|
246
|
+
inspect: isBrowser,
|
|
247
|
+
group: isBrowser,
|
|
248
|
+
filter: () => true,
|
|
249
|
+
..._options
|
|
250
|
+
};
|
|
251
|
+
const _filter = options.filter;
|
|
252
|
+
const filter = typeof _filter === "string" ? (name) => name.startsWith(_filter) : _filter;
|
|
253
|
+
const _tag = options.tag ? `[${options.tag}] ` : "";
|
|
254
|
+
const logPrefix = (event) => _tag + event.name + "".padEnd(event._id, "\0");
|
|
255
|
+
const _idCtr = {};
|
|
256
|
+
const unsubscribeBefore = hooks.beforeEach((event) => {
|
|
257
|
+
if (filter !== void 0 && !filter(event.name)) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
_idCtr[event.name] = _idCtr[event.name] || 0;
|
|
261
|
+
event._id = _idCtr[event.name]++;
|
|
262
|
+
console.time(logPrefix(event));
|
|
263
|
+
});
|
|
264
|
+
const unsubscribeAfter = hooks.afterEach((event) => {
|
|
265
|
+
if (filter !== void 0 && !filter(event.name)) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
if (options.group) {
|
|
269
|
+
console.groupCollapsed(event.name);
|
|
270
|
+
}
|
|
271
|
+
if (options.inspect) {
|
|
272
|
+
console.timeLog(logPrefix(event), event.args);
|
|
273
|
+
} else {
|
|
274
|
+
console.timeEnd(logPrefix(event));
|
|
275
|
+
}
|
|
276
|
+
if (options.group) {
|
|
277
|
+
console.groupEnd();
|
|
278
|
+
}
|
|
279
|
+
_idCtr[event.name]--;
|
|
280
|
+
});
|
|
281
|
+
return {
|
|
282
|
+
/** Stop debugging and remove listeners */
|
|
283
|
+
close: () => {
|
|
284
|
+
unsubscribeBefore();
|
|
285
|
+
unsubscribeAfter();
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export { Hookable, createDebugger, createHooks, flatHooks, mergeHooks, parallelCaller, serial, serialCaller };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hookable",
|
|
3
|
+
"version": "5.5.3",
|
|
4
|
+
"description": "Awaitable hook system",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"hook",
|
|
7
|
+
"hookable",
|
|
8
|
+
"plugin",
|
|
9
|
+
"tapable",
|
|
10
|
+
"tappable"
|
|
11
|
+
],
|
|
12
|
+
"repository": "unjs/hookable",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"exports": {
|
|
15
|
+
"import": "./dist/index.mjs",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"require": "./dist/index.cjs"
|
|
18
|
+
},
|
|
19
|
+
"main": "./dist/index.cjs",
|
|
20
|
+
"module": "./dist/index.mjs",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^18.15.11",
|
|
27
|
+
"@vitest/coverage-c8": "^0.29.8",
|
|
28
|
+
"changelogen": "^0.5.2",
|
|
29
|
+
"eslint": "^8.37.0",
|
|
30
|
+
"eslint-config-unjs": "^0.1.0",
|
|
31
|
+
"expect-type": "^0.15.0",
|
|
32
|
+
"prettier": "^2.8.7",
|
|
33
|
+
"typescript": "^5.0.2",
|
|
34
|
+
"unbuild": "^1.1.2",
|
|
35
|
+
"vite": "^4.2.1",
|
|
36
|
+
"vitest": "^0.29.8"
|
|
37
|
+
},
|
|
38
|
+
"packageManager": "pnpm@8.0.0",
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "unbuild",
|
|
41
|
+
"dev": "vitest",
|
|
42
|
+
"lint": "eslint --cache --ext .ts,.js,.mjs,.cjs . && prettier -c src test",
|
|
43
|
+
"lint:fix": "eslint --cache --ext .ts,.js,.mjs,.cjs . --fix && prettier -c src test -w",
|
|
44
|
+
"prepublish": "pnpm build",
|
|
45
|
+
"release": "pnpm test && pnpm build && changelogen --release --push && pnpm publish",
|
|
46
|
+
"test": "pnpm lint && vitest run --coverage",
|
|
47
|
+
"test:types": "tsc --noEmit"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
function asArray(input) {
|
|
2
|
+
return Array.isArray(input) ? input : [input];
|
|
3
|
+
}
|
|
4
|
+
const InternalKeySymbol = "_$key";
|
|
5
|
+
function packObject(input, options) {
|
|
6
|
+
const keys = Object.keys(input);
|
|
7
|
+
let [k, v] = keys;
|
|
8
|
+
options = options || {};
|
|
9
|
+
options.key = options.key || k;
|
|
10
|
+
options.value = options.value || v;
|
|
11
|
+
options.resolveKey = options.resolveKey || ((k2) => k2);
|
|
12
|
+
const resolveKey = (index) => {
|
|
13
|
+
const arr = asArray(options[index]);
|
|
14
|
+
return arr.find((k2) => {
|
|
15
|
+
if (typeof k2 === "string" && k2.includes(".")) {
|
|
16
|
+
return k2;
|
|
17
|
+
}
|
|
18
|
+
return k2 && keys.includes(k2);
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
const resolveValue = (k2, input2) => {
|
|
22
|
+
if (k2.includes(".")) {
|
|
23
|
+
const paths = k2.split(".");
|
|
24
|
+
let val = input2;
|
|
25
|
+
for (const path of paths)
|
|
26
|
+
val = val[path];
|
|
27
|
+
return val;
|
|
28
|
+
}
|
|
29
|
+
return input2[k2];
|
|
30
|
+
};
|
|
31
|
+
k = resolveKey("key") || k;
|
|
32
|
+
v = resolveKey("value") || v;
|
|
33
|
+
const dedupeKeyPrefix = input.key ? `${InternalKeySymbol}${input.key}-` : "";
|
|
34
|
+
let keyValue = resolveValue(k, input);
|
|
35
|
+
keyValue = options.resolveKey(keyValue);
|
|
36
|
+
return {
|
|
37
|
+
[`${dedupeKeyPrefix}${keyValue}`]: resolveValue(v, input)
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function packArray(input, options) {
|
|
42
|
+
const packed = {};
|
|
43
|
+
for (const i of input) {
|
|
44
|
+
const packedObj = packObject(i, options);
|
|
45
|
+
const pKey = Object.keys(packedObj)[0];
|
|
46
|
+
const isDedupeKey = pKey.startsWith(InternalKeySymbol);
|
|
47
|
+
if (!isDedupeKey && packed[pKey]) {
|
|
48
|
+
packed[pKey] = Array.isArray(packed[pKey]) ? packed[pKey] : [packed[pKey]];
|
|
49
|
+
packed[pKey].push(Object.values(packedObj)[0]);
|
|
50
|
+
} else {
|
|
51
|
+
packed[isDedupeKey ? pKey.split("-").slice(1).join("-") || pKey : pKey] = packedObj[pKey];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return packed;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function packString(input) {
|
|
58
|
+
const output = {};
|
|
59
|
+
input.split(" ").forEach(
|
|
60
|
+
(item) => {
|
|
61
|
+
const val = item.replace(/"/g, "").split("=");
|
|
62
|
+
output[val[0]] = val[1];
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
return output;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function unpackToArray(input, options) {
|
|
69
|
+
const unpacked = [];
|
|
70
|
+
const kFn = options.resolveKeyData || ((ctx) => ctx.key);
|
|
71
|
+
const vFn = options.resolveValueData || ((ctx) => ctx.value);
|
|
72
|
+
for (const [k, v] of Object.entries(input)) {
|
|
73
|
+
unpacked.push(...(Array.isArray(v) ? v : [v]).map((i) => {
|
|
74
|
+
const ctx = { key: k, value: i };
|
|
75
|
+
const val = vFn(ctx);
|
|
76
|
+
if (typeof val === "object")
|
|
77
|
+
return unpackToArray(val, options);
|
|
78
|
+
if (Array.isArray(val))
|
|
79
|
+
return val;
|
|
80
|
+
return {
|
|
81
|
+
[typeof options.key === "function" ? options.key(ctx) : options.key]: kFn(ctx),
|
|
82
|
+
[typeof options.value === "function" ? options.value(ctx) : options.value]: val
|
|
83
|
+
};
|
|
84
|
+
}).flat());
|
|
85
|
+
}
|
|
86
|
+
return unpacked;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function unpackToString(value, options) {
|
|
90
|
+
return Object.entries(value).map(([key, value2]) => {
|
|
91
|
+
if (typeof value2 === "object")
|
|
92
|
+
value2 = unpackToString(value2, options);
|
|
93
|
+
if (options.resolve) {
|
|
94
|
+
const resolved = options.resolve({ key, value: value2 });
|
|
95
|
+
if (typeof resolved !== "undefined")
|
|
96
|
+
return resolved;
|
|
97
|
+
}
|
|
98
|
+
if (typeof value2 === "number")
|
|
99
|
+
value2 = value2.toString();
|
|
100
|
+
if (typeof value2 === "string" && options.wrapValue) {
|
|
101
|
+
value2 = value2.replace(new RegExp(options.wrapValue, "g"), `\\${options.wrapValue}`);
|
|
102
|
+
value2 = `${options.wrapValue}${value2}${options.wrapValue}`;
|
|
103
|
+
}
|
|
104
|
+
return `${key}${options.keyValueSeparator || ""}${value2}`;
|
|
105
|
+
}).join(options.entrySeparator || "");
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export { InternalKeySymbol, packArray, packObject, packString, unpackToArray, unpackToString };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "packrup",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.2",
|
|
5
|
+
"packageManager": "pnpm@8.15.4",
|
|
6
|
+
"description": "Node Schema.org for Simple and Automated Google Rich Results",
|
|
7
|
+
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"funding": "https://github.com/sponsors/harlan-zw",
|
|
10
|
+
"homepage": "https://github.com/harlan-zw/packrup#readme",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/harlan-zw/packrup.git"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/harlan-zw/packrup/issues"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"pack object",
|
|
20
|
+
"pack string",
|
|
21
|
+
"pack array"
|
|
22
|
+
],
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.mjs",
|
|
28
|
+
"require": "./dist/index.cjs"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"main": "dist/index.cjs",
|
|
32
|
+
"module": "dist/index.mjs",
|
|
33
|
+
"types": "dist/index.d.ts",
|
|
34
|
+
"files": [
|
|
35
|
+
"dist"
|
|
36
|
+
],
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@antfu/eslint-config": "^2.8.0",
|
|
39
|
+
"@types/fs-extra": "^11.0.4",
|
|
40
|
+
"@vitest/ui": "^1.3.1",
|
|
41
|
+
"bumpp": "^9.4.0",
|
|
42
|
+
"eslint": "^8.57.0",
|
|
43
|
+
"fs-extra": "^11.2.0",
|
|
44
|
+
"jsdom": "^24.0.0",
|
|
45
|
+
"typescript": "^5.4.2",
|
|
46
|
+
"unbuild": "^2.0.0",
|
|
47
|
+
"utility-types": "^3.11.0",
|
|
48
|
+
"vitest": "^1.3.1"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "unbuild",
|
|
52
|
+
"stub": "unbuild --stub",
|
|
53
|
+
"test": "vitest",
|
|
54
|
+
"export:sizes": "npx export-size . -r",
|
|
55
|
+
"release": "pnpm build && bumpp && pnpm -r publish --no-git-checks",
|
|
56
|
+
"lint": "eslint . --fix"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
|
4
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
5
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
var util = require('./util');
|
|
9
|
+
var has = Object.prototype.hasOwnProperty;
|
|
10
|
+
var hasNativeMap = typeof Map !== "undefined";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A data structure which is a combination of an array and a set. Adding a new
|
|
14
|
+
* member is O(1), testing for membership is O(1), and finding the index of an
|
|
15
|
+
* element is O(1). Removing elements from the set is not supported. Only
|
|
16
|
+
* strings are supported for membership.
|
|
17
|
+
*/
|
|
18
|
+
function ArraySet() {
|
|
19
|
+
this._array = [];
|
|
20
|
+
this._set = hasNativeMap ? new Map() : Object.create(null);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Static method for creating ArraySet instances from an existing array.
|
|
25
|
+
*/
|
|
26
|
+
ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
|
|
27
|
+
var set = new ArraySet();
|
|
28
|
+
for (var i = 0, len = aArray.length; i < len; i++) {
|
|
29
|
+
set.add(aArray[i], aAllowDuplicates);
|
|
30
|
+
}
|
|
31
|
+
return set;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Return how many unique items are in this ArraySet. If duplicates have been
|
|
36
|
+
* added, than those do not count towards the size.
|
|
37
|
+
*
|
|
38
|
+
* @returns Number
|
|
39
|
+
*/
|
|
40
|
+
ArraySet.prototype.size = function ArraySet_size() {
|
|
41
|
+
return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Add the given string to this set.
|
|
46
|
+
*
|
|
47
|
+
* @param String aStr
|
|
48
|
+
*/
|
|
49
|
+
ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
|
|
50
|
+
var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
|
|
51
|
+
var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
|
|
52
|
+
var idx = this._array.length;
|
|
53
|
+
if (!isDuplicate || aAllowDuplicates) {
|
|
54
|
+
this._array.push(aStr);
|
|
55
|
+
}
|
|
56
|
+
if (!isDuplicate) {
|
|
57
|
+
if (hasNativeMap) {
|
|
58
|
+
this._set.set(aStr, idx);
|
|
59
|
+
} else {
|
|
60
|
+
this._set[sStr] = idx;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Is the given string a member of this set?
|
|
67
|
+
*
|
|
68
|
+
* @param String aStr
|
|
69
|
+
*/
|
|
70
|
+
ArraySet.prototype.has = function ArraySet_has(aStr) {
|
|
71
|
+
if (hasNativeMap) {
|
|
72
|
+
return this._set.has(aStr);
|
|
73
|
+
} else {
|
|
74
|
+
var sStr = util.toSetString(aStr);
|
|
75
|
+
return has.call(this._set, sStr);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* What is the index of the given string in the array?
|
|
81
|
+
*
|
|
82
|
+
* @param String aStr
|
|
83
|
+
*/
|
|
84
|
+
ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
|
|
85
|
+
if (hasNativeMap) {
|
|
86
|
+
var idx = this._set.get(aStr);
|
|
87
|
+
if (idx >= 0) {
|
|
88
|
+
return idx;
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
var sStr = util.toSetString(aStr);
|
|
92
|
+
if (has.call(this._set, sStr)) {
|
|
93
|
+
return this._set[sStr];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
throw new Error('"' + aStr + '" is not in the set.');
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* What is the element at the given index?
|
|
102
|
+
*
|
|
103
|
+
* @param Number aIdx
|
|
104
|
+
*/
|
|
105
|
+
ArraySet.prototype.at = function ArraySet_at(aIdx) {
|
|
106
|
+
if (aIdx >= 0 && aIdx < this._array.length) {
|
|
107
|
+
return this._array[aIdx];
|
|
108
|
+
}
|
|
109
|
+
throw new Error('No element indexed by ' + aIdx);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Returns the array representation of this set (which has the proper indices
|
|
114
|
+
* indicated by indexOf). Note that this is a copy of the internal array used
|
|
115
|
+
* for storing the members so that no one can mess with internal state.
|
|
116
|
+
*/
|
|
117
|
+
ArraySet.prototype.toArray = function ArraySet_toArray() {
|
|
118
|
+
return this._array.slice();
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
exports.ArraySet = ArraySet;
|