@angular-devkit/build-angular 17.1.0-next.3 → 17.1.0-rc.0

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 (33) hide show
  1. package/builders.json +5 -0
  2. package/package.json +22 -18
  3. package/src/builders/app-shell/index.js +7 -0
  4. package/src/builders/application/execute-build.js +9 -3
  5. package/src/builders/application/options.js +3 -4
  6. package/src/builders/application/schema.d.ts +1 -1
  7. package/src/builders/application/schema.json +1 -1
  8. package/src/builders/dev-server/vite-server.js +2 -1
  9. package/src/builders/jest/index.js +2 -2
  10. package/src/builders/prerender/index.js +7 -0
  11. package/src/builders/web-test-runner/builder-status-warnings.d.ts +11 -0
  12. package/src/builders/web-test-runner/builder-status-warnings.js +46 -0
  13. package/src/builders/web-test-runner/index.d.ts +10 -0
  14. package/src/builders/web-test-runner/index.js +151 -0
  15. package/src/builders/web-test-runner/jasmine_runner.js +88 -0
  16. package/src/builders/web-test-runner/options.d.ts +24 -0
  17. package/src/builders/web-test-runner/options.js +26 -0
  18. package/src/builders/web-test-runner/schema.d.ts +188 -0
  19. package/src/builders/web-test-runner/schema.js +15 -0
  20. package/src/builders/web-test-runner/schema.json +291 -0
  21. package/src/builders/web-test-runner/test_page.html +40 -0
  22. package/src/tools/esbuild/angular/component-stylesheets.js +5 -14
  23. package/src/tools/esbuild/cache.d.ts +88 -0
  24. package/src/tools/esbuild/cache.js +92 -0
  25. package/src/tools/esbuild/javascript-transformer-worker.d.ts +2 -2
  26. package/src/tools/esbuild/javascript-transformer-worker.js +12 -5
  27. package/src/tools/esbuild/javascript-transformer.d.ts +3 -1
  28. package/src/tools/esbuild/javascript-transformer.js +42 -17
  29. package/src/tools/esbuild/stylesheets/sass-language.js +3 -12
  30. package/src/tools/sass/lexer.d.ts +0 -11
  31. package/src/tools/sass/lexer.js +1 -87
  32. package/src/{builders/jest → utils}/test-files.d.ts +1 -2
  33. package/src/{builders/jest → utils}/test-files.js +3 -3
