@stencil/core 5.0.0-beta.3 → 5.0.0-beta.30

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 (36) hide show
  1. package/dist/app-data/index.d.ts +1 -1
  2. package/dist/{client-BRu0GtRn.mjs → client-BYvfR_Hx.mjs} +127 -68
  3. package/dist/compiler/browser.d.ts +114 -81
  4. package/dist/compiler/browser.js +733 -336
  5. package/dist/compiler/index.d.mts +110 -2
  6. package/dist/compiler/index.mjs +3 -3
  7. package/dist/compiler/utils/index.d.mts +1 -1
  8. package/dist/{compiler-BPgV6bA4.mjs → compiler-6RhuOkQ0.mjs} +4829 -2895
  9. package/dist/declarations/stencil-public-compiler.d.ts +152 -129
  10. package/dist/declarations/stencil-public-docs.d.ts +23 -0
  11. package/dist/declarations/stencil-public-runtime.d.ts +60 -58
  12. package/dist/{index-DmHmu3y0.d.mts → index-BGUOG9Wc.d.mts} +6 -2
  13. package/dist/{index-BXAcVN2j.d.ts → index-BHciXst1.d.ts} +57 -55
  14. package/dist/{index-BopBfjPu.d.mts → index-BogZpjP2.d.mts} +150 -127
  15. package/dist/index.d.mts +3 -0
  16. package/dist/index.mjs +1 -1
  17. package/dist/jsx-runtime.d.mts +6 -0
  18. package/dist/jsx-runtime.mjs +1 -1
  19. package/dist/{node-75gQKkFz.mjs → node-CvPPhnWO.mjs} +41 -47
  20. package/dist/runtime/client/lazy.js +252 -189
  21. package/dist/runtime/client/runtime.d.ts +71 -66
  22. package/dist/runtime/client/runtime.js +252 -189
  23. package/dist/runtime/index.d.ts +4 -5
  24. package/dist/runtime/index.js +250 -187
  25. package/dist/runtime/server/index.d.mts +11 -11
  26. package/dist/runtime/server/index.mjs +302 -228
  27. package/dist/runtime/server/runner.d.mts +4 -4
  28. package/dist/runtime/server/runner.mjs +82 -54
  29. package/dist/signals/index.d.ts +11 -2
  30. package/dist/signals/index.js +14 -35
  31. package/dist/sys/node/index.d.mts +1 -1
  32. package/dist/sys/node/index.mjs +1 -1
  33. package/dist/sys/node/worker.mjs +2 -2
  34. package/dist/testing/index.d.mts +136 -120
  35. package/dist/testing/index.mjs +259 -201
  36. package/package.json +8 -4
@@ -1,11 +1,77 @@
1
1
  import ts from "typescript";
2
2
  import "rolldown";
3
3
  //#region src/declarations/stencil-public-docs.d.ts
4
+ /**
5
+ * A descriptor for a single JSDoc tag found in a block comment
6
+ */
7
+ interface JsonDocsTag {
8
+ /**
9
+ * The tag name (immediately following the '@')
10
+ */
11
+ name: string;
12
+ /**
13
+ * The description that immediately follows the tag name
14
+ */
15
+ text?: string;
16
+ }
4
17
  interface JsonDocMethodParameter {
5
18
  name: string;
6
19
  type: string;
7
20
  docs: string;
8
21
  }
