@stencil/core 2.17.4 → 2.18.1

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 (88) hide show
  1. package/cli/index.cjs +285 -220
  2. package/cli/index.d.ts +1 -0
  3. package/cli/index.js +285 -220
  4. package/cli/package.json +1 -1
  5. package/compiler/lib.dom.d.ts +620 -89
  6. package/compiler/lib.dom.iterable.d.ts +27 -3
  7. package/compiler/lib.es2015.core.d.ts +3 -3
  8. package/compiler/lib.es2015.iterable.d.ts +2 -1
  9. package/compiler/lib.es2015.reflect.d.ts +1 -1
  10. package/compiler/lib.es2020.bigint.d.ts +7 -5
  11. package/compiler/lib.es2020.d.ts +2 -0
  12. package/compiler/lib.es2020.date.d.ts +44 -0
  13. package/compiler/lib.es2020.intl.d.ts +51 -11
  14. package/compiler/lib.es2020.number.d.ts +30 -0
  15. package/compiler/lib.es2021.intl.d.ts +106 -4
  16. package/compiler/lib.es2022.array.d.ts +123 -0
  17. package/compiler/lib.es2022.d.ts +26 -0
  18. package/compiler/lib.es2022.error.d.ts +75 -0
  19. package/compiler/lib.es2022.full.d.ts +25 -0
  20. package/compiler/lib.es2022.intl.d.ts +111 -0
  21. package/compiler/lib.es2022.object.d.ts +28 -0
  22. package/compiler/lib.es2022.string.d.ts +27 -0
  23. package/compiler/lib.es5.d.ts +25 -19
  24. package/compiler/lib.esnext.d.ts +1 -1
  25. package/compiler/lib.esnext.intl.d.ts +4 -1
  26. package/compiler/lib.webworker.d.ts +236 -40
  27. package/compiler/lib.webworker.iterable.d.ts +10 -3
  28. package/compiler/package.json +1 -1
  29. package/compiler/stencil.d.ts +2 -2
  30. package/compiler/stencil.js +47263 -45624
  31. package/compiler/stencil.min.js +2 -2
  32. package/compiler/sys/in-memory-fs.d.ts +218 -0
  33. package/dependencies.json +10 -1
  34. package/dev-server/client/index.d.ts +2 -2
  35. package/dev-server/client/index.js +241 -241
  36. package/dev-server/client/package.json +1 -1
  37. package/dev-server/connector.html +3 -3
  38. package/dev-server/index.d.ts +1 -1
  39. package/dev-server/index.js +2 -2
  40. package/dev-server/package.json +1 -1
  41. package/dev-server/server-process.js +1198 -1167
  42. package/internal/app-data/package.json +1 -1
  43. package/internal/client/css-shim.js +2 -2
  44. package/internal/client/dom.js +1 -1
  45. package/internal/client/index.js +1022 -824
  46. package/internal/client/package.json +1 -1
  47. package/internal/client/patch-browser.js +1 -1
  48. package/internal/client/patch-esm.js +1 -1
  49. package/internal/client/polyfills/css-shim.js +1 -1
  50. package/internal/client/shadow-css.js +1 -1
  51. package/internal/hydrate/index.js +119 -119
  52. package/internal/hydrate/package.json +1 -1
  53. package/internal/hydrate/runner.d.ts +1 -1
  54. package/internal/hydrate/runner.js +100 -100
  55. package/internal/package.json +1 -1
  56. package/internal/stencil-core/index.d.ts +8 -10
  57. package/internal/stencil-private.d.ts +77 -138
  58. package/internal/stencil-public-compiler.d.ts +44 -10
  59. package/internal/stencil-public-runtime.d.ts +15 -4
  60. package/internal/testing/index.js +148 -148
  61. package/internal/testing/package.json +1 -1
  62. package/mock-doc/index.cjs +534 -518
  63. package/mock-doc/index.d.ts +13 -12
  64. package/mock-doc/index.js +534 -518
  65. package/mock-doc/package.json +1 -1
  66. package/package.json +23 -32
  67. package/readme.md +27 -33
  68. package/screenshot/index.d.ts +1 -1
  69. package/screenshot/index.js +13 -13
  70. package/screenshot/package.json +1 -1
  71. package/screenshot/pixel-match.js +983 -849
  72. package/sys/node/glob.js +1 -1
  73. package/sys/node/index.d.ts +2 -0
  74. package/sys/node/index.js +374 -373
  75. package/sys/node/package.json +1 -1
  76. package/sys/node/worker.js +1 -1
  77. package/testing/index.d.ts +6 -6
  78. package/testing/index.js +427 -441
  79. package/testing/jest/jest-config.d.ts +1 -1
  80. package/testing/matchers/index.d.ts +3 -3
  81. package/testing/mock-fetch.d.ts +1 -1
  82. package/testing/mocks.d.ts +2 -2
  83. package/testing/package.json +1 -1
  84. package/testing/puppeteer/puppeteer-element.d.ts +2 -2
  85. package/testing/puppeteer/puppeteer-events.d.ts +1 -1
  86. package/testing/testing-logger.d.ts +1 -1
  87. package/testing/testing-utils.d.ts +5 -4
  88. package/testing/testing.d.ts +1 -1