@@ -0,0 +1,188 @@
1
+ /**
2
+ * Web Test Runner target options for Build Facade.
3
+ */
4
+ export interface Schema {
5
+ /**
6
+ * List of static application assets.
7
+ */
8
+ assets?: AssetPattern[];
9
+ /**
10
+ * Override which browsers tests are run against.
11
+ */
12
+ browsers?: string;
13
+ /**
14
+ * Output a code coverage report.
15
+ */
16
+ codeCoverage?: boolean;
17
+ /**
18
+ * Globs to exclude from code coverage.
19
+ */
20
+ codeCoverageExclude?: string[];
21
+ /**
22
+ * Globs of files to exclude, relative to the project root.
23
+ */
24
+ exclude?: string[];
25
+ /**
26
+ * Replace compilation source files with other compilation source files in the build.
27
+ */
28
+ fileReplacements?: FileReplacement[];
29
+ /**
30
+ * Globs of files to include, relative to project root.
31
+ * There are 2 special cases:
32
+ * - when a path to directory is provided, all spec files ending ".spec.@(ts|tsx)" will be
33
+ * included
34
+ * - when a path to a file is provided, and a matching spec file exists it will be included
35
+ * instead.
36
+ */
37
+ include?: string[];
38
+ /**
39
+ * The stylesheet language to use for the application's inline component styles.
40
+ */
41
+ inlineStyleLanguage?: InlineStyleLanguage;
42
+ /**
43
+ * The name of the main entry-point file.
44
+ */
45
+ main?: string;
46
+ /**
47
+ * Enable and define the file watching poll time period in milliseconds.
48
+ */
49
+ poll?: number;
50
+ /**
51
+ * Polyfills to be included in the build.
52
+ */
53
+ polyfills?: Polyfills;
54
+ /**
55
+ * Do not use the real path when resolving modules. If unset then will default to `true` if
56
+ * NodeJS option --preserve-symlinks is set.
57
+ */
58
+ preserveSymlinks?: boolean;
59
+ /**
60
+ * Log progress to the console while building.
61
+ */
62
+ progress?: boolean;
63
+ /**
64
+ * Global scripts to be included in the build.
65
+ */
66
+ scripts?: ScriptElement[];
67
+ /**
68
+ * Output source maps for scripts and styles. For more information, see
69
+ * https://angular.io/guide/workspace-config#source-map-configuration.
70
+ */
71
+ sourceMap?: SourceMapUnion;
72
+ /**
73
+ * Options to pass to style preprocessors
74
+ */
75
+ stylePreprocessorOptions?: StylePreprocessorOptions;
76
+ /**
77
+ * Global styles to be included in the build.
78
+ */
79
+ styles?: StyleElement[];
80
+ /**
81
+ * The name of the TypeScript configuration file.
82
+ */
83
+ tsConfig: string;
84
+ /**
85
+ * Run build when files change.
86
+ */
87
+ watch?: boolean;
88
+ /**
89
+ * TypeScript configuration for Web Worker modules.
90
+ */
91
+ webWorkerTsConfig?: string;
92
+ }
93
+ export type AssetPattern = AssetPatternClass | string;
94
+ export interface AssetPatternClass {
95
+ /**
96
+ * The pattern to match.
97
+ */
98
+ glob: string;
99
+ /**
100
+ * An array of globs to ignore.
101
+ */
102
+ ignore?: string[];
103
+ /**
104
+ * The input directory path in which to apply 'glob'. Defaults to the project root.
105
+ */
106
+ input: string;
107
+ /**
108
+ * Absolute path within the output.
109
+ */
110
+ output: string;
111
+ }
112
+ export interface FileReplacement {
113
+ replace?: string;
114
+ replaceWith?: string;
115
+ src?: string;
116
+ with?: string;
117
+ }
118
+ /**
119
+ * The stylesheet language to use for the application's inline component styles.
120
+ */
121
+ export declare enum InlineStyleLanguage {
122
+ Css = "css",
123
+ Less = "less",
124
+ Sass = "sass",
125
+ Scss = "scss"
126
+ }
127
+ /**
128
+ * Polyfills to be included in the build.
129
+ */
130
+ export type Polyfills = string[] | string;
131
+ export type ScriptElement = ScriptClass | string;
132
+ export interface ScriptClass {
133
+ /**
134
+ * The bundle name for this extra entry point.
135
+ */
136
+ bundleName?: string;
137
+ /**
138
+ * If the bundle will be referenced in the HTML file.
139
+ */
140
+ inject?: boolean;
141
+ /**
142
+ * The file to include.
143
+ */
144
+ input: string;
145
+ }
146
+ /**
147
+ * Output source maps for scripts and styles. For more information, see
148
+ * https://angular.io/guide/workspace-config#source-map-configuration.
149
+ */
150
+ export type SourceMapUnion = boolean | SourceMapClass;
151
+ export interface SourceMapClass {
152
+ /**
153
+ * Output source maps for all scripts.
154
+ */
155
+ scripts?: boolean;
156
+ /**
157
+ * Output source maps for all styles.
158
+ */
159
+ styles?: boolean;
160
+ /**
161
+ * Resolve vendor packages source maps.
162
+ */
163
+ vendor?: boolean;
164
+ }
165
+ /**
166
+ * Options to pass to style preprocessors
167
+ */
168
+ export interface StylePreprocessorOptions {
169
+ /**
170
+ * Paths to include. Paths will be resolved to workspace root.
171
+ */
172
+ includePaths?: string[];
173
+ }
174
+ export type StyleElement = StyleClass | string;
175
+ export interface StyleClass {
176
+ /**
177
+ * The bundle name for this extra entry point.
178
+ */
179
+ bundleName?: string;
180
+ /**
181
+ * If the bundle will be referenced in the HTML file.
182
+ */
183
+ inject?: boolean;
184
+ /**
185
+ * The file to include.
186
+ */
187
+ input: string;
188
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ // THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
3
+ // CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.InlineStyleLanguage = void 0;
6
+ /**
7
+ * The stylesheet language to use for the application's inline component styles.
8
+ */
9
+ var InlineStyleLanguage;
10
+ (function (InlineStyleLanguage) {
11
+ InlineStyleLanguage["Css"] = "css";
12
+ InlineStyleLanguage["Less"] = "less";
13
+ InlineStyleLanguage["Sass"] = "sass";
14
+ InlineStyleLanguage["Scss"] = "scss";
15
+ })(InlineStyleLanguage || (exports.InlineStyleLanguage = InlineStyleLanguage = {}));
@@ -0,0 +1,291 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "title": "Web Test Runner Target",
4
+ "description": "Web Test Runner target options for Build Facade.",
5
+ "type": "object",
6
+ "properties": {
7
+ "main": {
8
+ "type": "string",
9
+ "description": "The name of the main entry-point file."
10
+ },
11
+ "tsConfig": {
12
+ "type": "string",
13
+ "description": "The name of the TypeScript configuration file."
14
+ },
15
+ "polyfills": {
16
+ "description": "Polyfills to be included in the build.",
17
+ "oneOf": [
18
+ {
19
+ "type": "array",
20
+ "description": "A list of polyfills to include in the build. Can be a full path for a file, relative to the current workspace or module specifier. Example: 'zone.js'.",
21
+ "items": {
22
+ "type": "string",
23
+ "uniqueItems": true
24
+ },
25
+ "default": []
26
+ },
27
+ {
28
+ "type": "string",
29
+ "description": "The full path for the polyfills file, relative to the current workspace or a module specifier. Example: 'zone.js'."
30
+ }
31
+ ]
32
+ },
33
+ "assets": {
34
+ "type": "array",
35
+ "description": "List of static application assets.",
36
+ "default": [],
37
+ "items": {
38
+ "$ref": "#/definitions/assetPattern"
39
+ }
40
+ },
41
+ "scripts": {
42
+ "description": "Global scripts to be included in the build.",
43
+ "type": "array",
44
+ "default": [],
45
+ "items": {
46
+ "oneOf": [
47
+ {
48
+ "type": "object",
49
+ "properties": {
50
+ "input": {
51
+ "type": "string",
52
+ "description": "The file to include.",
53
+ "pattern": "\\.[cm]?jsx?$"
54
+ },
55
+ "bundleName": {
56
+ "type": "string",
57
+ "pattern": "^[\\w\\-.]*$",
58
+ "description": "The bundle name for this extra entry point."
59
+ },
60
+ "inject": {
61
+ "type": "boolean",
62
+ "description": "If the bundle will be referenced in the HTML file.",
63
+ "default": true
64
+ }
65
+ },
66
+ "additionalProperties": false,
67
+ "required": ["input"]
68
+ },
69
+ {
70
+ "type": "string",
71
+ "description": "The file to include.",
72
+ "pattern": "\\.[cm]?jsx?$"
73
+ }
74
+ ]
75
+ }
76
+ },
77
+ "styles": {
78
+ "description": "Global styles to be included in the build.",
79
+ "type": "array",
80
+ "default": [],
81
+ "items": {
82
+ "oneOf": [
83
+ {
84
+ "type": "object",
85
+ "properties": {
86
+ "input": {
87
+ "type": "string",
88
+ "description": "The file to include.",
89
+ "pattern": "\\.(?:css|scss|sass|less)$"
90
+ },
91
+ "bundleName": {
92
+ "type": "string",
93
+ "pattern": "^[\\w\\-.]*$",
94
+ "description": "The bundle name for this extra entry point."
95
+ },
96
+ "inject": {
97
+ "type": "boolean",
98
+ "description": "If the bundle will be referenced in the HTML file.",
99
+ "default": true
100
+ }
101
+ },
102
+ "additionalProperties": false,
103
+ "required": ["input"]
104
+ },
105
+ {
106
+ "type": "string",
107
+ "description": "The file to include.",
108
+ "pattern": "\\.(?:css|scss|sass|less)$"
109
+ }
110
+ ]
111
+ }
112
+ },
113
+ "inlineStyleLanguage": {
114
+ "description": "The stylesheet language to use for the application's inline component styles.",
115
+ "type": "string",
116
+ "default": "css",
117
+ "enum": ["css", "less", "sass", "scss"]
118
+ },
119
+ "stylePreprocessorOptions": {
120
+ "description": "Options to pass to style preprocessors",
121
+ "type": "object",
122
+ "properties": {
123
+ "includePaths": {
124
+ "description": "Paths to include. Paths will be resolved to workspace root.",
125
+ "type": "array",
126
+ "items": {
127
+ "type": "string"
128
+ },
129
+ "default": []
130
+ }
131
+ },
132
+ "additionalProperties": false
133
+ },
134
+ "include": {
135
+ "type": "array",
136
+ "items": {
137
+ "type": "string"
138
+ },
139
+ "default": ["**/*.spec.ts"],
140
+ "description": "Globs of files to include, relative to project root. \nThere are 2 special cases:\n - when a path to directory is provided, all spec files ending \".spec.@(ts|tsx)\" will be included\n - when a path to a file is provided, and a matching spec file exists it will be included instead."
141
+ },
142
+ "exclude": {
143
+ "type": "array",
144
+ "items": {
145
+ "type": "string"
146
+ },
147
+ "default": [],
148
+ "description": "Globs of files to exclude, relative to the project root."
149
+ },
150
+ "sourceMap": {
151
+ "description": "Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.",
152
+ "default": true,
153
+ "oneOf": [
154
+ {
155
+ "type": "object",
156
+ "properties": {
157
+ "scripts": {
158
+ "type": "boolean",
159
+ "description": "Output source maps for all scripts.",
160
+ "default": true
161
+ },
162
+ "styles": {
163
+ "type": "boolean",
164
+ "description": "Output source maps for all styles.",
165
+ "default": true
166
+ },
167
+ "vendor": {
168
+ "type": "boolean",
169
+ "description": "Resolve vendor packages source maps.",
170
+ "default": false
171
+ }
172
+ },
173
+ "additionalProperties": false
174
+ },
175
+ {
176
+ "type": "boolean"
177
+ }
178
+ ]
179
+ },
180
+ "progress": {
181
+ "type": "boolean",
182
+ "description": "Log progress to the console while building.",
183
+ "default": true
184
+ },
185
+ "watch": {
186
+ "type": "boolean",
187
+ "description": "Run build when files change."
188
+ },
189
+ "poll": {
190
+ "type": "number",
191
+ "description": "Enable and define the file watching poll time period in milliseconds."
192
+ },
193
+ "preserveSymlinks": {
194
+ "type": "boolean",
195
+ "description": "Do not use the real path when resolving modules. If unset then will default to `true` if NodeJS option --preserve-symlinks is set."
196
+ },
197
+ "browsers": {
198
+ "type": "string",
199
+ "description": "Override which browsers tests are run against."
200
+ },
201
+ "codeCoverage": {
202
+ "type": "boolean",
203
+ "description": "Output a code coverage report.",
204
+ "default": false
205
+ },
206
+ "codeCoverageExclude": {
207
+ "type": "array",
208
+ "description": "Globs to exclude from code coverage.",
209
+ "items": {
210
+ "type": "string"
211
+ },
212
+ "default": []
213
+ },
214
+ "fileReplacements": {
215
+ "description": "Replace compilation source files with other compilation source files in the build.",
216
+ "type": "array",
217
+ "items": {
218
+ "oneOf": [
219
+ {
220
+ "type": "object",
221
+ "properties": {
222
+ "src": {
223
+ "type": "string"
224
+ },
225
+ "replaceWith": {
226
+ "type": "string"
227
+ }
228
+ },
229
+ "additionalProperties": false,
230
+ "required": ["src", "replaceWith"]
231
+ },
232
+ {
233
+ "type": "object",
234
+ "properties": {
235
+ "replace": {
236
+ "type": "string"
237
+ },
238
+ "with": {
239
+ "type": "string"
240
+ }
241
+ },
242
+ "additionalProperties": false,
243
+ "required": ["replace", "with"]
244
+ }
245
+ ]
246
+ },
247
+ "default": []
248
+ },
249
+ "webWorkerTsConfig": {
250
+ "type": "string",
251
+ "description": "TypeScript configuration for Web Worker modules."
252
+ }
253
+ },
254
+ "additionalProperties": false,
255
+ "required": ["tsConfig"],
256
+ "definitions": {
257
+ "assetPattern": {
258
+ "oneOf": [
259
+ {
260
+ "type": "object",
261
+ "properties": {
262
+ "glob": {
263
+ "type": "string",
264
+ "description": "The pattern to match."
265
+ },
266
+ "input": {
267
+ "type": "string",
268
+ "description": "The input directory path in which to apply 'glob'. Defaults to the project root."
269
+ },
270
+ "output": {
271
+ "type": "string",
272
+ "description": "Absolute path within the output."
273
+ },
274
+ "ignore": {
275
+ "description": "An array of globs to ignore.",
276
+ "type": "array",
277
+ "items": {
278
+ "type": "string"
279
+ }
280
+ }
281
+ },
282
+ "additionalProperties": false,
283
+ "required": ["glob", "input", "output"]
284
+ },
285
+ {
286
+ "type": "string"
287
+ }
288
+ ]
289
+ }
290
+ }
291
+ }
@@ -0,0 +1,40 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf8">
5
+ <title>Unit tests</title>
6
+
7
+ <script type="module">
8
+ (async () => {
9
+ // To initialize tests correctly we load things in a very particular order.
10
+
11
+ // Step 1. Load user polyfills (including `zone.js`). Does *not* include `zone.js/testing`, which gets executed after Jasmine.
12
+ await import('./polyfills.js');
13
+
14
+ // Step 2. Import Jasmine.
15
+ // Jasmine gets wrapped into a CommonJS context by the bundling process which makes it think it is running in NodeJS, so it does not
16
+ // find the `window` global. Assign this to the NodeJS `global` symbol so Jasmine initializes correctly.
17
+ window.global = window;
18
+ const { default: jasmineRequire } = await import('./jasmine.js');
19
+ delete window.global; // Avoid leaking `global` into user tests or libraries, which might think they are running in NodeJS.
20
+
21
+ // Step 3. Initialize Jasmine on the page. Doing this after `zone.js` means Zone can patch browser globals before Jasmine runs.
22
+ // Doing this before `zone.js/testing`, means Zone can patch Jasmine-defined globals.
23
+ const jasmine = jasmineRequire.core(jasmineRequire);
24
+ const jasmineGlobal = jasmine.getGlobal();
25
+ jasmineGlobal.jasmine = jasmine;
26
+ const jasmineEnv = jasmine.getEnv();
27
+ Object.assign(window, jasmineRequire.interface(jasmine, jasmineEnv));
28
+
29
+ // Step 4. Import `zone.js/testing`, which will find and patch Jasmine globals from steps 2. and 3.
30
+ // https://github.com/angular/angular/blob/af4f5df150d527a1b523def1eb51d2b661a25f83/packages/zone.js/lib/jasmine/jasmine.ts
31
+ await import('./testing.js');
32
+
33
+ // Step 5. Run the actual tests.
34
+ const { runJasmineTests } = await import('./jasmine_runner.js');
35
+ await runJasmineTests(jasmineEnv);
36
+ })();
37
+ </script>
38
+ </head>
39
+ <body></body>
40
+ </html>
@@ -14,17 +14,8 @@ exports.ComponentStylesheetBundler = void 0;
14
14
  const node_crypto_1 = require("node:crypto");