22
+ /**
23
+ * A descriptor for a Custom State defined via @AttachInternals({ states: {...} })
24
+ *
25
+ * Custom states are exposed via the ElementInternals.states CustomStateSet
26
+ * and can be targeted with the CSS `:state()` pseudo-class.
27
+ *
28
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet
29
+ */
30
+ interface JsonDocsCustomState {
31
+ /**
32
+ * The name of the custom state (without dashes)
33
+ */
34
+ name: string;
35
+ /**
36
+ * The initial/default value of the state
37
+ */
38
+ initialValue: boolean;
39
+ /**
40
+ * A textual description of the custom state
41
+ */
42
+ docs: string;
43
+ }
44
+ /**
45
+ * Represents a parsed block comment in a CSS, Sass, etc. file for a custom property.
46
+ */
47
+ interface StyleDoc {
48
+ /**
49
+ * The name of the CSS property
50
+ */
51
+ name: string;
52
+ /**
53
+ * The user-defined description of the CSS property
54
+ */
55
+ docs: string;
56
+ /**
57
+ * The JSDoc-style annotation (e.g. `@prop`) that was used in the block comment to detect the comment.
58
+ * Used to inform Stencil where the start of a new property's description starts (and where the previous description
59
+ * ends).
60
+ */
61
+ annotation: 'prop';
62
+ /**
63
+ * The Stencil style-mode that is associated with this property.
64
+ */
65
+ mode: string | undefined;
66
+ /**
67
+ * The CSS `syntax` descriptor, if this property was registered via a native `@property` at-rule.
68
+ */
69
+ syntax?: string;
70
+ /**
71
+ * The `initial-value` descriptor, if this property was registered via a native `@property` at-rule.
72
+ */
73
+ default?: string;
74
+ }
9
75
  //#endregion
10
76
  //#region src/declarations/stencil-public-runtime.d.ts
11
77
  type ListenTargetOptions = 'body' | 'document' | 'window';
