@stencil/core 5.0.0-alpha.3 → 5.0.0-alpha.31

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 (56) hide show
  1. package/README.md +94 -0
  2. package/dist/app-data/index.d.ts +2 -0
  3. package/dist/{runtime/app-data → app-data}/index.js +17 -11
  4. package/dist/{client-CSm3x5ke.mjs → client-D1MsT-Rp.mjs} +2717 -2424
  5. package/dist/compiler/index.d.mts +170 -6
  6. package/dist/compiler/index.mjs +4 -3
  7. package/dist/compiler/utils/index.d.mts +272 -2
  8. package/dist/compiler/utils/index.mjs +4 -3
  9. package/dist/{compiler-D6iP7Bzb.mjs → compiler-Cddp97Pg.mjs} +14953 -12327
  10. package/dist/declarations/stencil-ext-modules.d.ts +5 -5
  11. package/dist/declarations/stencil-public-compiler.d.ts +728 -287
  12. package/dist/declarations/stencil-public-compiler.js +2 -3
  13. package/dist/declarations/stencil-public-docs.d.ts +19 -0
  14. package/dist/declarations/stencil-public-runtime.d.ts +131 -17
  15. package/dist/fragment-Di1hWOC8.mjs +4 -0
  16. package/dist/{index-tUR6pD3J.d.mts → index-BHj3EBl2.d.mts} +1052 -668
  17. package/dist/{index-CyrGY82h.d.ts → index-D2PAsXxx.d.ts} +215 -40
  18. package/dist/index-VK8okIiF.d.mts +108 -0
  19. package/dist/index.d.mts +4 -1
  20. package/dist/index.mjs +91 -2
  21. package/dist/jsx-runtime.d.mts +18 -0
  22. package/dist/jsx-runtime.mjs +3 -0
  23. package/dist/{node-Bg-mO5dw.mjs → node-BQR4L-TG.mjs} +76 -73
  24. package/dist/reactive-controller-BdCpSAQP.d.mts +13 -0
  25. package/dist/{regular-expression-D5pGVpCu.mjs → regular-expression-XqU5zmPp.mjs} +141 -31
  26. package/dist/{chunk-CjcI7cDX.mjs → rolldown-runtime-BhDjJH2R.mjs} +1 -1
  27. package/dist/{runtime-BBCnuprF.js → runtime/client/lazy.js} +2987 -2443
  28. package/dist/runtime/client/{index.d.ts → runtime.d.ts} +228 -83
  29. package/dist/runtime/client/{index.js → runtime.js} +2852 -2432
  30. package/dist/runtime/index.d.ts +48 -29
  31. package/dist/runtime/index.js +5069 -2
  32. package/dist/runtime/server/index.d.mts +182 -75
  33. package/dist/runtime/server/index.mjs +2769 -2283
  34. package/dist/runtime/server/runner.d.mts +47 -32
  35. package/dist/runtime/server/runner.mjs +563 -687
  36. package/dist/signals/index.d.ts +49 -0
  37. package/dist/signals/index.js +199 -0
  38. package/dist/sys/node/index.d.mts +1 -2
  39. package/dist/sys/node/index.mjs +1 -1
  40. package/dist/sys/node/worker.d.mts +1 -1
  41. package/dist/sys/node/worker.mjs +6 -3
  42. package/dist/testing/index.d.mts +98 -9
  43. package/dist/testing/index.mjs +395 -70
  44. package/dist/util-BIa-iHnt.mjs +724 -0
  45. package/dist/validation-Dd3g77T5.mjs +778 -0
  46. package/package.json +49 -36
  47. package/dist/index-CXHCTQNt.d.mts +0 -190
  48. package/dist/index-hS-KBdAP.d.ts +0 -30
  49. package/dist/jsx-runtime-DlDkTqps.d.ts +0 -28
  50. package/dist/jsx-runtime.d.ts +0 -2
  51. package/dist/jsx-runtime.js +0 -2
  52. package/dist/runtime/app-data/index.d.ts +0 -2
  53. package/dist/validation-Byxie0Uk.mjs +0 -1445
  54. /package/{LICENSE.md → LICENSE} +0 -0
  55. /package/dist/{runtime/app-globals → app-globals}/index.d.ts +0 -0
  56. /package/dist/{runtime/app-globals → app-globals}/index.js +0 -0