15
15
  const node_path_1 = __importDefault(require("node:path"));
16
16
  const bundler_context_1 = require("../bundler-context");
17
+ const cache_1 = require("../cache");
17
18
  const bundle_options_1 = require("../stylesheets/bundle-options");
18
- class BundlerContextCache extends Map {
19
- getOrCreate(key, creator) {
20
- let value = this.get(key);
21
- if (value === undefined) {
22
- value = creator();
23
- this.set(key, value);
24
- }
25
- return value;
26
- }
27
- }
28
19
  /**
29
20
  * Bundles component stylesheets. A stylesheet can be either an inline stylesheet that
30
21
  * is contained within the Component's metadata definition or an external file referenced
@@ -33,8 +24,8 @@ class BundlerContextCache extends Map {
33
24
  class ComponentStylesheetBundler {
34
25
  options;
35
26
  incremental;
36
- #fileContexts = new BundlerContextCache();
37
- #inlineContexts = new BundlerContextCache();
27
+ #fileContexts = new cache_1.MemoryCache();
28
+ #inlineContexts = new cache_1.MemoryCache();
38
29
  /**
39
30
  *
40
31
  * @param options An object containing the stylesheet bundling options.
@@ -45,7 +36,7 @@ class ComponentStylesheetBundler {
45
36
  this.incremental = incremental;
46
37
  }
47
38
  async bundleFile(entry) {
48
- const bundlerContext = this.#fileContexts.getOrCreate(entry, () => {
39
+ const bundlerContext = await this.#fileContexts.getOrCreate(entry, () => {
49
40
  return new bundler_context_1.BundlerContext(this.options.workspaceRoot, this.incremental, (loadCache) => {
50
41
  const buildOptions = (0, bundle_options_1.createStylesheetBundleOptions)(this.options, loadCache);
51
42
  buildOptions.entryPoints = [entry];
@@ -60,7 +51,7 @@ class ComponentStylesheetBundler {
60
51
  // TODO: Consider xxhash instead for hashing
61
52
  const id = (0, node_crypto_1.createHash)('sha256').update(data).digest('hex');
62
53
  const entry = [language, id, filename].join(';');
63
- const bundlerContext = this.#inlineContexts.getOrCreate(entry, () => {
54
+ const bundlerContext = await this.#inlineContexts.getOrCreate(entry, () => {
64
55
  const namespace = 'angular:styles/component';
65
56
  return new bundler_context_1.BundlerContext(this.options.workspaceRoot, this.incremental, (loadCache) => {
66
57
  const buildOptions = (0, bundle_options_1.createStylesheetBundleOptions)(this.options, loadCache, {
@@ -0,0 +1,88 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ /**
9
+ * @fileoverview
10
+ * Provides infrastructure for common caching functionality within the build system.
11
+ */
12
+ /**
13
+ * A backing data store for one or more Cache instances.
14
+ * The interface is intentionally designed to support using a JavaScript
15
+ * Map instance as a potential cache store.
16
+ */
17
+ export interface CacheStore<V> {
18
+ /**
19
+ * Returns the specified value from the cache store or `undefined` if not found.
20
+ * @param key The key to retrieve from the store.
21
+ */
22
+ get(key: string): V | undefined | Promise<V | undefined>;
23
+ /**
24
+ * Returns whether the provided key is present in the cache store.
25
+ * @param key The key to check from the store.
26
+ */
27
+ has(key: string): boolean | Promise<boolean>;
28
+ /**
29
+ * Adds a new value to the cache store if the key is not present.
30
+ * Updates the value for the key if already present.
31
+ * @param key The key to associate with the value in the cache store.
32
+ * @param value The value to add to the cache store.
33
+ */
34
+ set(key: string, value: V): this | Promise<this>;
35
+ }
36
+ /**
37
+ * A cache object that allows accessing and storing key/value pairs in
38
+ * an underlying CacheStore. This class is the primary method for consumers
39
+ * to use a cache.
40
+ */
41
+ export declare class Cache<V, S extends CacheStore<V> = CacheStore<V>> {
42
+ protected readonly store: S;
43
+ readonly namespace?: string | undefined;
44
+ constructor(store: S, namespace?: string | undefined);
45
+ /**
46
+ * Prefixes a key with the cache namespace if present.
47
+ * @param key A key string to prefix.
48
+ * @returns A prefixed key if a namespace is present. Otherwise the provided key.
49
+ */
50
+ protected withNamespace(key: string): string;
51
+ /**
52
+ * Gets the value associated with a provided key if available.
53
+ * Otherwise, creates a value using the factory creator function, puts the value
54
+ * in the cache, and returns the new value.
55
+ * @param key A key associated with the value.
56
+ * @param creator A factory function for the value if no value is present.
57
+ * @returns A value associated with the provided key.
58
+ */
59
+ getOrCreate(key: string, creator: () => V | Promise<V>): Promise<V>;
60
+ /**
61
+ * Gets the value associated with a provided key if available.
62
+ * @param key A key associated with the value.
63
+ * @returns A value associated with the provided key if present. Otherwise, `undefined`.
64
+ */
65
+ get(key: string): Promise<V | undefined>;
66
+ /**
67
+ * Puts a value in the cache and associates it with the provided key.
68
+ * If the key is already present, the value is updated instead.
69
+ * @param key A key associated with the value.
70
+ * @param value A value to put in the cache.
71
+ */
72
+ put(key: string, value: V): Promise<void>;
73
+ }
74
+ /**
75
+ * A lightweight in-memory cache implementation based on a JavaScript Map object.
76
+ */
77
+ export declare class MemoryCache<V> extends Cache<V, Map<string, V>> {
78
+ constructor();
79
+ /**
80
+ * Removes all entries from the cache instance.
81
+ */
82
+ clear(): void;
83
+ /**
84
+ * Provides all the values currently present in the cache instance.
85
+ * @returns An iterable of all values in the cache.
86
+ */
87
+ values(): IterableIterator<V>;
88
+ }