@@ -0,0 +1,218 @@
1
+ import type * as d from '../../internal/index';
2
+ /**
3
+ * An in-memory FS which proxies the underlying OS filesystem using a simple
4
+ * in-memory cache. FS writes can accumulate on the in-memory system, using an
5
+ * API similar to Node.js' `"fs"` module, and then be committed to disk as a
6
+ * unit.
7
+ *
8
+ * Files written to the in-memory system can be edited, deleted, and so on.
9
+ * This allows the compiler to proceed freely as if it is modifying the
10
+ * filesystem, modifying the world in whatever way suits it, while deferring
11
+ * actual FS writes until the end of the compilation process, making actual
12
+ * changes to the filesystem on disk contingent on an error-free build or any
13
+ * other condition.
14
+ *
15
+ * Usage example:
16
+ *
17
+ * ```ts
18
+ * // create an in-memory FS
19
+ * const sys = createSystem();
20
+ * const inMemoryFs = createInMemoryFs(sys);
21
+ *
22
+ * // do a few fs operations
23
+ * await inMemoryFs.writeFile("path/to/file.js", 'console.log("hey!");')
24
+ * await inMemoryFs.remove("path/to/another_file.ts");
25
+ *
26
+ * // commit the results to disk
27
+ * const commitStats = await inMemoryFs.commit();
28
+ * ```
29
+ *
30
+ * In the above example the write operation and the delete operation (w/
31
+ * `.remove`) are both queued in the in-memory proxy but not committed to
32
+ * disk until the `.commit` method is called.
33
+ */
34
+ export declare type InMemoryFileSystem = ReturnType<typeof createInMemoryFs>;
35
+ /**
36
+ * A node in the in-memory file system. This may represent a file or
37
+ * a directory, and pending copy, write, and delete operations may be stored
38
+ * on it.
39
+ */
40
+ export interface FsItem {
41
+ fileText: string;
42
+ isFile: boolean;
43
+ isDirectory: boolean;
44
+ size: number;
45
+ mtimeMs: number;
46
+ exists: boolean;
47
+ queueCopyFileToDest: string;
48
+ queueWriteToDisk: boolean;
49
+ queueDeleteFromDisk?: boolean;
50
+ useCache: boolean;
51
+ }
52
+ /**
53
+ * Storage format for the in-memory cache used to proxy the OS filesystem.
54
+ *
55
+ * Filesystem paths (of type `string`) are mapped to objects satisfying the
56
+ * `FsItem` interface.
57
+ */
58
+ export declare type FsItems = Map<string, FsItem>;
59
+ /**
60
+ * Options supported by write methods on the in-memory filesystem.
61
+ */
62
+ export interface FsWriteOptions {
63
+ inMemoryOnly?: boolean;
64
+ clearFileCache?: boolean;
65
+ immediateWrite?: boolean;
66
+ useCache?: boolean;
67
+ /**
68
+ * An optional tag for the current output target for which this file is being
69
+ * written.
70
+ */
71
+ outputTargetType?: string;
72
+ }
73
+ /**
74
+ * Results from a write operation on the in-memory filesystem.
75
+ */
76
+ export interface FsWriteResults {
77
+ changedContent: boolean;
78
+ queuedWrite: boolean;
79
+ ignored: boolean;
80
+ }
81
+ /**
82
+ * Options supported by read methods on the in-memory filesystem.
83
+ */
84
+ export interface FsReadOptions {
85
+ useCache?: boolean;
86
+ setHash?: boolean;
87
+ }
88
+ /**
89
+ * Options supported by the readdir option on the in-memory filesystem.
90
+ */
91
+ interface FsReaddirOptions {
92
+ inMemoryOnly?: boolean;
93
+ recursive?: boolean;
94
+ /**
95
+ * Directory names to exclude. Just the basename,
96
+ * not the entire path. Basically for "node_modules".
97
+ */
98
+ excludeDirNames?: string[];
99
+ /**
100
+ * Extensions we know we can avoid. Each extension
101
+ * should include the `.` so that we can test for both
102
+ * `.d.ts.` and `.ts`. If `excludeExtensions` isn't provided it
103
+ * doesn't try to exclude anything. This only checks against
104
+ * the filename, not directory names when recursive.
105
+ */
106
+ excludeExtensions?: string[];
107
+ }
108
+ /**
109
+ * A result from a directory read operation
110
+ */
111
+ interface FsReaddirItem {
112
+ absPath: string;
113
+ relPath: string;
114
+ isDirectory: boolean;
115
+ isFile: boolean;
116
+ }
117
+ /**
118
+ * Information about a file in the in-memory filesystem.
119
+ */
120
+ interface FsStat {
121
+ exists: boolean;
122
+ isFile: boolean;
123
+ isDirectory: boolean;
124
+ size: number;
125
+ }
126
+ /**
127
+ * Create an in-memory FS which proxies the underlying OS filesystem using an
128
+ * in-memory cache. FS writes can accumulate on the in-memory system, using an
129
+ * API similar to Node.js' `"fs"` module, and then be committed to disk as a
130
+ * unit.
131
+ *
132
+ * Files written to the in-memory system can be edited, deleted, and so on.
133
+ * This allows the compiler to proceed freely as if it is modifying the
134
+ * filesystem, modifying the world in whatever way suits it, while deferring
135
+ * actual FS writes until the end of the compilation process, making actual
136
+ * changes to the filesystem on disk contingent on an error-free build or any
137
+ * other condition.
138
+ *
139
+ * @param sys a compiler system object
140
+ * @returns an in-memory filesystem interface
141
+ */
142
+ export declare const createInMemoryFs: (sys: d.CompilerSystem) => {
143
+ access: (filePath: string) => Promise<boolean>;
144
+ accessSync: (filePath: string) => boolean;
145
+ cancelDeleteDirectoriesFromDisk: (dirPaths: string[]) => void;
146
+ cancelDeleteFilesFromDisk: (filePaths: string[]) => void;
147
+ clearCache: () => void;
148
+ clearDirCache: (dirPath: string) => void;
149
+ clearFileCache: (filePath: string) => void;
150
+ commit: () => Promise<FsCommitResults>;
151
+ copyFile: (src: string, dest: string) => Promise<void>;
152
+ emptyDirs: (dirs: string[]) => Promise<void>;
153
+ getBuildOutputs: () => d.BuildOutput[];
154
+ getItem: (itemPath: string) => FsItem;
155
+ getMemoryStats: () => string;
156
+ readFile: (filePath: string, opts?: FsReadOptions) => Promise<string>;
157
+ readFileSync: (filePath: string, opts?: FsReadOptions) => string;
158
+ readdir: (dirPath: string, opts?: FsReaddirOptions) => Promise<FsReaddirItem[]>;
159
+ remove: (itemPath: string) => Promise<void>;
160
+ stat: (itemPath: string) => Promise<FsStat>;
161
+ statSync: (itemPath: string) => FsStat;
162
+ sys: d.CompilerSystem;
163
+ writeFile: (filePath: string, content: string, opts?: FsWriteOptions) => Promise<FsWriteResults>;
164
+ writeFiles: (files: {
165
+ [filePath: string]: string;
166
+ } | Map<string, string>, opts?: FsWriteOptions) => Promise<FsWriteResults[]>;
167
+ };
168
+ /**
169
+ * The information needed to carry out a file copy operation.
170
+ *
171
+ * `[ source, destination ]`
172
+ */
173
+ declare type FileCopyTuple = [string, string];
174
+ /**
175
+ * Collected instructions for all pending filesystem operations saved
176
+ * to the in-memory filesystem.
177
+ */
178
+ interface FsCommitInstructions {
179
+ filesToDelete: string[];
180
+ filesToWrite: string[];
181
+ /**
182
+ * Files queued for copy operations are stored as an array of `[source, dest]`
183
+ * tuples.
184
+ */
185
+ filesToCopy: FileCopyTuple[];
186
+ dirsToDelete: string[];
187
+ dirsToEnsure: string[];
188
+ }
189
+ /**
190
+ * Results from committing pending filesystem operations
191
+ */
192
+ interface FsCommitResults {
193
+ filesCopied: FileCopyTuple[];
194
+ filesWritten: string[];
195
+ filesDeleted: string[];
196
+ dirsDeleted: string[];
197
+ dirsAdded: string[];
198
+ }
199
+ /**
200
+ * Given the current state of the in-memory proxy filesystem, collect all of
201
+ * the changes that need to be made in order to commit the currently-pending
202
+ * operations (e.g. write, copy, delete) to the OS filesystem.
203
+ *
204
+ * @param items the storage data structure for the in-memory FS cache
205
+ * @returns a collection of all the operations that need to be done
206
+ */
207
+ export declare const getCommitInstructions: (items: FsItems) => FsCommitInstructions;
208
+ /**
209
+ * Check whether a given filepath should be ignored
210
+ *
211
+ * We have a little ignore list, and we just check whether the
212
+ * filepath ends with any of the strings on the ignore list.
213
+ *
214
+ * @param filePath the filepath to check!
215
+ * @returns whether we should ignore it or not
216
+ */
217
+ export declare const shouldIgnore: (filePath: string) => boolean;
218
+ export {};
package/dependencies.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "dependencies": [
3
3
  {
4
4
  "name": "@stencil/core",
5
- "version": "2.17.4",
5
+ "version": "2.18.1",
6
6
  "main": "compiler/stencil.js",
7
7
  "resources": [
8
8
  "package.json",
@@ -44,8 +44,10 @@
44
44
  "compiler/lib.es2019.symbol.d.ts",
45
45
  "compiler/lib.es2020.bigint.d.ts",
46
46
  "compiler/lib.es2020.d.ts",
47
+ "compiler/lib.es2020.date.d.ts",
47
48
  "compiler/lib.es2020.full.d.ts",
48
49
  "compiler/lib.es2020.intl.d.ts",
50
+ "compiler/lib.es2020.number.d.ts",
49
51
  "compiler/lib.es2020.promise.d.ts",
50
52
  "compiler/lib.es2020.sharedmemory.d.ts",
51
53
  "compiler/lib.es2020.string.d.ts",
@@ -56,6 +58,13 @@
56
58
  "compiler/lib.es2021.promise.d.ts",
57
59
  "compiler/lib.es2021.string.d.ts",
58
60
  "compiler/lib.es2021.weakref.d.ts",
61
+ "compiler/lib.es2022.array.d.ts",
62
+ "compiler/lib.es2022.d.ts",
63
+ "compiler/lib.es2022.error.d.ts",
64
+ "compiler/lib.es2022.full.d.ts",
65
+ "compiler/lib.es2022.intl.d.ts",
66
+ "compiler/lib.es2022.object.d.ts",
67
+ "compiler/lib.es2022.string.d.ts",
59
68
  "compiler/lib.es5.d.ts",
60
69
  "compiler/lib.es6.d.ts",
61
70
  "compiler/lib.esnext.d.ts",
@@ -1,6 +1,6 @@
1
1
  export { appError, clearAppErrorModal } from './app-error';
2
2
  export { emitBuildLog, emitBuildResults, emitBuildStatus, onBuildLog, onBuildResults, onBuildStatus } from './events';
3
+ export { hmrWindow } from './hmr-window';
4
+ export { logBuild, logDiagnostic, logDisabled, logReload, logWarn } from './logger';
3
5
  export { initBuildProgress } from './progress';
4
6
  export { initBuildStatus } from './status';
5
- export { logBuild, logDiagnostic, logDisabled, logReload, logWarn } from './logger';
6
- export { hmrWindow } from './hmr-window';