@@ -1,1445 +0,0 @@
1
- import { t as __exportAll } from "./chunk-CjcI7cDX.mjs";
2
- import { A as DIST_CUSTOM_ELEMENTS, B as DOCS_VSCODE, C as CMP_FLAGS, E as CUSTOM, F as DIST_TYPES, G as LISTENER_FLAGS, H as GENERATED_DTS, I as DOCS_CUSTOM, J as STATS, K as MEMBER_FLAGS, L as DOCS_CUSTOM_ELEMENTS_MANIFEST, M as DIST_HYDRATE_SCRIPT, N as DIST_LAZY, O as DIST, P as DIST_LAZY_LOADER, R as DOCS_JSON, T as COPY, X as VALID_CONFIG_OUTPUT_TARGETS, Z as WATCH_FLAGS, _ as sortBy, b as toTitleCase, i as flatOne, j as DIST_GLOBAL_STYLES, k as DIST_COLLECTION, n as dashToPascalCase, p as isString, r as escapeWithPattern, u as isIterable, y as toDashCase, z as DOCS_README } from "./regular-expression-D5pGVpCu.mjs";
3
- import path, { basename, dirname, relative } from "node:path";
4
- import { minimatch } from "minimatch";
5
- //#region src/utils/byte-size.ts
6
- /**
7
- * Used to learn the size of a string in bytes.
8
- *
9
- * @param str The string to measure
10
- * @returns number
11
- */
12
- const byteSize = (str) => Buffer.byteLength(str, "utf8");
13
- //#endregion
14
- //#region src/utils/format-component-runtime-meta.ts
15
- const formatLazyBundleRuntimeMeta = (bundleId, cmps) => {
16
- return [bundleId, cmps.map((cmp) => formatComponentRuntimeMeta(cmp, true))];
17
- };
18
- /**
19
- * Transform metadata about a component from the compiler to a compact form for
20
- * use at runtime.
21
- *
22
- * @param compilerMeta component metadata gathered during compilation
23
- * @param includeMethods include methods in the component's members or not
24
- * @returns a compact format for component metadata, intended for runtime use
25
- */
26
- const formatComponentRuntimeMeta = (compilerMeta, includeMethods) => {
27
- let flags = 0;
28
- if (compilerMeta.encapsulation === "shadow") {
29
- flags |= CMP_FLAGS.shadowDomEncapsulation;
30
- if (compilerMeta.shadowDelegatesFocus) flags |= CMP_FLAGS.shadowDelegatesFocus;
31
- if (compilerMeta.slotAssignment === "manual") flags |= CMP_FLAGS.shadowSlotAssignmentManual;
32
- if (compilerMeta.shadowMode === "closed") flags |= CMP_FLAGS.shadowModeClosed;
33
- } else if (compilerMeta.encapsulation === "scoped") flags |= CMP_FLAGS.scopedCssEncapsulation;
34
- if (compilerMeta.formAssociated) flags |= CMP_FLAGS.formAssociated;
35
- if (compilerMeta.encapsulation !== "shadow" && compilerMeta.htmlTagNames.includes("slot")) flags |= CMP_FLAGS.hasSlotRelocation;
36
- if (compilerMeta.hasSlot) flags |= CMP_FLAGS.hasSlot;
37
- if (compilerMeta.hasMode) flags |= CMP_FLAGS.hasMode;
38
- if (compilerMeta.hasModernPropertyDecls) flags |= CMP_FLAGS.hasModernPropertyDecls;
39
- if (compilerMeta.patches) {
40
- if (compilerMeta.patches.all) flags |= CMP_FLAGS.patchAll;
41
- if (compilerMeta.patches.children) flags |= CMP_FLAGS.patchChildren;
42
- if (compilerMeta.patches.clone) flags |= CMP_FLAGS.patchClone;
43
- if (compilerMeta.patches.insert) flags |= CMP_FLAGS.patchInsert;
44
- }
45
- const members = formatComponentRuntimeMembers(compilerMeta, includeMethods);
46
- const hostListeners = formatHostListeners(compilerMeta);
47
- const watchers = formatComponentRuntimeReactiveHandlers(compilerMeta, "watchers");
48
- const serializers = formatComponentRuntimeReactiveHandlers(compilerMeta, "serializers");
49
- const deserializers = formatComponentRuntimeReactiveHandlers(compilerMeta, "deserializers");
50
- return trimFalsy([
51
- flags,
52
- compilerMeta.tagName,
53
- Object.keys(members).length > 0 ? members : void 0,
54
- hostListeners.length > 0 ? hostListeners : void 0,
55
- Object.keys(watchers).length > 0 ? watchers : void 0,
56
- Object.keys(serializers).length > 0 ? serializers : void 0,
57
- Object.keys(deserializers).length > 0 ? deserializers : void 0
58
- ]);
59
- };
60
- const stringifyRuntimeData = (data) => {
61
- const json = JSON.stringify(data);
62
- if (json.length > 1e4) return `JSON.parse(${JSON.stringify(json)})`;
63
- return json;
64
- };
65
- /**
66
- * Transforms Stencil compiler metadata into a {@link d.ComponentCompilerMeta} object.
67
- * This handles processing any compiler metadata transformed from components' uses of `@Watch()`, `@PropSerialize()`, and `@AttrDeserialize()`.
68
- * The map of watched properties to their callback(s) will be immediately available
69
- * to the runtime at bootstrap.
70
- *
71
- * @param compilerMeta Component metadata gathered during compilation
72
- * @param decorator The decorator type to be processed: 'watchers', 'serializers', or 'deserializers'
73
- * @returns An object mapping watched properties to their respective callback(s)
74
- */
75
- const formatComponentRuntimeReactiveHandlers = (compilerMeta, decorator) => {
76
- const handlers = {};
77
- compilerMeta[decorator]?.forEach(({ propName, methodName, handlerOptions }) => {
78
- let watcherFlags = 0;
79
- if (handlerOptions?.immediate) watcherFlags |= WATCH_FLAGS.Immediate;
80
- handlers[propName] = [...handlers[propName] ?? [], { [methodName]: watcherFlags }];
81
- });
82
- return handlers;
83
- };
84
- const formatComponentRuntimeMembers = (compilerMeta, includeMethods = true) => {
85
- return {
86
- ...formatPropertiesRuntimeMember(compilerMeta.properties),
87
- ...formatStatesRuntimeMember(compilerMeta.states),
88
- ...includeMethods ? formatMethodsRuntimeMember(compilerMeta.methods) : {}
89
- };
90
- };
91
- const formatPropertiesRuntimeMember = (properties) => {
92
- const runtimeMembers = {};
93
- properties.forEach((member) => {
94
- runtimeMembers[member.name] = trimFalsy([formatFlags(member), formatAttrName(member)]);
95
- });
96
- return runtimeMembers;
97
- };
98
- const formatFlags = (compilerProperty) => {
99
- let type = formatPropType(compilerProperty.type);
100
- if (compilerProperty.mutable) type |= MEMBER_FLAGS.Mutable;
101
- if (compilerProperty.reflect) type |= MEMBER_FLAGS.ReflectAttr;
102
- if (compilerProperty.getter) type |= MEMBER_FLAGS.Getter;
103
- if (compilerProperty.setter) type |= MEMBER_FLAGS.Setter;
104
- return type;
105
- };
106
- /**
107
- * We mainly add the alternative kebab-case attribute name because it might
108
- * be used in an HTML environment (non JSX). Since we support hydration of
109
- * complex types we provide a kebab-case attribute name for properties with
110
- * these types.
111
- */
112
- const kebabCaseSupportForTypes = ["string", "unknown"];
113
- const formatAttrName = (compilerProperty) => {
114
- if (kebabCaseSupportForTypes.includes(typeof compilerProperty.attribute)) {
115
- if (compilerProperty.name === compilerProperty.attribute) return;
116
- return compilerProperty.attribute;
117
- }
118
- };
119
- const formatPropType = (type) => {
120
- if (type === "string") return MEMBER_FLAGS.String;
121
- if (type === "number") return MEMBER_FLAGS.Number;
122
- if (type === "boolean") return MEMBER_FLAGS.Boolean;
123
- if (type === "any") return MEMBER_FLAGS.Any;
124
- return MEMBER_FLAGS.Unknown;
125
- };
126
- const formatStatesRuntimeMember = (states) => {
127
- const runtimeMembers = {};
128
- states.forEach((member) => {
129
- runtimeMembers[member.name] = [MEMBER_FLAGS.State];
130
- });
131
- return runtimeMembers;
132
- };
133
- const formatMethodsRuntimeMember = (methods) => {
134
- const runtimeMembers = {};
135
- methods.forEach((member) => {
136
- runtimeMembers[member.name] = [MEMBER_FLAGS.Method];
137
- });
138
- return runtimeMembers;
139
- };
140
- const formatHostListeners = (compilerMeta) => {
141
- return compilerMeta.listeners.map((compilerListener) => {
142
- return [
143
- computeListenerFlags(compilerListener),
144
- compilerListener.name,
145
- compilerListener.method
146
- ];
147
- });
148
- };
149
- const computeListenerFlags = (listener) => {
150
- let flags = 0;
151
- if (listener.capture) flags |= LISTENER_FLAGS.Capture;
152
- if (listener.passive) flags |= LISTENER_FLAGS.Passive;
153
- switch (listener.target) {
154
- case "document":
155
- flags |= LISTENER_FLAGS.TargetDocument;
156
- break;
157
- case "window":
158
- flags |= LISTENER_FLAGS.TargetWindow;
159
- break;
160
- case "body":
161
- flags |= LISTENER_FLAGS.TargetBody;
162
- break;
163
- }
164
- return flags;
165
- };
166
- const trimFalsy = (data) => {
167
- const arr = data;
168
- for (let i = arr.length - 1; i >= 0; i--) {
169
- if (arr[i]) break;
170
- arr.pop();
171
- }
172
- return arr;
173
- };
174
- //#endregion
175
- //#region src/utils/is-glob.ts
176
- /**
177
- * Check if a string is a glob pattern (e.g. 'src/*.js' or something like that)
178
- *
179
- * @param str a string to check
180
- * @returns whether the string is a glob pattern or not
181
- */
182
- const isGlob = (str) => {
183
- const chars = {
184
- "{": "}",
185
- "(": ")",
186
- "[": "]"
187
- };
188
- const regex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/;
189
- if (str === "") return false;
190
- let match;
191
- while (match = regex.exec(str)) {
192
- if (match[2]) return true;
193
- let idx = match.index + match[0].length;
194
- const open = match[1];
195
- const close = open ? chars[open] : null;
196
- if (open && close) {
197
- const n = str.indexOf(close, idx);
198
- if (n !== -1) idx = n + 1;
199
- }
200
- str = str.slice(idx);
201
- }
202
- return false;
203
- };
204
- //#endregion
205
- //#region src/utils/is-root-path.ts
206
- /**
207
- * Checks if the path is the Operating System (OS) root path, such as "/" or "C:\". This function does not take the OS
208
- * the code is running on into account when performing this evaluation.
209
- * @param p the path to check
210
- * @returns `true` if the path is an OS root path, `false` otherwise
211
- */
212
- const isRootPath = (p) => p === "/" || windowsPathRegex.test(p);
213
- const windowsPathRegex = /^(?:[a-zA-Z]:|[\\/]{2}[^\\/]+[\\/]+[^\\/]+)?[\\/]$/;
214
- //#endregion
215
- //#region src/utils/message-utils.ts
216
- /**
217
- * Builds a template `Diagnostic` entity for a build error. The created `Diagnostic` is returned, and have little
218
- * detail attached to it regarding the specifics of the error - it is the responsibility of the caller of this method
219
- * to attach the specifics of the error message.
220
- *
221
- * The created `Diagnostic` is pushed to the `diagnostics` argument as a side effect of calling this method.
222
- *
223
- * @param diagnostics the existing diagnostics that the created template `Diagnostic` should be added to
224
- * @returns the created `Diagnostic`
225
- */
226
- const buildError = (diagnostics) => {
227
- const diagnostic = {
228
- level: "error",
229
- type: "build",
230
- header: "Build Error",
231
- messageText: "build error",
232
- relFilePath: void 0,
233
- absFilePath: void 0,
234
- lines: []
235
- };
236
- if (diagnostics) diagnostics.push(diagnostic);
237
- return diagnostic;
238
- };
239
- /**
240
- * Builds a template `Diagnostic` entity for a build warning. The created `Diagnostic` is returned, and have little
241
- * detail attached to it regarding the specifics of the warning - it is the responsibility of the caller of this method
242
- * to attach the specifics of the warning message.
243
- *
244
- * The created `Diagnostic` is pushed to the `diagnostics` argument as a side effect of calling this method.
245
- *
246
- * @param diagnostics the existing diagnostics that the created template `Diagnostic` should be added to
247
- * @returns the created `Diagnostic`
248
- */
249
- const buildWarn = (diagnostics) => {
250
- const diagnostic = {
251
- level: "warn",
252
- type: "build",
253
- header: "Build Warn",
254
- messageText: "build warn",
255
- lines: []
256
- };
257
- diagnostics.push(diagnostic);
258
- return diagnostic;
259
- };
260
- /**
261
- * Create a diagnostic message suited for representing an error in a JSON
262
- * file. This includes information about the exact lines in the JSON file which
263
- * caused the error and the path to the file.
264
- *
265
- * @param compilerCtx the current compiler context
266
- * @param diagnostics a list of diagnostics used as a return param
267
- * @param jsonFilePath the path to the JSON file where the error occurred
268
- * @param msg the error message
269
- * @param jsonField the key for the field which caused the error, used for finding
270
- * the error line in the original JSON file
271
- * @returns a reference to the newly-created diagnostic
272
- */
273
- const buildJsonFileError = (compilerCtx, diagnostics, jsonFilePath, msg, jsonField) => {
274
- const err = buildError(diagnostics);
275
- err.messageText = msg;
276
- err.absFilePath = jsonFilePath;
277
- if (typeof jsonField === "string") try {
278
- const lines = compilerCtx.fs.readFileSync(jsonFilePath).replace(/\r/g, "\n").split("\n");
279
- for (let i = 0; i < lines.length; i++) {
280
- const txtLine = lines[i];
281
- const txtIndex = txtLine.indexOf(jsonField);
282
- if (txtIndex > -1) {
283
- const warnLine = {
284
- lineIndex: i,
285
- lineNumber: i + 1,
286
- text: txtLine,
287
- errorCharStart: txtIndex,
288
- errorLength: jsonField.length
289
- };
290
- err.lineNumber = warnLine.lineNumber;
291
- err.columnNumber = txtIndex + 1;
292
- err.lines.push(warnLine);
293
- if (i >= 0) {
294
- const beforeWarnLine = {
295
- lineIndex: warnLine.lineIndex - 1,
296
- lineNumber: warnLine.lineNumber - 1,
297
- text: lines[i - 1],
298
- errorCharStart: -1,
299
- errorLength: -1
300
- };
301
- err.lines.unshift(beforeWarnLine);
302
- }
303
- if (i < lines.length) {
304
- const afterWarnLine = {
305
- lineIndex: warnLine.lineIndex + 1,
306
- lineNumber: warnLine.lineNumber + 1,
307
- text: lines[i + 1],
308
- errorCharStart: -1,
309
- errorLength: -1
310
- };
311
- err.lines.push(afterWarnLine);
312
- }
313
- break;
314
- }
315
- }
316
- } catch {}
317
- return err;
318
- };
319
- /**
320
- * Builds a diagnostic from an `Error`, appends it to the `diagnostics` parameter, and returns the created diagnostic
321
- * @param diagnostics the series of diagnostics the newly created diagnostics should be added to
322
- * @param err the error to derive information from in generating the diagnostic
323
- * @param msg an optional message to use in place of `err` to generate the diagnostic
324
- * @returns the generated diagnostic
325
- */
326
- const catchError = (diagnostics, err, msg) => {
327
- const diagnostic = {
328
- level: "error",
329
- type: "build",
330
- header: "Build Error",
331
- messageText: "build error",
332
- lines: []
333
- };
334
- if (isString(msg)) diagnostic.messageText = msg.length ? msg : "UNKNOWN ERROR";
335
- else if (err != null) if (err.stack != null) diagnostic.messageText = err.stack.toString();
336
- else if (err.message != null) diagnostic.messageText = err.message.length ? err.message : "UNKNOWN ERROR";
337
- else diagnostic.messageText = err.toString();
338
- if (diagnostics != null && !shouldIgnoreError(diagnostic.messageText)) diagnostics.push(diagnostic);
339
- return diagnostic;
340
- };
341
- /**
342
- * Determine if the provided diagnostics have any build errors
343
- * @param diagnostics the diagnostics to inspect
344
- * @returns true if any of the diagnostics in the list provided are errors that did not occur at runtime. false
345
- * otherwise.
346
- */
347
- const hasError = (diagnostics) => {
348
- if (diagnostics == null || diagnostics.length === 0) return false;
349
- return diagnostics.some((d) => d.level === "error" && d.type !== "runtime");
350
- };
351
- /**
352
- * Determine if the provided diagnostics have any warnings
353
- * @param diagnostics the diagnostics to inspect
354
- * @returns true if any of the diagnostics in the list provided are warnings. false otherwise.
355
- */
356
- const hasWarning = (diagnostics) => {
357
- if (diagnostics == null || diagnostics.length === 0) return false;
358
- return diagnostics.some((d) => d.level === "warn");
359
- };
360
- const shouldIgnoreError = (msg) => {
361
- return msg === TASK_CANCELED_MSG;
362
- };
363
- const TASK_CANCELED_MSG = `task canceled`;
364
- //#endregion
365
- //#region src/utils/logger/logger-utils.ts
366
- /**
367
- * Iterate through a series of diagnostics to provide minor fix-ups for various edge cases, deduplicate messages, etc.
368
- * @param compilerCtx the current compiler context
369
- * @param diagnostics the diagnostics to normalize
370
- * @returns the normalize documents
371
- */
372
- const normalizeDiagnostics = (compilerCtx, diagnostics) => {
373
- const maxErrorsToNormalize = 25;
374
- const normalizedErrors = [];
375
- const normalizedOthers = [];
376
- const dups = /* @__PURE__ */ new Set();
377
- for (let i = 0; i < diagnostics.length; i++) {
378
- const diagnostic = normalizeDiagnostic(compilerCtx, diagnostics[i]);
379
- const key = (diagnostic.absFilePath ?? "") + (diagnostic.code ?? "") + diagnostic.messageText + diagnostic.type;
380
- if (dups.has(key)) continue;
381
- dups.add(key);
382
- const total = normalizedErrors.length + normalizedOthers.length;
383
- if (diagnostic.level === "error") normalizedErrors.push(diagnostic);
384
- else if (total < maxErrorsToNormalize) normalizedOthers.push(diagnostic);
385
- }
386
- return [...normalizedErrors, ...normalizedOthers];
387
- };
388
- /**
389
- * Perform post-processing on a `Diagnostic` to handle a few message edge cases, massaging error message text and
390
- * updating build failure contexts
391
- * @param compilerCtx the current compiler
392
- * @param diagnostic the diagnostic to normalize
393
- * @returns the altered diagnostic
394
- */
395
- const normalizeDiagnostic = (compilerCtx, diagnostic) => {
396
- if (diagnostic.messageText) {
397
- if (typeof diagnostic.messageText.message === "string") diagnostic.messageText = diagnostic.messageText.message;
398
- else if (typeof diagnostic.messageText === "string" && diagnostic.messageText.indexOf("Error: ") === 0) diagnostic.messageText = diagnostic.messageText.slice(7);
399
- }
400
- if (diagnostic.messageText) {
401
- if (diagnostic.messageText.includes(`Cannot find name 'h'`)) {
402
- diagnostic.header = `Missing "h" import for JSX types`;
403
- diagnostic.messageText = `In order to load accurate JSX types for components, the "h" function must be imported from "@stencil/core" by each component using JSX. For example: import { Component, h } from '@stencil/core';`;
404
- if (diagnostic.absFilePath) try {
405
- const srcLines = splitLineBreaks(compilerCtx.fs.readFileSync(diagnostic.absFilePath));
406
- for (let i = 0; i < srcLines.length; i++) {
407
- const srcLine = srcLines[i];
408
- if (srcLine.includes("@stencil/core")) {
409
- const msgLines = [];
410
- const beforeLineIndex = i - 1;
411
- if (beforeLineIndex > -1) {
412
- const beforeLine = {
413
- lineIndex: beforeLineIndex,
414
- lineNumber: beforeLineIndex + 1,
415
- text: srcLines[beforeLineIndex],
416
- errorCharStart: -1,
417
- errorLength: -1
418
- };
419
- msgLines.push(beforeLine);
420
- }
421
- const errorLine = {
422
- lineIndex: i,
423
- lineNumber: i + 1,
424
- text: srcLine,
425
- errorCharStart: 0,
426
- errorLength: -1
427
- };
428
- msgLines.push(errorLine);
429
- diagnostic.lineNumber = errorLine.lineNumber;
430
- diagnostic.columnNumber = srcLine.indexOf("}");
431
- const afterLineIndex = i + 1;
432
- if (afterLineIndex < srcLines.length) {
433
- const afterLine = {
434
- lineIndex: afterLineIndex,
435
- lineNumber: afterLineIndex + 1,
436
- text: srcLines[afterLineIndex],
437
- errorCharStart: -1,
438
- errorLength: -1
439
- };
440
- msgLines.push(afterLine);
441
- }
442
- diagnostic.lines = msgLines;
443
- break;
444
- }
445
- }
446
- } catch {}
447
- }
448
- }
449
- return diagnostic;
450
- };
451
- /**
452
- * Split a corpus by newlines. Carriage returns are treated a newlines.
453
- * @param sourceText the corpus to split
454
- * @returns the split text
455
- */
456
- const splitLineBreaks = (sourceText) => {
457
- if (typeof sourceText !== "string") return [];
458
- sourceText = sourceText.replace(/\\r/g, "\n");
459
- return sourceText.split("\n");
460
- };
461
- const escapeHtml = (unsafe) => {
462
- if (unsafe === void 0) return "undefined";
463
- if (unsafe === null) return "null";
464
- if (typeof unsafe !== "string") unsafe = unsafe.toString();
465
- return unsafe.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
466
- };
467
- //#endregion
468
- //#region src/utils/logger/logger-rolldown.ts
469
- const loadRolldownDiagnostics = (config, compilerCtx, buildCtx, rolldownError) => {
470
- const formattedCode = formatErrorCode(rolldownError.code);
471
- const diagnostic = {
472
- level: "error",
473
- type: "bundling",
474
- language: "javascript",
475
- code: rolldownError.code,
476
- header: `Rolldown${formattedCode.length > 0 ? ": " + formattedCode : ""}`,
477
- messageText: formattedCode,
478
- relFilePath: void 0,
479
- absFilePath: void 0,
480
- lines: []
481
- };
482
- if (config.logLevel === "debug" && rolldownError.stack) diagnostic.messageText = rolldownError.stack;
483
- else if (rolldownError.message) diagnostic.messageText = rolldownError.message;
484
- if (rolldownError.plugin) diagnostic.messageText += ` (plugin: ${rolldownError.plugin}${rolldownError.hook ? `, ${rolldownError.hook}` : ""})`;
485
- const loc = rolldownError.loc;
486
- if (loc != null) {
487
- const srcFile = loc.file || rolldownError.id;
488
- if (isString(srcFile)) try {
489
- const sourceText = compilerCtx.fs.readFileSync(srcFile);
490
- if (sourceText) {
491
- diagnostic.absFilePath = srcFile;
492
- try {
493
- const srcLines = splitLineBreaks(sourceText);
494
- const errorLine = {
495
- lineIndex: loc.line - 1,
496
- lineNumber: loc.line,
497
- text: srcLines[loc.line - 1],
498
- errorCharStart: loc.column,
499
- errorLength: 0
500
- };
501
- diagnostic.lineNumber = errorLine.lineNumber;
502
- diagnostic.columnNumber = errorLine.errorCharStart;
503
- const highlightLine = errorLine.text?.slice(loc.column) ?? "";
504
- for (let i = 0; i < highlightLine.length; i++) {
505
- if (charBreak.has(highlightLine.charAt(i))) break;
506
- errorLine.errorLength++;
507
- }
508
- diagnostic.lines.push(errorLine);
509
- if (errorLine.errorLength === 0 && errorLine.errorCharStart > 0) {
510
- errorLine.errorLength = 1;
511
- errorLine.errorCharStart--;
512
- }
513
- if (errorLine.lineIndex > 0) {
514
- const previousLine = {
515
- lineIndex: errorLine.lineIndex - 1,
516
- lineNumber: errorLine.lineNumber - 1,
517
- text: srcLines[errorLine.lineIndex - 1],
518
- errorCharStart: -1,
519
- errorLength: -1
520
- };
521
- diagnostic.lines.unshift(previousLine);
522
- }
523
- if (errorLine.lineIndex + 1 < srcLines.length) {
524
- const nextLine = {
525
- lineIndex: errorLine.lineIndex + 1,
526
- lineNumber: errorLine.lineNumber + 1,
527
- text: srcLines[errorLine.lineIndex + 1],
528
- errorCharStart: -1,
529
- errorLength: -1
530
- };
531
- diagnostic.lines.push(nextLine);
532
- }
533
- } catch {
534
- diagnostic.messageText += `\nError parsing: ${diagnostic.absFilePath}, line: ${loc.line}, column: ${loc.column}`;
535
- diagnostic.debugText = sourceText;
536
- }
537
- } else if (typeof rolldownError.frame === "string") diagnostic.messageText += "\n" + rolldownError.frame;
538
- } catch {}
539
- }
540
- buildCtx.diagnostics.push(diagnostic);
541
- };
542
- const createOnWarnFn = (diagnostics, bundleModulesFiles) => {
543
- const previousWarns = /* @__PURE__ */ new Set();
544
- return function onWarningMessage(warning) {
545
- if (warning == null || warning.code && ignoreWarnCodes.has(warning.code) || warning.message && previousWarns.has(warning.message)) return;
546
- if (warning.message) previousWarns.add(warning.message);
547
- let label = "";
548
- if (bundleModulesFiles) {
549
- label = bundleModulesFiles.reduce((cmps, m) => {
550
- cmps.push(...m.cmps);
551
- return cmps;
552
- }, []).join(", ").trim();
553
- if (label.length) label += ": ";
554
- }
555
- const diagnostic = buildWarn(diagnostics);
556
- diagnostic.header = `Bundling Warning ${warning.code}`;
557
- diagnostic.messageText = label + (warning.message || warning);
558
- };
559
- };
560
- const ignoreWarnCodes = new Set([
561
- "THIS_IS_UNDEFINED",
562
- "NON_EXISTENT_EXPORT",
563
- "CIRCULAR_DEPENDENCY",
564
- "EMPTY_BUNDLE",
565
- "UNUSED_EXTERNAL_IMPORT"
566
- ]);
567
- const charBreak = new Set([
568
- " ",
569
- "=",
570
- ".",
571
- ",",
572
- "?",
573
- ":",
574
- ";",
575
- "(",
576
- ")",
577
- "{",
578
- "}",
579
- "[",
580
- "]",
581
- "|",
582
- `'`,
583
- `"`,
584
- "`"
585
- ]);
586
- const formatErrorCode = (errorCode) => {
587
- if (typeof errorCode === "string") return errorCode.split("_").map((c) => {
588
- return toTitleCase(c.toLowerCase());
589
- }).join(" ");
590
- return (errorCode || "").trim();
591
- };
592
- //#endregion
593
- //#region src/utils/path.ts
594
- /**
595
- * Convert Windows backslash paths to slash paths: foo\\bar ➔ foo/bar
596
- * Forward-slash paths can be used in Windows as long as they're not
597
- * extended-length paths and don't contain any non-ascii characters.
598
- * This was created since the path methods in Node.js outputs \\ paths on Windows.
599
- * @param path the Windows-based path to convert
600
- * @param relativize whether or not a relative path should have `./` prepended
601
- * @returns the converted path
602
- */
603
- const normalizePath = (path, relativize = true) => {
604
- if (typeof path !== "string") throw new Error(`invalid path to normalize`);
605
- path = normalizeSlashes(path.trim());
606
- const reducedComponents = reducePathComponents(pathComponents(path, getRootLength(path)));
607
- const rootPart = reducedComponents[0];
608
- const secondPart = reducedComponents[1];
609
- const normalized = rootPart + reducedComponents.slice(1).join("/");
610
- if (normalized === "") return ".";
611
- if (rootPart === "" && secondPart && path.includes("/") && !secondPart.startsWith(".") && !secondPart.startsWith("@") && relativize) return "./" + normalized;
612
- return normalized;
613
- };
614
- const normalizeSlashes = (path) => path.replace(backslashRegExp, "/");
615
- const altDirectorySeparator = "\\";
616
- const urlSchemeSeparator = "://";
617
- const backslashRegExp = /\\/g;
618
- const reducePathComponents = (components) => {
619
- if (!Array.isArray(components) || components.length === 0) return [];
620
- const reduced = [components[0]];
621
- for (let i = 1; i < components.length; i++) {
622
- const component = components[i];
623
- if (!component) continue;
624
- if (component === ".") continue;
625
- if (component === "..") {
626
- if (reduced.length > 1) {
627
- if (reduced[reduced.length - 1] !== "..") {
628
- reduced.pop();
629
- continue;
630
- }
631
- } else if (reduced[0]) continue;
632
- }
633
- reduced.push(component);
634
- }
635
- return reduced;
636
- };
637
- const getRootLength = (path) => {
638
- const rootLength = getEncodedRootLength(path);
639
- return rootLength < 0 ? ~rootLength : rootLength;
640
- };
641
- const getEncodedRootLength = (path) => {
642
- if (!path) return 0;
643
- const ch0 = path.charCodeAt(0);
644
- if (ch0 === CharacterCodes.slash || ch0 === CharacterCodes.backslash) {
645
- if (path.charCodeAt(1) !== ch0) return 1;
646
- const p1 = path.indexOf(ch0 === CharacterCodes.slash ? "/" : altDirectorySeparator, 2);
647
- if (p1 < 0) return path.length;
648
- return p1 + 1;
649
- }
650
- if (isVolumeCharacter(ch0) && path.charCodeAt(1) === CharacterCodes.colon) {
651
- const ch2 = path.charCodeAt(2);
652
- if (ch2 === CharacterCodes.slash || ch2 === CharacterCodes.backslash) return 3;
653
- if (path.length === 2) return 2;
654
- }
655
- const schemeEnd = path.indexOf(urlSchemeSeparator);
656
- if (schemeEnd !== -1) {
657
- const authorityStart = schemeEnd + 3;
658
- const authorityEnd = path.indexOf("/", authorityStart);
659
- if (authorityEnd !== -1) {
660
- const scheme = path.slice(0, schemeEnd);
661
- const authority = path.slice(authorityStart, authorityEnd);
662
- if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(path.charCodeAt(authorityEnd + 1))) {
663
- const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path, authorityEnd + 2);
664
- if (volumeSeparatorEnd !== -1) {
665
- if (path.charCodeAt(volumeSeparatorEnd) === CharacterCodes.slash) return ~(volumeSeparatorEnd + 1);
666
- if (volumeSeparatorEnd === path.length) return ~volumeSeparatorEnd;
667
- }
668
- }
669
- return ~(authorityEnd + 1);
670
- }
671
- return ~path.length;
672
- }
673
- return 0;
674
- };
675
- const isVolumeCharacter = (charCode) => charCode >= CharacterCodes.a && charCode <= CharacterCodes.z || charCode >= CharacterCodes.A && charCode <= CharacterCodes.Z;
676
- const getFileUrlVolumeSeparatorEnd = (url, start) => {
677
- const ch0 = url.charCodeAt(start);
678
- if (ch0 === CharacterCodes.colon) return start + 1;
679
- if (ch0 === CharacterCodes.percent && url.charCodeAt(start + 1) === CharacterCodes._3) {
680
- const ch2 = url.charCodeAt(start + 2);
681
- if (ch2 === CharacterCodes.a || ch2 === CharacterCodes.A) return start + 3;
682
- }
683
- return -1;
684
- };
685
- const pathComponents = (path, rootLength) => {
686
- const root = path.substring(0, rootLength);
687
- const rest = path.substring(rootLength).split("/");
688
- const restLen = rest.length;
689
- if (restLen > 0 && !rest[restLen - 1]) rest.pop();
690
- return [root, ...rest];
691
- };
692
- /**
693
- * Same as normalizePath(), expect it'll also strip any query strings
694
- * from the path name. So /dir/file.css?tag=cmp-a becomes /dir/file.css
695
- * @param p the path to normalize
696
- * @returns the normalized path, sans any query strings
697
- */
698
- const normalizeFsPath = (p) => normalizePath(p.split("?")[0].replace(/\0/g, ""));
699
- const normalizeFsPathQuery = (importPath) => {
700
- const pathParts = importPath.split("?");
701
- const filePath = normalizePath(pathParts[0]);
702
- const filePathParts = filePath.split(".");
703
- const ext = filePathParts.length > 1 ? filePathParts.pop().toLowerCase() : null;
704
- const params = pathParts.length > 1 ? new URLSearchParams(pathParts[1]) : null;
705
- return {
706
- filePath,
707
- ext,
708
- format: params ? params.get("format") : null
709
- };
710
- };
711
- var CharacterCodes = /* @__PURE__ */ function(CharacterCodes) {
712
- CharacterCodes[CharacterCodes["a"] = 97] = "a";
713
- CharacterCodes[CharacterCodes["A"] = 65] = "A";
714
- CharacterCodes[CharacterCodes["z"] = 122] = "z";
715
- CharacterCodes[CharacterCodes["Z"] = 90] = "Z";
716
- CharacterCodes[CharacterCodes["_3"] = 51] = "_3";
717
- CharacterCodes[CharacterCodes["backslash"] = 92] = "backslash";
718
- CharacterCodes[CharacterCodes["colon"] = 58] = "colon";
719
- CharacterCodes[CharacterCodes["dot"] = 46] = "dot";
720
- CharacterCodes[CharacterCodes["percent"] = 37] = "percent";
721
- CharacterCodes[CharacterCodes["slash"] = 47] = "slash";
722
- return CharacterCodes;
723
- }(CharacterCodes || {});
724
- /**
725
- * A wrapped version of node.js' {@link path.relative} which adds our custom
726
- * normalization logic. This solves the relative path between `from` and `to`!
727
- *
728
- * The calculation of the returned path follows that of Node's logic, with one exception - if the calculated path
729
- * results in an empty string, a string of length one with a period (`'.'`) is returned.
730
- *
731
- * @throws the underlying node.js function can throw if either path is not a
732
- * string
733
- * @param from the path where relative resolution starts
734
- * @param to the destination path
735
- * @returns the resolved relative path
736
- */
737
- function relative$1(from, to) {
738
- /**
739
- * When normalizing, we should _not_ attempt to relativize the path returned by the native Node `relative` method.
740
- * When finding the relative path between `from` and `to`, Node does not prepend './' to a non-zero length calculated
741
- * path. However, our algorithm does differ from that of Node's, as described in this function's JSDoc when a zero
742
- * length string is encountered.
743
- */
744
- return normalizePath(path.relative(from, to), false);
745
- }
746
- /**
747
- * A wrapped version of node.js' {@link path.join} which adds our custom
748
- * normalization logic. This joins all the arguments (path fragments) into a
749
- * single path.
750
- *
751
- * The calculation of the returned path follows that of Node's logic, with one exception - any trailing slashes will
752
- * be removed from the calculated path.
753
- *
754
- * @throws the underlying node function will throw if any argument is not a
755
- * string
756
- * @param paths the paths to join together
757
- * @returns a joined path!
758
- */
759
- function join$1(...paths) {
760
- /**
761
- * When normalizing, we should _not_ attempt to relativize the path returned by the native Node `join` method. When
762
- * calculating the path from each of the string-based parts, Node does not prepend './' to any calculated path.
763
- *
764
- * Note that our algorithm does differ from Node's, as described in this function's JSDoc regarding trailing
765
- * slashes.
766
- */
767
- return normalizePath(path.join(...paths), false);
768
- }
769
- /**
770
- * A wrapped version of node.js' {@link path.resolve} which adds our custom
771
- * normalization logic. This resolves a path to a given (relative or absolute)
772
- * path.
773
- *
774
- * @throws the underlying node function will throw if any argument is not a
775
- * string
776
- * @param paths a path or path fragments to resolve
777
- * @returns a resolved path!
778
- */
779
- function resolve(...paths) {
780
- /**
781
- * When normalizing, we should _not_ attempt to relativize the path returned by the native Node `resolve` method. When
782
- * calculating the path from each of the string-based parts, Node does not prepend './' to the calculated path.
783
- */
784
- return normalizePath(path.resolve(...paths), false);
785
- }
786
- /**
787
- * A wrapped version of node.js' {@link path.normalize} which adds our custom
788
- * normalization logic. This normalizes a path, de-duping repeated segment
789
- * separators and resolving `'..'` segments.
790
- *
791
- * @throws the underlying node function will throw if the argument is not a
792
- * string
793
- * @param toNormalize a path to normalize
794
- * @returns a normalized path!
795
- */
796
- function normalize(toNormalize) {
797
- /**
798
- * When normalizing, we should _not_ attempt to relativize the path returned by the native Node `normalize` method.
799
- * When calculating the path from each of the string-based parts, Node does not prepend './' to the calculated path.
800
- */
801
- return normalizePath(path.normalize(toNormalize), false);
802
- }
803
- //#endregion
804
- //#region src/utils/logger/logger-typescript.ts
805
- /**
806
- * Augment a `Diagnostic` with information from a `Node` in the AST to provide richer error information
807
- * @param d the diagnostic to augment
808
- * @param node the node to augment with additional information
809
- * @returns the augmented diagnostic
810
- */
811
- const augmentDiagnosticWithNode = (d, node) => {
812
- if (!node) return d;
813
- const sourceFile = node.getSourceFile();
814
- if (!sourceFile) return d;
815
- d.absFilePath = normalizePath(sourceFile.fileName);
816
- const sourceText = sourceFile.text;
817
- const srcLines = splitLineBreaks(sourceText);
818
- const start = node.getStart();
819
- const end = node.getEnd();
820
- const posStart = sourceFile.getLineAndCharacterOfPosition(start);
821
- const errorLine = {
822
- lineIndex: posStart.line,
823
- lineNumber: posStart.line + 1,
824
- text: srcLines[posStart.line],
825
- errorCharStart: posStart.character,
826
- errorLength: Math.max(end - start, 1)
827
- };
828
- d.lineNumber = errorLine.lineNumber;
829
- d.columnNumber = errorLine.errorCharStart + 1;
830
- d.lines.push(errorLine);
831
- if (errorLine.errorLength === 0 && errorLine.errorCharStart > 0) {
832
- errorLine.errorLength = 1;
833
- errorLine.errorCharStart--;
834
- }
835
- if (errorLine.lineIndex > 0) {
836
- const previousLine = {
837
- lineIndex: errorLine.lineIndex - 1,
838
- lineNumber: errorLine.lineNumber - 1,
839
- text: srcLines[errorLine.lineIndex - 1],
840
- errorCharStart: -1,
841
- errorLength: -1
842
- };
843
- d.lines.unshift(previousLine);
844
- }
845
- if (errorLine.lineIndex + 1 < srcLines.length) {
846
- const nextLine = {
847
- lineIndex: errorLine.lineIndex + 1,
848
- lineNumber: errorLine.lineNumber + 1,
849
- text: srcLines[errorLine.lineIndex + 1],
850
- errorCharStart: -1,
851
- errorLength: -1
852
- };
853
- d.lines.push(nextLine);
854
- }
855
- return d;
856
- };
857
- /**
858
- * Ok, so formatting overkill, we know. But whatever, it makes for great
859
- * error reporting within a terminal. So, yeah, let's code it up, shall we?
860
- */
861
- /**
862
- * Convert an array of TypeScript diagnostics to Stencil diagnostic format.
863
- *
864
- * @param tsDiagnostics - array of TypeScript diagnostic objects
865
- * @returns array of Stencil diagnostic objects
866
- */
867
- const loadTypeScriptDiagnostics = (tsDiagnostics) => {
868
- const diagnostics = [];
869
- const maxErrors = Math.min(tsDiagnostics.length, 50);
870
- for (let i = 0; i < maxErrors; i++) diagnostics.push(loadTypeScriptDiagnostic(tsDiagnostics[i]));
871
- return diagnostics;
872
- };
873
- /**
874
- * Convert a TypeScript diagnostic object into our internal, Stencil-specific
875
- * diagnostic format
876
- *
877
- * @param tsDiagnostic a TypeScript diagnostic message record
878
- * @returns a Stencil diagnostic, suitable for showing an error to the user
879
- */
880
- const loadTypeScriptDiagnostic = (tsDiagnostic) => {
881
- const d = {
882
- absFilePath: void 0,
883
- code: tsDiagnostic.code.toString(),
884
- columnNumber: void 0,
885
- header: "TypeScript",
886
- language: "typescript",
887
- level: "warn",
888
- lineNumber: void 0,
889
- lines: [],
890
- messageText: flattenDiagnosticMessageText(tsDiagnostic, tsDiagnostic.messageText),
891
- relFilePath: void 0,
892
- type: "typescript"
893
- };
894
- if (tsDiagnostic.category === 1) d.level = "error";
895
- if (tsDiagnostic.file && typeof tsDiagnostic.start === "number") {
896
- d.absFilePath = tsDiagnostic.file.fileName;
897
- const sourceText = tsDiagnostic.file.text;
898
- const srcLines = splitLineBreaks(sourceText);
899
- const posData = tsDiagnostic.file.getLineAndCharacterOfPosition(tsDiagnostic.start);
900
- const errorLine = {
901
- lineIndex: posData.line,
902
- lineNumber: posData.line + 1,
903
- text: srcLines[posData.line],
904
- errorCharStart: posData.character,
905
- errorLength: Math.max(tsDiagnostic.length ?? 0, 1)
906
- };
907
- d.lineNumber = errorLine.lineNumber;
908
- d.columnNumber = errorLine.errorCharStart + 1;
909
- d.lines.push(errorLine);
910
- if (errorLine.errorLength === 0 && errorLine.errorCharStart > 0) {
911
- errorLine.errorLength = 1;
912
- errorLine.errorCharStart--;
913
- }
914
- if (errorLine.lineIndex > 0) {
915
- const previousLine = {
916
- lineIndex: errorLine.lineIndex - 1,
917
- lineNumber: errorLine.lineNumber - 1,
918
- text: srcLines[errorLine.lineIndex - 1],
919
- errorCharStart: -1,
920
- errorLength: -1
921
- };
922
- d.lines.unshift(previousLine);
923
- }
924
- if (errorLine.lineIndex + 1 < srcLines.length) {
925
- const nextLine = {
926
- lineIndex: errorLine.lineIndex + 1,
927
- lineNumber: errorLine.lineNumber + 1,
928
- text: srcLines[errorLine.lineIndex + 1],
929
- errorCharStart: -1,
930
- errorLength: -1
931
- };
932
- d.lines.push(nextLine);
933
- }
934
- }
935
- return d;
936
- };
937
- /**
938
- * Flatten a TypeScript diagnostic object into a string which can be easily
939
- * included in a Stencil diagnostic record.
940
- *
941
- * @param tsDiagnostic a TypeScript diagnostic record
942
- * @param diag a {@link DiagnosticMessageChain} or a string with further info
943
- * @returns a string with the relevant error message
944
- */
945
- const flattenDiagnosticMessageText = (tsDiagnostic, diag) => {
946
- if (typeof diag === "string") return diag;
947
- else if (diag === void 0) return "";
948
- const ignoreCodes = [];
949
- const isStencilConfig = (tsDiagnostic.file?.fileName ?? "").includes("stencil.config");
950
- if (isStencilConfig) ignoreCodes.push(2322);
951
- let result = "";
952
- if (!ignoreCodes.includes(diag.code)) {
953
- result = diag.messageText;
954
- if (isIterable(diag.next)) for (const kid of diag.next) result += flattenDiagnosticMessageText(tsDiagnostic, kid);
955
- }
956
- if (isStencilConfig) {
957
- result = result.replace(`type 'StencilConfig'`, `Stencil Config`);
958
- result = result.replace(`Object literal may only specify known properties, but `, ``);
959
- result = result.replace(`Object literal may only specify known properties, and `, ``);
960
- }
961
- return result.trim();
962
- };
963
- //#endregion
964
- //#region src/utils/output-target.ts
965
- /**
966
- * Checks if a component tag name matches any of the exclude patterns.
967
- * Supports glob patterns using minimatch.
968
- *
969
- * @param tagName The component's tag name to check
970
- * @param excludePatterns Array of patterns to match against (supports globs)
971
- * @returns true if the component should be excluded, false otherwise
972
- */
973
- const shouldExcludeComponent = (tagName, excludePatterns) => {
974
- if (!excludePatterns || excludePatterns.length === 0) return false;
975
- return excludePatterns.some((pattern) => {
976
- if (isGlob(pattern)) return minimatch(tagName, pattern);
977
- return pattern === tagName;
978
- });
979
- };
980
- /**
981
- * Filters out components that match the excludeComponents patterns from the config.
982
- * Only applies filtering to production builds (when devMode is false) - dev builds include all components.
983
- *
984
- * @param components Array of component metadata
985
- * @param config The validated Stencil configuration
986
- * @returns Object containing filtered components and excluded components
987
- */
988
- const filterExcludedComponents = (components, config) => {
989
- if (config.devMode) return {
990
- components,
991
- excludedComponents: []
992
- };
993
- const excludePatterns = config.excludeComponents;
994
- if (!excludePatterns || excludePatterns.length === 0) return {
995
- components,
996
- excludedComponents: []
997
- };
998
- const excludedComponents = [];
999
- const excludedTags = [];
1000
- const filtered = components.filter((cmp) => {
1001
- const shouldExclude = shouldExcludeComponent(cmp.tagName, excludePatterns);
1002
- if (shouldExclude) {
1003
- excludedComponents.push(cmp);
1004
- excludedTags.push(cmp.tagName);
1005
- config.logger.debug(`Excluding component from build: ${cmp.tagName}`);
1006
- }
1007
- return !shouldExclude;
1008
- });
1009
- if (excludedTags.length > 0) {
1010
- const tagList = excludedTags.join(", ");
1011
- config.logger.info(`Excluding ${excludedTags.length} component${excludedTags.length === 1 ? "" : "s"} from production build: ${tagList}`);
1012
- }
1013
- return {
1014
- components: filtered,
1015
- excludedComponents
1016
- };
1017
- };
1018
- const relativeImport = (pathFrom, pathTo, ext, addPrefix = true) => {
1019
- let relativePath = relative(dirname(pathFrom), dirname(pathTo));
1020
- if (addPrefix) {
1021
- if (relativePath === "") relativePath = ".";
1022
- else if (relativePath[0] !== ".") relativePath = "./" + relativePath;
1023
- }
1024
- return normalizePath(`${relativePath}/${basename(pathTo, ext)}`);
1025
- };
1026
- const getComponentsDtsSrcFilePath = (config) => join$1(config.srcDir, GENERATED_DTS);
1027
- /**
1028
- * Helper to get an appropriate file path for `components.d.ts` for a `"dist"`
1029
- * or `"dist-types"` output target.
1030
- *
1031
- * @param outputTarget the output target of interest
1032
- * @returns a properly-formatted path
1033
- */
1034
- const getComponentsDtsTypesFilePath = (outputTarget) => join$1(outputTarget.typesDir, GENERATED_DTS);
1035
- const isOutputTargetDist = (o) => o.type === DIST;
1036
- const isOutputTargetDistCollection = (o) => o.type === DIST_COLLECTION;
1037
- const isOutputTargetDistCustomElements = (o) => o.type === DIST_CUSTOM_ELEMENTS;
1038
- const isOutputTargetCopy = (o) => o.type === COPY;
1039
- const isOutputTargetDistLazy = (o) => o.type === DIST_LAZY;
1040
- const isOutputTargetDistLazyLoader = (o) => o.type === DIST_LAZY_LOADER;
1041
- const isOutputTargetDistGlobalStyles = (o) => o.type === DIST_GLOBAL_STYLES;
1042
- const isOutputTargetHydrate = (o) => o.type === DIST_HYDRATE_SCRIPT;
1043
- const isOutputTargetCustom = (o) => o.type === CUSTOM;
1044
- const isOutputTargetDocs = (o) => o.type === "docs-readme" || o.type === "docs-json" || o.type === "docs-custom" || o.type === "docs-vscode" || o.type === "docs-custom-elements-manifest";
1045
- const isOutputTargetDocsReadme = (o) => o.type === DOCS_README;
1046
- const isOutputTargetDocsJson = (o) => o.type === DOCS_JSON;
1047
- const isOutputTargetDocsCustom = (o) => o.type === DOCS_CUSTOM;
1048
- const isOutputTargetDocsVscode = (o) => o.type === DOCS_VSCODE;
1049
- const isOutputTargetDocsCustomElementsManifest = (o) => o.type === DOCS_CUSTOM_ELEMENTS_MANIFEST;
1050
- const isOutputTargetWww = (o) => o.type === "www";
1051
- const isOutputTargetStats = (o) => o.type === STATS;
1052
- const isOutputTargetDistTypes = (o) => o.type === DIST_TYPES;
1053
- /**
1054
- * Checks whether or not the supplied output target's type matches one of the eligible primary
1055
- * package output target types (i.e. it can have `isPrimaryPackageOutputTarget: true` in its config).
1056
- *
1057
- * @param o The output target to check.
1058
- * @returns Whether the output target type is one of the "primary" output targets.
1059
- */
1060
- const isEligiblePrimaryPackageOutputTarget = (o) => isOutputTargetDist(o) || isOutputTargetDistCollection(o) || isOutputTargetDistCustomElements(o) || isOutputTargetDistTypes(o);
1061
- /**
1062
- * Retrieve the Stencil component compiler metadata from a collection of Stencil {@link d.Module}s
1063
- * @param moduleFiles the collection of `Module`s to retrieve the metadata from
1064
- * @returns the metadata, lexicographically sorted by the tag names of the components
1065
- */
1066
- const getComponentsFromModules = (moduleFiles) => sortBy(flatOne(moduleFiles.map((m) => m.cmps)), (c) => c.tagName);
1067
- /**
1068
- * Check whether a given output target is a valid one to be set in a Stencil config
1069
- *
1070
- * @param targetType the type which we want to check
1071
- * @returns whether or not the targetType is a valid, configurable output target.
1072
- */
1073
- function isValidConfigOutputTarget(targetType) {
1074
- return VALID_CONFIG_OUTPUT_TARGETS.includes(targetType);
1075
- }
1076
- //#endregion
1077
- //#region src/utils/result.ts
1078
- var result_exports = /* @__PURE__ */ __exportAll({
1079
- err: () => err,
1080
- map: () => map,
1081
- ok: () => ok,
1082
- unwrap: () => unwrap,
1083
- unwrapErr: () => unwrapErr
1084
- });
1085
- /**
1086
- * Create an `Ok` given a value. This doesn't do any checking that the value is
1087
- * 'ok-ish' since doing so would make an undue assumption about what is 'ok'.
1088
- * Instead, this trusts the user to determine, at the call site, whether
1089
- * something is `ok()` or `err()`.
1090
- *
1091
- * @param value the value to wrap up in an `Ok`
1092
- * @returns an Ok wrapping the value
1093
- */
1094
- const ok = (value) => ({
1095
- isOk: true,
1096
- isErr: false,
1097
- value
1098
- });
1099
- /**
1100
- * Create an `Err` given a value.
1101
- *
1102
- * @param value the value to wrap up in an `Err`
1103
- * @returns an Ok wrapping the value
1104
- */
1105
- const err = (value) => ({
1106
- isOk: false,
1107
- isErr: true,
1108
- value
1109
- });
1110
- function map(result, fn) {
1111
- if (result.isOk) {
1112
- const val = fn(result.value);
1113
- if (val instanceof Promise) return val.then((newVal) => ok(newVal));
1114
- else return ok(val);
1115
- }
1116
- if (result.isErr) {
1117
- const value = result.value;
1118
- return err(value);
1119
- }
1120
- throw "should never get here";
1121
- }
1122
- /**
1123
- * Unwrap a {@link Result}, return the value inside if it is an `Ok` and
1124
- * throw with the wrapped value if it is an `Err`.
1125
- *
1126
- * @throws with the wrapped value if it is an `Err`.
1127
- * @param result a result to peer inside of
1128
- * @returns the wrapped value, if `Ok`
1129
- */
1130
- const unwrap = (result) => {
1131
- if (result.isOk) return result.value;
1132
- else throw result.value;
1133
- };
1134
- /**
1135
- * Unwrap a {@link Result}, return the value inside if it is an `Err` and
1136
- * throw with the wrapped value if it is an `Ok`.
1137
- *
1138
- * @throws with the wrapped value if it is an `Ok`.
1139
- * @param result a result to peer inside of
1140
- * @returns the wrapped value, if `Err`
1141
- */
1142
- const unwrapErr = (result) => {
1143
- if (result.isErr) return result.value;
1144
- else throw result.value;
1145
- };
1146
- //#endregion
1147
- //#region src/utils/sourcemaps.ts
1148
- function rolldownToStencilSourceMap(rolldownSourceMap) {
1149
- if (!rolldownSourceMap || !rolldownSourceMap.file) return null;
1150
- return {
1151
- file: rolldownSourceMap.file,
1152
- mappings: rolldownSourceMap.mappings,
1153
- names: rolldownSourceMap.names,
1154
- sources: rolldownSourceMap.sources,
1155
- sourcesContent: rolldownSourceMap.sourcesContent,
1156
- version: rolldownSourceMap.version
1157
- };
1158
- }
1159
- /**
1160
- * A JavaScript formatted string used to link generated code back to the original. This string follows the guidelines
1161
- * found in the [Linking generated code to source maps](https://sourcemaps.info/spec.html#h.lmz475t4mvbx) section of
1162
- * the Sourcemaps V3 specification proposal.
1163
- */
1164
- const JS_SOURCE_MAPPING_URL_LINKER = "//# sourceMappingURL=";
1165
- /**
1166
- * Generates an RFC-3986 compliant string for the given input.
1167
- * More information about RFC-3986 can be found [here](https://datatracker.ietf.org/doc/html/rfc3986)
1168
- * This function's original source is derived from
1169
- * [MDN's encodeURIComponent documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent#description)
1170
- * @param filename the filename to encode
1171
- * @returns the encoded URI
1172
- */
1173
- const encodeToRfc3986 = (filename) => {
1174
- return encodeURIComponent(filename).replace(/[!'()*]/g, (matchedCharacter) => {
1175
- return "%" + matchedCharacter.charCodeAt(0).toString(16);
1176
- });
1177
- };
1178
- /**
1179
- * Generates a string used to link generated code with the original source, to be placed at the end of the generated
1180
- * code.
1181
- * @param url the url of the source map
1182
- * @returns a linker string, of the format {@link JS_SOURCE_MAPPING_URL_LINKER}=<url>
1183
- */
1184
- const getSourceMappingUrlLinker = (url) => {
1185
- return `${JS_SOURCE_MAPPING_URL_LINKER}${encodeToRfc3986(url)}`;
1186
- };
1187
- /**
1188
- * Generates a string used to link generated code with the original source, to be placed at the end of the generated
1189
- * code as an inline source map.
1190
- * @param sourceMapContents the sourceMapContents of the source map
1191
- * @returns a linker string, of the format {@link JS_SOURCE_MAPPING_URL_LINKER}<dataUriPrefixAndMime><sourceMapContents>
1192
- */
1193
- const getInlineSourceMappingUrlLinker = (sourceMapContents) => {
1194
- return `${JS_SOURCE_MAPPING_URL_LINKER}data:application/json;charset=utf-8;base64,${Buffer.from(sourceMapContents, "utf8").toString("base64")}`;
1195
- };
1196
- /**
1197
- * Generates a string used to link generated code with the original source, to be placed at the end of the generated
1198
- * code. This function prepends a newline to the string.
1199
- * @param url the url of the source map
1200
- * @returns a linker string, of the format {@link JS_SOURCE_MAPPING_URL_LINKER}=<url>.map, prepended with a newline
1201
- */
1202
- const getSourceMappingUrlForEndOfFile = (url) => {
1203
- return `\n${getSourceMappingUrlLinker(url)}.map`;
1204
- };
1205
- //#endregion
1206
- //#region src/utils/url-paths.ts
1207
- /**
1208
- * Determines whether a string should be considered a remote url or not.
1209
- *
1210
- * This helper only checks the provided string to evaluate is one of a few pre-defined schemes, and should not be
1211
- * considered all-encompassing
1212
- *
1213
- * @param p the string to evaluate
1214
- * @returns `true` if the provided string is a remote url, `false` otherwise
1215
- */
1216
- const isRemoteUrl = (p) => {
1217
- if (isString(p)) {
1218
- p = p.toLowerCase();
1219
- return p.startsWith("https://") || p.startsWith("http://");
1220
- }
1221
- return false;
1222
- };
1223
- //#endregion
1224
- //#region src/utils/util.ts
1225
- /**
1226
- * A set of JSDoc tags which should be excluded from JSDoc comments
1227
- * included in output typedefs.
1228
- */
1229
- const SUPPRESSED_JSDOC_TAGS = [
1230
- "virtualProp",
1231
- "slot",
1232
- "part",
1233
- "internal"
1234
- ];
1235
- const LINE_BREAK_REGEX = /\r?\n|\r/g;
1236
- /**
1237
- * Create a stylistically-appropriate JS variable name from a filename
1238
- *
1239
- * If the filename has any of the special characters "?", "#", "&" and "=" it
1240
- * will take the string before the left-most instance of one of those
1241
- * characters.
1242
- *
1243
- * @param fileName the filename which serves as starting material
1244
- * @returns a JS variable name based on the filename
1245
- */
1246
- const createJsVarName = (fileName) => {
1247
- if (isString(fileName)) {
1248
- fileName = fileName.split("?")[0];
1249
- fileName = fileName.split("#")[0];
1250
- fileName = fileName.split("&")[0];
1251
- fileName = fileName.split("=")[0];
1252
- fileName = toDashCase(fileName);
1253
- fileName = fileName.replace(/[|;$%@"<>()+,.{}_!/\\]/g, "-");
1254
- fileName = dashToPascalCase(fileName);
1255
- if (fileName.length > 1) fileName = fileName[0].toLowerCase() + fileName.slice(1);
1256
- else fileName = fileName.toLowerCase();
1257
- if (fileName.length > 0 && !isNaN(fileName[0])) fileName = "_" + fileName;
1258
- }
1259
- return fileName;
1260
- };
1261
- /**
1262
- * Create a function that lowercases the first string parameter before passing it to the provided function
1263
- * @param fn the function to pass the lowercased path to
1264
- * @returns the result of the provided function
1265
- */
1266
- const lowerPathParam = (fn) => (p) => fn(p.toLowerCase());
1267
- /**
1268
- * Determine if a stringified file path is a TypeScript declaration file based on the extension at the end of the path.
1269
- * @param p the path to evaluate
1270
- * @returns `true` if the path ends in `.d.ts` (case-sensitive), `false` otherwise.
1271
- */
1272
- const isDtsFile = lowerPathParam((p) => p.endsWith(".d.ts") || p.endsWith(".d.mts") || p.endsWith(".d.cts"));
1273
- /**
1274
- * Determine if a stringified file path is a TypeScript file based on the extension at the end of the path. This
1275
- * function does _not_ consider type declaration files (`.d.ts` files) to be TypeScript files.
1276
- * @param p the path to evaluate
1277
- * @returns `true` if the path ends in `.ts` (case-sensitive) but does _not_ end in `.d.ts`, `false` otherwise.
1278
- */
1279
- const isTsFile = lowerPathParam((p) => !isDtsFile(p) && (p.endsWith(".ts") || p.endsWith(".mts") || p.endsWith(".cts")));
1280
- /**
1281
- * Determine if a stringified file path is a TSX file based on the extension at the end of the path
1282
- * @param p the path to evaluate
1283
- * @returns `true` if the path ends in `.tsx` (case-sensitive), `false` otherwise.
1284
- */
1285
- const isTsxFile = lowerPathParam((p) => p.endsWith(".tsx") || p.endsWith(".mtsx") || p.endsWith(".ctsx"));
1286
- /**
1287
- * Determine if a stringified file path is a JSX file based on the extension at the end of the path
1288
- * @param p the path to evaluate
1289
- * @returns `true` if the path ends in `.jsx` (case-sensitive), `false` otherwise.
1290
- */
1291
- const isJsxFile = lowerPathParam((p) => p.endsWith(".jsx") || p.endsWith(".mjsx") || p.endsWith(".cjsx"));
1292
- /**
1293
- * Determine if a stringified file path is a JavaScript file based on the extension at the end of the path
1294
- * @param p the path to evaluate
1295
- * @returns `true` if the path ends in `.js` (case-sensitive), `false` otherwise.
1296
- */
1297
- const isJsFile = lowerPathParam((p) => p.endsWith(".js") || p.endsWith(".mjs") || p.endsWith(".cjs"));
1298
- /**
1299
- * Generate the preamble to be placed atop the main file of the build
1300
- * @param config the Stencil configuration file
1301
- * @returns the generated preamble
1302
- */
1303
- const generatePreamble = (config) => {
1304
- const { preamble } = config;
1305
- if (!preamble) return "";
1306
- const preambleComment = preamble.split("\n").map((l) => ` * ${l}`);
1307
- preambleComment.unshift(`/*!`);
1308
- preambleComment.push(` */`);
1309
- return preambleComment.join("\n");
1310
- };
1311
- function getTextDocs(docs) {
1312
- if (docs == null) return "";
1313
- return [escapeWithPattern(docs.text.replace(LINE_BREAK_REGEX, " "), /\*\//, "*\\/", true), ...docs.tags.filter((tag) => tag.name !== "internal").map((tag) => {
1314
- const tagText = escapeWithPattern((tag.text || "").replace(LINE_BREAK_REGEX, " "), /\*\//, "*\\/", true);
1315
- return `@${tag.name} ${tagText}`;
1316
- })].join("\n").trim();
1317
- }
1318
- /**
1319
- * Adds a doc block to a string
1320
- * @param str the string to add a doc block to
1321
- * @param docs the compiled JS docs
1322
- * @param indentation number of spaces to indent the block with
1323
- * @returns the doc block
1324
- */
1325
- function addDocBlock(str, docs, indentation = 0) {
1326
- if (!docs) return str;
1327
- return [formatDocBlock(docs, indentation), str].filter(Boolean).join(`\n`);
1328
- }
1329
- /**
1330
- * Formats the given compiled docs to a JavaScript doc block
1331
- * @param docs the compiled JS docs
1332
- * @param indentation number of spaces to indent the block with
1333
- * @returns the formatted doc block
1334
- */
1335
- function formatDocBlock(docs, indentation = 0) {
1336
- const textDocs = getDocBlockLines(docs);
1337
- if (!textDocs.filter(Boolean).length) return "";
1338
- const spaces = new Array(indentation + 1).join(" ");
1339
- return [
1340
- spaces + "/**",
1341
- ...textDocs.map((line) => spaces + ` * ${line}`),
1342
- spaces + " */"
1343
- ].join(`\n`);
1344
- }
1345
- /**
1346
- * Get all lines which are part of the doc block
1347
- *
1348
- * @param docs the compiled JS docs
1349
- * @returns list of lines part of the doc block
1350
- */
1351
- function getDocBlockLines(docs) {
1352
- return [...docs.text.split(LINE_BREAK_REGEX), ...docs.tags.filter((tag) => !SUPPRESSED_JSDOC_TAGS.includes(tag.name)).map((tag) => `@${tag.name} ${tag.text || ""}`.split(LINE_BREAK_REGEX))].flat().filter(Boolean);
1353
- }
1354
- /**
1355
- * Retrieve a project's dependencies from the current build context
1356
- * @param buildCtx the current build context to query for a specific package
1357
- * @returns a list of package names the project is dependent on
1358
- */
1359
- const getDependencies = (buildCtx) => Object.keys(buildCtx?.packageJson?.dependencies ?? {}).filter((pkgName) => !SKIP_DEPS.includes(pkgName));
1360
- /**
1361
- * Utility to determine whether a project has a dependency on a package
1362
- * @param buildCtx the current build context to query for a specific package
1363
- * @param depName the name of the dependency/package
1364
- * @returns `true` if the project has a dependency a packaged with the provided name, `false` otherwise
1365
- */
1366
- const hasDependency = (buildCtx, depName) => {
1367
- return getDependencies(buildCtx).includes(depName);
1368
- };
1369
- const readPackageJson = async (config, compilerCtx, buildCtx) => {
1370
- try {
1371
- const pkgJson = await compilerCtx.fs.readFile(config.packageJsonFilePath);
1372
- if (pkgJson) {
1373
- const parseResults = parsePackageJson(pkgJson, config.packageJsonFilePath);
1374
- if (parseResults.diagnostic) buildCtx.diagnostics.push(parseResults.diagnostic);
1375
- else buildCtx.packageJson = parseResults.data;
1376
- }
1377
- } catch {
1378
- if (!config.outputTargets.some((o) => o.type.includes("dist"))) {
1379
- const diagnostic = buildError(buildCtx.diagnostics);
1380
- diagnostic.header = `Missing "package.json"`;
1381
- diagnostic.messageText = `Valid "package.json" file is required for distribution: ${config.packageJsonFilePath}`;
1382
- }
1383
- }
1384
- };
1385
- /**
1386
- * Parse a string read from a `package.json` file
1387
- * @param pkgJsonStr the string read from a `package.json` file
1388
- * @param pkgJsonFilePath the path to the already read `package.json` file
1389
- * @returns the results of parsing the provided contents of the `package.json` file
1390
- */
1391
- const parsePackageJson = (pkgJsonStr, pkgJsonFilePath) => {
1392
- const parseResult = {
1393
- diagnostic: null,
1394
- data: null,
1395
- filePath: pkgJsonFilePath
1396
- };
1397
- try {
1398
- parseResult.data = JSON.parse(pkgJsonStr);
1399
- } catch (e) {
1400
- parseResult.diagnostic = buildError();
1401
- parseResult.diagnostic.absFilePath = isString(pkgJsonFilePath) ? pkgJsonFilePath : void 0;
1402
- parseResult.diagnostic.header = `Error Parsing JSON`;
1403
- if (e instanceof Error) parseResult.diagnostic.messageText = e.message;
1404
- }
1405
- return parseResult;
1406
- };
1407
- const SKIP_DEPS = ["@stencil/core"];
1408
- /**
1409
- * Check whether a string is a member of a ReadonlyArray<string>
1410
- *
1411
- * We need a little helper for this because unfortunately `includes` is typed
1412
- * on `ReadonlyArray<T>` as `(el: T): boolean` so a `string` cannot be passed
1413
- * to `includes` on a `ReadonlyArray` 😢 thus we have a little helper function
1414
- * where we do the type coercion just once.
1415
- *
1416
- * see microsoft/TypeScript#31018 for some discussion of this
1417
- *
1418
- * @param readOnlyArray the array we're checking
1419
- * @param maybeMember a value which is possibly a member of the array
1420
- * @returns whether the array contains the member or not
1421
- */
1422
- const readOnlyArrayHasStringMember = (readOnlyArray, maybeMember) => readOnlyArray.includes(maybeMember);
1423
- //#endregion
1424
- //#region src/utils/validation.ts
1425
- /**
1426
- * Validates that a component tag meets required naming conventions to be used for a web component
1427
- * @param tag the tag to validate
1428
- * @returns an error message if the tag has an invalid name, undefined if the tag name passes all checks
1429
- */
1430
- const validateComponentTag = (tag) => {
1431
- if (typeof tag !== "string") return `Tag "${tag}" must be a string type`;
1432
- if (tag !== tag.trim()) return `Tag can not contain white spaces`;
1433
- if (tag !== tag.toLowerCase()) return `Tag can not contain upper case characters`;
1434
- if (tag.length === 0) return `Received empty tag value`;
1435
- if (tag.indexOf(" ") > -1) return `"${tag}" tag cannot contain a space`;
1436
- if (tag.indexOf(",") > -1) return `"${tag}" tag cannot be used for multiple tags`;
1437
- const invalidChars = tag.replace(/\w|-/g, "");
1438
- if (invalidChars !== "") return `"${tag}" tag contains invalid characters: ${invalidChars}`;
1439
- if (tag.indexOf("-") === -1) return `"${tag}" tag must contain a dash (-) to work as a valid web component`;
1440
- if (tag.indexOf("--") > -1) return `"${tag}" tag cannot contain multiple dashes (--) next to each other`;
1441
- if (tag.indexOf("-") === 0) return `"${tag}" tag cannot start with a dash (-)`;
1442
- if (tag.lastIndexOf("-") === tag.length - 1) return `"${tag}" tag cannot end with a dash (-)`;
1443
- };
1444
- //#endregion
1445
- export { join$1 as $, isOutputTargetCustom as A, isOutputTargetDocsCustomElementsManifest as B, result_exports as C, stringifyRuntimeData as Ct, getComponentsFromModules as D, getComponentsDtsTypesFilePath as E, isOutputTargetDistLazy as F, isOutputTargetStats as G, isOutputTargetDocsReadme as H, isOutputTargetDistLazyLoader as I, relativeImport as J, isOutputTargetWww as K, isOutputTargetDistTypes as L, isOutputTargetDistCollection as M, isOutputTargetDistCustomElements as N, isEligiblePrimaryPackageOutputTarget as O, isOutputTargetDistGlobalStyles as P, loadTypeScriptDiagnostics as Q, isOutputTargetDocs as R, ok as S, formatLazyBundleRuntimeMeta as St, getComponentsDtsSrcFilePath as T, isOutputTargetDocsVscode as U, isOutputTargetDocsJson as V, isOutputTargetHydrate as W, augmentDiagnosticWithNode as X, shouldExcludeComponent as Y, loadTypeScriptDiagnostic as Z, getSourceMappingUrlForEndOfFile as _, hasWarning as _t, getTextDocs as a, resolve as at, err as b, isGlob as bt, isJsFile as c, escapeHtml as ct, isTsxFile as d, TASK_CANCELED_MSG as dt, normalize as et, parsePackageJson as f, buildError as ft, getInlineSourceMappingUrlLinker as g, hasError as gt, isRemoteUrl as h, catchError as ht, generatePreamble as i, relative$1 as it, isOutputTargetDist as j, isOutputTargetCopy as k, isJsxFile as l, normalizeDiagnostics as lt, readPackageJson as m, buildWarn as mt, addDocBlock as n, normalizeFsPathQuery as nt, hasDependency as o, createOnWarnFn as ot, readOnlyArrayHasStringMember as p, buildJsonFileError as pt, isValidConfigOutputTarget as q, createJsVarName as r, normalizePath as rt, isDtsFile as s, loadRolldownDiagnostics as st, validateComponentTag as t, normalizeFsPath as tt, isTsFile as u, splitLineBreaks as ut, getSourceMappingUrlLinker as v, shouldIgnoreError as vt, filterExcludedComponents as w, byteSize as wt, map as x, formatComponentRuntimeMeta as xt, rolldownToStencilSourceMap as y, isRootPath as yt, isOutputTargetDocsCustom as z };