@@ -25,7 +91,7 @@ interface CompilerSystem {
25
91
  name: 'node' | 'in-memory';
26
92
  version: string;
27
93
  events?: BuildEvents;
28
- details?: SystemDetails;
94
+ details: SystemDetails;
29
95
  /**
30
96
  * Add a callback which will be ran when destroy() is called.
31
97
  */
@@ -38,14 +104,15 @@ interface CompilerSystem {
38
104
  * SYNC! Always returns a boolean, does not throw.
39
105
  */
40
106
  accessSync(p: string): boolean;
41
- applyGlobalPatch?(fromDir: string): Promise<void>;
42
107
  applyPrerenderGlobalPatch?(opts: {
43
108
  devServerHostUrl: string;
44
109
  window: any;
45
110
  }): void;
46
- cacheStorage?: CacheStorage;
47
- checkVersion?: (logger: Logger, currentVersion: string) => Promise<() => void>;
48
- copy?(copyTasks: Required<CopyTask>[], srcDir: string): Promise<CopyResults>;
111
+ /**
112
+ * Check npm for a newer Stencil version. Resolves a function that logs the result.
113
+ */
114
+ checkVersion(logger: Logger, currentVersion: string): Promise<() => void>;
115
+ copy(copyTasks: Required<CopyTask>[], srcDir: string): Promise<CopyResults>;
49
116
  /**
50
117
  * Always returns a boolean if the files were copied or not. Does not throw.
51
118
  */
@@ -70,7 +137,7 @@ interface CompilerSystem {
70
137
  /**
71
138
  * Each platform has a different way to dynamically import modules.
72
139
  */
73
- dynamicImport?(p: string): Promise<any>;
140
+ dynamicImport(p: string): Promise<any>;
74
141
  /**
75
142
  * Creates the worker controller for the current system.
76
143
  *
@@ -84,20 +151,14 @@ interface CompilerSystem {
84
151
  * process.exit()
85
152
  */
86
153
  exit(exitCode: number): Promise<void>;
87
- /**
88
- * Optionally provide a fetch() function rather than using the built-in fetch().
89
- * First arg is a url string or Request object (RequestInfo).
90
- * Second arg is the RequestInit. Returns the Response object
91
- */
92
- fetch?(input: string | any, init?: any): Promise<any>;
93
154
  /**
94
155
  * Generates a sha1 digest encoded as HEX
95
156
  */
96
- generateContentHash?(content: string | any, length?: number): Promise<string>;
157
+ generateContentHash(content: string | any, length?: number): Promise<string>;
97
158
  /**
98
159
  * Generates a sha1 digest encoded as HEX from a file path
99
160
  */
100
- generateFileHash?(filePath: string | any, length?: number): Promise<string>;
161
+ generateFileHash(filePath: string | any, length?: number): Promise<string>;
101
162
  /**
102
163
  * Get the current directory.
103
164
  */
@@ -106,7 +167,6 @@ interface CompilerSystem {
106
167
  * The compiler's executing path.
107
168
  */
108
169
  getCompilerExecutingPath(): string;
109
- getEnvironmentVar?(key: string): string;
110
170
  /**
111
171
  * Gets the absolute file path when for a dependency module.
112
172
  */
@@ -145,11 +205,7 @@ interface CompilerSystem {
145
205
  * Normalize file system path.
146
206
  */
147
207
  normalizePath(p: string): string;
148
- onProcessInterrupt?(cb: () => void): void;
149
- parseYarnLockFile?: (content: string) => {
150
- type: 'success' | 'merge' | 'conflict';
151
- object: any;
152
- };
208
+ onProcessInterrupt(cb: () => void): void;
153
209
  platformPath: PlatformPath;
154
210
  /**
155
211
  * All return paths are full normalized paths, not just the basenames. Always returns an array, does not throw.
@@ -185,6 +241,9 @@ interface CompilerSystem {
185
241
  * Rename old path to new path. Does not throw.
186
242
  */
187
243
  rename(oldPath: string, newPath: string): Promise<CompilerSystemRenameResults>;
244
+ /**
245
+ * Assigned by the compiler. Used by plugins (e.g. `@stencil/sass`) to resolve `~` imports.
246
+ */
188
247
  resolveModuleId?(opts: ResolveModuleIdOptions): Promise<ResolveModuleIdResults>;
189
248
  resolvePath(p: string): string;
190
249
  /**
@@ -367,6 +426,7 @@ interface CompilerBuildResults {
367
426
  buildId: number;
368
427
  componentGraph?: BuildResultsComponentGraph;
369
428
  components: ComponentCompilerMeta[];
429
+ cssOnlyComponents: ComponentCompilerMeta[];
370
430
  diagnostics: Diagnostic[];
371
431
  dirsAdded: string[];
372
432
  dirsDeleted: string[];
@@ -383,6 +443,15 @@ interface CompilerBuildResults {
383
443
  namespace: string;
384
444
  fsNamespace: string;
385
445
  outputs: BuildOutput[];
446
+ /**
447
+ * Absolute paths to every global stylesheet, in cascade order: each `global-style` output
448
+ * target's compiled CSS in the order those targets are declared in `config.outputTargets` - or,
449
+ * with none configured, the generated `{fsNamespace}.css` holding Stencil's auto-placed CSS (when
450
+ * emitted). Unlike `outputs`, which groups files by type and sorts them alphabetically, this
451
+ * preserves author-intended order for consumers like the dev-server's auto-generated component
452
+ * preview.
453
+ */
454
+ globalStyleFiles: string[];
386
455
  rootDir: string;
387
456
  srcDir: string;
388
457
  timestamp: string;
@@ -398,6 +467,7 @@ interface HotModuleReplacement {
398
467
  componentsUpdated?: string[];
399
468
  excludeHmr?: string[];
400
469
  externalStylesUpdated?: string[];
470
+ globalStylesUpdated?: HmrGlobalStyleUpdate[];
401
471
  imagesUpdated?: string[];
402
472
  indexHtmlUpdated?: boolean;
403
473
  inlineStylesUpdated?: HmrStyleUpdate[];
@@ -412,6 +482,15 @@ interface HmrStyleUpdate {
412
482
  styleTag: string;
413
483
  styleText: string;
414
484
  }
485
+ /**
486
+ * A live-reload update for a `global-style` output target's CSS. Applied on
487
+ * the client by matching `fileName` against the `<link>` that loads it and
488
+ * inserting/updating an adjacent `<style>` override
489
+ */
490
+ interface HmrGlobalStyleUpdate {
491
+ fileName: string;
492
+ styleText: string;
493
+ }
415
494
  type BuildOnEventRemove = () => boolean;
416
495
  interface BuildEvents extends BuildOnEvents, BuildEmitEvents {
417
496
  unsubscribeAll(): void;
@@ -559,7 +638,9 @@ interface CopyTask {
559
638
  /**
560
639
  * Additional glob patterns to exclude from the copy operation, merged with
561
640
  * the built-in defaults: `__mocks__`, `__fixtures__`, `dist`, hidden dirs,
562
- * `.ds_store`, `.gitignore`, `desktop.ini`, `thumbs.db`.
641
+ * `.ds_store`, `.gitignore`, `desktop.ini`, `thumbs.db`. For a directory
642
+ * `src`, patterns match paths relative to that directory; an explicitly
643
+ * named `src` file is never ignored.
563
644
  */
564
645
  ignore?: string[];
565
646
  /**
@@ -689,10 +770,6 @@ interface Diagnostic {
689
770
  relFilePath?: string | undefined;
690
771
  type: string;
691
772
  }
692
- interface CacheStorage {
693
- get(key: string): Promise<any>;
694
- set(key: string, value: any): Promise<void>;
695
- }
696
773
  interface LazyRequire {
697
774
  ensure(fromDir: string, moduleIds: string[]): Promise<Diagnostic[]>;
698
775
  require(fromDir: string, moduleId: string): any;
@@ -839,13 +916,19 @@ interface TranspileOptions {
839
916
  * that the specified flags take effect for this component at runtime.
840
917
  */
841
918
  buildOverrides?: BuildOverrides;
919
+ /**
920
+ * When `true`, a `.css`/`.scss` transpile also collects CSS custom-property docs
921
+ * onto {@link TranspileResults.styleDocs}. Off by default, since it costs an extra parse
922
+ * of the style text.
923
+ */
924
+ docs?: boolean;
842
925
  }
843
926
  /**
844
927
  * Keys of {@link BuildConditionals} that can be meaningfully overridden at
845
928
  * transpile time — config-driven flags that are not derived from component
846
929
  * scanning or runtime environment detection.
847
930
  */
848
- type BuildOverrideKeys = 'hotModuleReplacement' | 'signalBacking' | 'vdomSignals' | 'lightDomPatches' | 'slotChildNodes' | 'slotCloneNode' | 'slotDomMutations' | 'slotTextContent' | 'lifecycleDOMEvents' | 'initializeNextTick';
931
+ type BuildOverrideKeys = 'isDev' | 'isTesting' | 'hotModuleReplacement' | 'signalBacking' | 'vdomSignals' | 'lightDomPatches' | 'slotChildNodes' | 'slotCloneNode' | 'slotDomMutations' | 'slotTextContent' | 'lifecycleDOMEvents' | 'initializeNextTick';
849
932
  /**
850
933
  * Subset of Stencil's BUILD feature flags that can be overridden at transpile
851
934
  * time. Derived from {@link BuildConditionals} via `Pick` so the field list
@@ -864,6 +947,7 @@ interface TranspileResults {
864
947
  inputFilePath: string;
865
948
  map: any;
866
949
  outputFilePath: string;
950
+ styleDocs?: StyleDoc[];
867
951
  }
868
952
  //#endregion
869
953
  //#region src/declarations/stencil-private.d.ts
@@ -1070,7 +1154,7 @@ interface ComponentCompilerMeta extends ComponentCompilerFeatures {
1070
1154
  * Custom states to initialize on the ElementInternals.states CustomStateSet.
1071
1155
  * These are defined via @AttachInternals({ states: {...} }).
1072
1156
  */
1073
- attachInternalsCustomStates: ComponentCompilerCustomState[];
1157
+ attachInternalsCustomStates: JsonDocsCustomState[];
1074
1158
  componentClassName: string;
1075
1159
  /**
1076
1160
  * A list of web component tag names that are either:
@@ -1140,7 +1224,7 @@ interface ComponentCompilerMeta extends ComponentCompilerFeatures {
1140
1224
  sourceFilePath: string;
1141
1225
  sourceMapPath: string;
1142
1226
  states: ComponentCompilerState[];
1143
- styleDocs: CompilerStyleDoc[];
1227
+ styleDocs: StyleDoc[];
1144
1228
  styles: StyleCompiler[];
1145
1229
  globalStyles: ComponentGlobalStyle[];
1146
1230
  tagName: string;
@@ -1324,20 +1408,6 @@ interface ComponentCompilerState {
1324
1408
  * Custom states are exposed via the ElementInternals.states CustomStateSet
1325
1409
  * and can be targeted with the CSS :state() pseudo-class.
1326
1410
  */
1327
- interface ComponentCompilerCustomState {
1328
- /**
1329
- * The name of the custom state (without dashes)
1330
- */
1331
- name: string;
1332
- /**
1333
- * The initial value of the state
1334
- */
1335
- initialValue: boolean;
1336
- /**
1337
- * Optional JSDoc description for the state
1338
- */
1339
- docs: string;
1340
- }
1341
1411
  /**
1342
1412
  * Representation of JSDoc that is pulled off a node in the AST
1343
1413
  */
@@ -1349,44 +1419,7 @@ interface CompilerJsDoc {
1349
1419
  /**
1350
1420
  * Tags included in the JSDoc
1351
1421
  */
1352
- tags: CompilerJsDocTagInfo[];
1353
- }
1354
- /**
1355
- * Representation of a tag that exists in a JSDoc
1356
- */
1357
- interface CompilerJsDocTagInfo {
1358
- /**
1359
- * The name of the tag - e.g. `@deprecated`
1360
- */
1361
- name: string;
1362
- /**
1363
- * Additional text that is associated with the tag - e.g. `@deprecated use v2 of this API`
1364
- */
1365
- text?: string;
1366
- }
1367
- /**
1368
- * The (internal) representation of a CSS block comment in a CSS, Sass, etc. file. This data structure is used during
1369
- * the initial compilation phases of Stencil, as a piece of {@link ComponentCompilerMeta}.
1370
- */
1371
- interface CompilerStyleDoc {
1372
- /**
1373
- * The name of the CSS property
1374
- */
1375
- name: string;
1376
- /**
1377
- * The user-defined description of the CSS property
1378
- */
1379
- docs: string;
1380
- /**
1381
- * The JSDoc-style annotation (e.g. `@prop`) that was used in the block comment to detect the comment.
1382
- * Used to inform Stencil where the start of a new property's description starts (and where the previous description
1383
- * ends).
1384
- */
1385
- annotation: 'prop';
1386
- /**
1387
- * The Stencil style-mode that is associated with this property.
1388
- */
1389
- mode: string;
1422
+ tags: JsonDocsTag[];
1390
1423
  }
1391
1424
  interface CompilerAssetDir {
1392
1425
  absolutePath?: string;
@@ -1526,7 +1559,7 @@ declare const transpileSync: (code: string, opts?: TranspileOptions) => Transpil
1526
1559
  * @param cmp the metadata for the component that a type definition string is generated for
1527
1560
  * @param typeImportData locally/imported/globally used type names, which may be used to prevent naming collisions
1528
1561
  * @param areTypesInternal `true` if types being generated are for a project's internal purposes, `false` otherwise
1529
- * @param signalBacking `true` if the component is using signal backing for its props; includes the signals map on the element interface
1562
+ * @param signalBacking `true` if the component is using signal backing for its props; includes the signals map on the element interface and unions JSX prop types with `ReadonlySignal<T>`
1530
1563
  * @returns the generated types string alongside additional metadata
1531
1564
  */
1532
1565
  declare const generateComponentTypes: (cmp: ComponentCompilerMeta, typeImportData: TypesImportData, areTypesInternal: boolean, signalBacking?: boolean) => TypesModule;