@fluidframework/synthesize 2.117.0 → 3.0.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.
package/CHANGELOG.md CHANGED
@@ -1,8 +1,42 @@
1
1
  # @fluidframework/synthesize
2
2
 
3
- ## 2.117.0
3
+ ## 3.0.0
4
4
 
5
- Dependency updates only.
5
+ ### Minor Changes
6
+
7
+ - Removal of direct CommonJS support ([#28124](https://github.com/microsoft/FluidFramework/pull/28124)) [0f84e3b8878](https://github.com/microsoft/FluidFramework/commit/0f84e3b8878a5e75b2253976d98fd963bbd9db88)
8
+
9
+ Direct `require()` import is no longer directly supported.
10
+ Package is transpiled as ECMAScript Module.
11
+
12
+ See [Removal of direct CommonJS support in v3.0](https://github.com/microsoft/FluidFramework/issues/27444) for more information.
13
+
14
+ - Require modern TypeScript module resolution ([#27970](https://github.com/microsoft/FluidFramework/pull/27970)) [325e2016ca9](https://github.com/microsoft/FluidFramework/commit/325e2016ca9978d4a1f7552c97ba34feac9df41f)
15
+
16
+ Fluid Framework Client packages no longer include type declaration compatibility entrypoints for TypeScript's legacy Node10 resolution mode (`"moduleResolution": "node"` or `"node10"`).
17
+ Applications upgrading to Fluid Framework 3.0 must use one of the following supported configurations:
18
+ - `"module": "Node16"` with `"moduleResolution": "Node16"`
19
+ - `"module": "NodeNext"` with `"moduleResolution": "NodeNext"`
20
+ - `"module": "ESNext"` with `"moduleResolution": "Bundler"`
21
+
22
+ Existing public package entrypoints exposed through `package.json` exports, including `/alpha`, `/beta`, and `/legacy`, remain available under supported module resolution modes.
23
+
24
+ See [Removal of Node10 resolutions in v3.0](https://github.com/microsoft/FluidFramework/issues/27457) for more information.
25
+
26
+ - Client packages now target ES2022 ([#27846](https://github.com/microsoft/FluidFramework/pull/27846)) [91c78541bdd](https://github.com/microsoft/FluidFramework/commit/91c78541bddcbca5d6c5f357b023eeaee617d885)
27
+
28
+ The TypeScript compilation `target` and `lib` for the Fluid Framework client packages have been raised from ES2021/ES2020 to **ES2022**.
29
+ The published JavaScript now uses ES2022 language features (with correspondingly less down-leveling), so consuming these packages requires a runtime that supports ES2022.
30
+ All actively supported Node.js versions and evergreen browsers already meet this requirement.
31
+
32
+ Note that Fluid Framework has not officially supported targets older than ES2022 since before 2.0: this is documented in [ClientRequirements.md](https://github.com/microsoft/FluidFramework/blob/main/ClientRequirements.md) as well as the README for every client package.
33
+
34
+ It is possible this change could impact users of less up to date JavaScript runtimes.
35
+ Impacted users can use a tool like [babel](https://babeljs.io/) to transpile out unsupported language features.
36
+
37
+ - Build with TypeScript 6 ([#28052](https://github.com/microsoft/FluidFramework/pull/28052)) [7ab015c49de](https://github.com/microsoft/FluidFramework/commit/7ab015c49deec84833cdfe1fb5e1606b901f6e81)
38
+
39
+ FluidFramework Client SDK is now built using TypeScript 6. Consumers should build with TypeScript v6 or v7 or compatible tooling.
6
40
 
7
41
  ## 2.116.0
8
42
 
package/README.md CHANGED
@@ -10,15 +10,15 @@ An Ioc type library for synthesizing a FluidObject based on FluidObject provider
10
10
 
11
11
  ## Using Fluid Framework libraries
12
12
 
13
- When taking a dependency on a Fluid Framework library's public APIs, we recommend using a `^` (caret) version range, such as `^1.3.4`.
14
- While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
15
- library consumers should always prefer `^`.
13
+ For a dependency on a Fluid Framework library's public APIs, we recommend a `^` (caret) version range.
14
+ For example, use `^1.3.4`.
16
15
 
17
- If using any of Fluid Framework's unstable APIs (for example, its `beta` APIs), we recommend using a more constrained version range, such as `~`.
16
+ For a dependency on an unstable API, such as a `beta` API, we recommend a more restrictive version range.
17
+ For example, use a `~` version range.
18
18
 
19
19
  ## Installation
20
20
 
21
- To get started, install the package by running the following command:
21
+ Run this command to install the package:
22
22
 
23
23
  ```bash
24
24
  npm i @fluidframework/synthesize
@@ -26,16 +26,16 @@ npm i @fluidframework/synthesize
26
26
 
27
27
  ## Importing from this package
28
28
 
29
- This package leverages [package.json exports](https://nodejs.org/api/packages.html#exports) to separate its APIs by support level.
30
- For more information on the related support guarantees, see [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels).
29
+ This package uses [package.json exports](https://nodejs.org/api/packages.html#exports) to separate APIs by support level.
30
+ For information about the support guarantees, read [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels).
31
31
 
32
- To access the `public` ([SemVer](https://semver.org/)) APIs, import via `@fluidframework/synthesize` like normal.
32
+ Import the `public` APIs from `@fluidframework/synthesize`.
33
33
 
34
- To access the `legacy` APIs, import via `@fluidframework/synthesize/legacy`.
34
+ Import the `legacy` APIs from `@fluidframework/synthesize/legacy`.
35
35
 
36
36
  ## API Documentation
37
37
 
38
- API documentation for **@fluidframework/synthesize** is available at <https://fluidframework.com/docs/apis/synthesize>.
38
+ Read the **@fluidframework/synthesize** API documentation at <https://fluidframework.com/docs/apis/synthesize>.
39
39
 
40
40
  <!-- prettier-ignore-end -->
41
41
 
@@ -271,62 +271,69 @@ check the current container then look in the parent.
271
271
 
272
272
  ## Minimum Client Requirements
273
273
 
274
- These are the platform requirements for the current version of Fluid Framework Client Packages.
275
- These requirements err on the side of being too strict since within a major version they can be relaxed over time, but not made stricter.
276
- For Long Term Support (LTS) versions this can require supporting these platforms for several years.
274
+ Fluid Framework client libraries support the platforms in this document.
275
+ These requirements are intentionally restrictive.
276
+ Within a major version series, we can relax these requirements, but we cannot make them stricter.
277
+ For a Long Term Support (LTS) version, we might need to support these platforms for several years.
277
278
 
278
- It is likely that other configurations will work, but they are not supported: if they stop working, we do not consider that a bug.
279
- If you would benefit from support for something not listed here, file an issue and the product team will evaluate your request.
280
- When making such a request please include if the configuration already works (and thus the request is just that it becomes officially supported), or if changes are required to get it working.
279
+ Other configurations can work, but Fluid Framework does not support them.
280
+ If an unsupported configuration stops working, we do not classify this as a bug.
281
+ To request support for a configuration that is not listed, file an issue.
282
+ The product team will evaluate your request.
283
+ In the issue, specify the current status of the configuration:
284
+
285
+ - The configuration works but needs official support.
286
+ - The configuration does not work and requires changes.
281
287
 
282
288
  ### Supported Runtimes
283
289
 
284
- - NodeJs ^22.22.2 except that we will drop support for it [when NodeJs 22 loses its upstream support on 2027-04-30](https://github.com/nodejs/release#release-schedule), and will support a newer LTS version of NodeJS at least 1 year before 22 is end-of-life.
285
- - Running Fluid in a Node.js environment with the `--no-experimental-fetch` flag is not supported.
286
- - Modern browsers supporting the es2022 standard library: in response to asks we can add explicit support for using babel to polyfill to target specific standards or runtimes (meaning we can avoid/remove use of things that don't polyfill robustly, but otherwise target modern standards).
290
+ - Fluid Framework supports Node.js versions 22 and 24 while they receive [upstream support](https://nodejs.org/en/about/previous-releases).
291
+ - Fluid Framework will stop support for version 22 [when upstream support ends on 2027-04-30](https://github.com/nodejs/release#release-schedule).
292
+ - Fluid Framework does not support Node.js with the `--no-experimental-fetch` flag.
293
+ - Fluid Framework supports modern browsers that support the ES2022 standard library.
287
294
 
288
295
  ### Supported Tools
289
296
 
290
- - TypeScript 5.4:
291
- - All [`strict`](https://www.typescriptlang.org/tsconfig) options are supported.
292
- - [`strictNullChecks`](https://www.typescriptlang.org/tsconfig) is required.
293
- - [Configuration options deprecated in 5.0](https://github.com/microsoft/TypeScript/issues/51909) are not supported.
294
- - `exactOptionalPropertyTypes` is currently not fully supported.
295
- If used, narrowing members of Fluid Framework types types using `in`, `Reflect.has`, `Object.hasOwn` or `Object.prototype.hasOwnProperty` should be avoided as they may incorrectly exclude `undefined` from the possible values in some cases.
297
+ - [TypeScript 6.0](https://typescriptdocs.com/release-notes/TypeScript%206.0):
298
+ - Fluid Framework supports all [`strict`](https://www.typescriptlang.org/tsconfig) options.
299
+ - Set the build targets (`lib`, `target`) to `ES2022` or later.
300
+ - Enable [`strictNullChecks`](https://www.typescriptlang.org/tsconfig).
301
+ - Fluid Framework does not support [configuration options deprecated in TypeScript 6.0](https://typescriptdocs.com/release-notes/TypeScript%206.0#breaking-changes-and-deprecations-in-typescript-6-0).
302
+ - Fluid Framework does not fully support `exactOptionalPropertyTypes`.
303
+ If you enable this option, do not use `in`, `Reflect.has`, `Object.hasOwn`, or `Object.prototype.hasOwnProperty` to narrow members of Fluid Framework types.
304
+ These methods can incorrectly exclude `undefined` from the possible values.
296
305
  - [webpack](https://webpack.js.org/) 5
297
- - We are not intending to be prescriptive about what bundler to use.
298
- Other bundlers which can handle ES Modules should work, but webpack is the only one we actively test.
306
+ - We do not require a specific bundler.
307
+ Other bundlers that handle ES Modules can work, but we actively test only webpack.
299
308
 
300
309
  ### Module Resolution
301
310
 
302
- [`Node16`, `NodeNext`, or `Bundler`](https://www.typescriptlang.org/tsconfig#moduleResolution) resolution should be used with TypeScript compilerOptions to follow the [Node.js v12+ ESM Resolution and Loading algorithm](https://nodejs.github.io/nodejs.dev/en/api/v20/esm/#resolution-and-loading-algorithm).
303
- Node10 resolution is not supported as it does not support Fluid Framework's API structuring pattern that is used to distinguish stable APIs from those that are in development.
311
+ In TypeScript `compilerOptions`, use [`Node16`, `Node20`, `NodeNext`, or `Bundler`](https://www.typescriptlang.org/tsconfig#moduleResolution) module resolution.
312
+ These settings follow the [Node.js v12+ ESM Resolution and Loading algorithm](https://nodejs.github.io/nodejs.dev/en/api/v20/esm/#resolution-and-loading-algorithm).
313
+
314
+ Do not use `Node10` module resolution.
304
315
 
305
316
  ### Module Formats
306
317
 
307
318
  - ES Modules:
308
- ES Modules are the preferred way to consume our client packages (including in NodeJs) and consuming our client packages from ES Modules is fully supported.
309
- - CommonJs:
310
- Consuming our client packages as CommonJs is supported only in NodeJS and only for the cases listed below.
311
- This is done to accommodate some workflows without good ES Module support.
312
- If you have a workflow you would like included in this list, file an issue.
313
- Once this list of workflows motivating CommonJS support is empty, we may drop support for CommonJS one year after notice of the change is posted here.
314
-
315
- - Testing with Jest (which lacks [stable ESM support](https://jestjs.io/docs/ecmascript-modules) due to [unstable APIs in NodeJs](https://github.com/nodejs/node/issues/37648))
319
+ Use ES Modules to consume Fluid Framework client packages, including in Node.js.
320
+ - CommonJS:
321
+ Fluid Framework does not officially support CommonJS in version 3.0 or later.
316
322
 
317
323
  ## Contribution Guidelines
318
324
 
319
- There are many ways to [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid.
325
+ You can [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid Framework in these ways:
320
326
 
321
- - Participate in Q&A in our [GitHub Discussions](https://github.com/microsoft/FluidFramework/discussions).
322
- - [Submit bugs](https://github.com/microsoft/FluidFramework/issues) and help us verify fixes as they are checked in.
323
- - Review the [source code changes](https://github.com/microsoft/FluidFramework/pulls).
327
+ - Answer questions in [GitHub Discussions](https://github.com/microsoft/FluidFramework/discussions).
328
+ - [Submit bug reports](https://github.com/microsoft/FluidFramework/issues) and help verify fixes.
329
+ - Review [source code changes](https://github.com/microsoft/FluidFramework/pulls).
324
330
  - [Contribute bug fixes](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md).
325
331
 
326
- Detailed instructions for working in the repo can be found in the [Wiki](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Home.md).
332
+ For detailed instructions, read the [repo documentation](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Home.md).
327
333
 
328
- This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
329
- For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
334
+ This project follows the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
335
+ For more information, read the [Code of Conduct frequently asked questions](https://opensource.microsoft.com/codeofconduct/faq/).
336
+ For questions or comments, contact [opencode@microsoft.com](mailto:opencode@microsoft.com).
330
337
 
331
338
  This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
332
339
  Use of these trademarks or logos must follow Microsoft’s [Trademark & Brand Guidelines](https://www.microsoft.com/trademarks).
@@ -334,13 +341,9 @@ Use of Microsoft trademarks or logos in modified versions of this project must n
334
341
 
335
342
  ## Help
336
343
 
337
- Not finding what you're looking for in this README?
338
- Check out [fluidframework.com](https://fluidframework.com/docs/).
339
-
340
- Still not finding what you're looking for?
341
- Please [file an issue](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Contributing/Submitting-Bugs-and-Feature-Requests.md).
344
+ Read the [Fluid Framework documentation](https://fluidframework.com/docs/) for information about Fluid Framework concepts and APIs.
342
345
 
343
- Thank you!
346
+ To request information that the documentation does not contain, [create an issue](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Contributing/Submitting-Bugs-and-Feature-Requests.md).
344
347
 
345
348
  ## Trademark
346
349
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-model.esm.json"
3
+ "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-model.esm.json"
4
4
  }
@@ -14,12 +14,13 @@ const IFluidDependencySynthesizer_js_1 = require("./IFluidDependencySynthesizer.
14
14
  * @beta
15
15
  */
16
16
  class DependencyContainer {
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: use a real type here
18
+ providers = new Map();
19
+ parents;
17
20
  get IFluidDependencySynthesizer() {
18
21
  return this;
19
22
  }
20
23
  constructor(...parents) {
21
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: use a real type here
22
- this.providers = new Map();
23
24
  this.parents = parents.filter((v) => v !== undefined);
24
25
  }
25
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"dependencyContainer.js","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAkE;AAElE,qFAA+E;AAS/E;;;;;GAKG;AACH,MAAa,mBAAmB;IAI/B,IAAW,2BAA2B;QACrC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,YAAmB,GAAG,OAAoD;QAP1E,4FAA4F;QAC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C;QAClB,CAAC;QAED,+EAA+E;QAC/E,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;YACpC,OAAO;gBACN,qEAAqE;gBACrE,GAAG;oBACF,IAAI,QAAQ,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;wBAChD,OAAO,CACN,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,4DAA2B,CAAC,CAAC;4BACjD,iGAAiG;6BAChG,IAAI,CAAC,KAAK,EAAE,GAAG,EAAgB,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;4BACjD,sEAAsE;6BACrE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CACrB,CAAC;oBACH,CAAC;gBACF,CAAC;aACD,CAAC;QACH,CAAC;QACD,OAAO;YACN,GAAG;gBACF,IAAI,QAAQ,EAAE,CAAC;oBACd,OAAO,IAAI,sBAAW,CAAC,KAAK,IAAI,EAAE;wBACjC,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;4BAC3C,IAAI,CAAC,EAAE,CAAC;gCACP,sEAAsE;gCACtE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;4BACb,CAAC;wBACF,CAAC,CAAC,CAAC;oBACJ,CAAC,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;SACD,CAAC;IACH,CAAC;CACD;AAnLD,kDAmLC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { LazyPromise } from \"@fluidframework/core-utils/internal\";\n\nimport { IFluidDependencySynthesizer } from \"./IFluidDependencySynthesizer.js\";\nimport type {\n\tAsyncFluidObjectProvider,\n\tAsyncOptionalFluidObjectProvider,\n\tAsyncRequiredFluidObjectProvider,\n\tFluidObjectProvider,\n\tFluidObjectSymbolProvider,\n} from \"./types.js\";\n\n/**\n * DependencyContainer is similar to a IoC Container. It takes providers and will\n * synthesize an object based on them when requested.\n * @legacy\n * @beta\n */\nexport class DependencyContainer<TMap> implements IFluidDependencySynthesizer {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: use a real type here\n\tprivate readonly providers = new Map<keyof TMap, FluidObjectProvider<any>>();\n\tprivate readonly parents: IFluidDependencySynthesizer[];\n\tpublic get IFluidDependencySynthesizer(): this {\n\t\treturn this;\n\t}\n\n\tpublic constructor(...parents: (IFluidDependencySynthesizer | undefined)[]) {\n\t\tthis.parents = parents.filter((v): v is IFluidDependencySynthesizer => v !== undefined);\n\t}\n\n\t/**\n\t * Add a new provider\n\t * @param type - Name of the Type T being provided\n\t * @param provider - A provider that will resolve the T correctly when asked\n\t * @throws If passing a type that's already registered\n\t */\n\tpublic register<T extends keyof TMap = keyof TMap>(\n\t\ttype: T,\n\t\tprovider: FluidObjectProvider<Pick<TMap, T>>,\n\t): void {\n\t\tif (this.providers.has(type)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Attempting to register a provider of type ${String(type)} that already exists`,\n\t\t\t);\n\t\t}\n\n\t\tthis.providers.set(type, provider);\n\t}\n\n\t/**\n\t * Remove a provider\n\t * @param type - Name of the provider to remove\n\t */\n\tpublic unregister(type: keyof TMap): void {\n\t\tif (this.providers.has(type)) {\n\t\t\tthis.providers.delete(type);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}\n\t */\n\tpublic synthesize<O, R = undefined | Record<string, never>>(\n\t\toptionalTypes: FluidObjectSymbolProvider<O>,\n\t\trequiredTypes: Required<FluidObjectSymbolProvider<R>>,\n\t): AsyncFluidObjectProvider<O, R> {\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\tconst base: AsyncFluidObjectProvider<O, R> = {} as AsyncFluidObjectProvider<O, R>;\n\t\tthis.generateRequired<R>(base, requiredTypes);\n\t\tthis.generateOptional<O>(base, optionalTypes);\n\t\tObject.defineProperty(base, IFluidDependencySynthesizer, { get: () => this });\n\t\treturn base;\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidDependencySynthesizer:interface).has}\n\t * @param excludeParents - If true, exclude checking parent registries\n\t */\n\tpublic has(type: string, excludeParents?: boolean): boolean {\n\t\tif (this.providers.has(type as keyof TMap)) {\n\t\t\treturn true;\n\t\t}\n\t\tif (excludeParents !== true) {\n\t\t\treturn this.parents.some((p: IFluidDependencySynthesizer) => p.has(type));\n\t\t}\n\t\treturn false;\n\t}\n\t/**\n\t * Get a provider for the given type.\n\t * @param provider - The name of the provider to get\n\t * @deprecated Needed for backwards compatability.\n\t */\n\tprivate getProvider(provider: string & keyof TMap): PropertyDescriptor | undefined {\n\t\t// this was removed, but some partners have trouble with back compat where they\n\t\t// use invalid patterns with FluidObject and IFluidDependencySynthesizer\n\t\t// this is just for back compat until those are removed\n\t\tif (this.has(provider)) {\n\t\t\tif (this.providers.has(provider)) {\n\t\t\t\treturn this.providers.get(provider);\n\t\t\t}\n\t\t\tfor (const parent of this.parents) {\n\t\t\t\tif (parent instanceof DependencyContainer) {\n\t\t\t\t\treturn parent.getProvider(provider);\n\t\t\t\t} else {\n\t\t\t\t\t// older implementations of the IFluidDependencySynthesizer exposed getProvider\n\t\t\t\t\tconst maybeGetProvider = parent as { getProvider?(provider: string & keyof TMap) };\n\t\t\t\t\tif (maybeGetProvider?.getProvider !== undefined) {\n\t\t\t\t\t\treturn maybeGetProvider.getProvider(provider);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate generateRequired<T>(\n\t\tbase: AsyncRequiredFluidObjectProvider<T>,\n\t\ttypes: Required<FluidObjectSymbolProvider<T>>,\n\t): void {\n\t\tif (types === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tfor (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n\t\t\tconst provider = this.resolveProvider(key);\n\t\t\tif (provider === undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Object attempted to be created without registered required provider ${String(key)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tObject.defineProperty(base, key, provider);\n\t\t}\n\t}\n\n\tprivate generateOptional<T>(\n\t\tbase: AsyncOptionalFluidObjectProvider<T>,\n\t\ttypes: FluidObjectSymbolProvider<T>,\n\t): void {\n\t\tif (types === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tfor (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n\t\t\t// back-compat: in 0.56 we allow undefined in the types, but we didn't before\n\t\t\t// this will keep runtime back compat, eventually we should support undefined properties\n\t\t\t// rather than properties that return promises that resolve to undefined\n\t\t\tconst provider = this.resolveProvider(key) ?? { get: async () => undefined };\n\t\t\tObject.defineProperty(base, key, provider);\n\t\t}\n\t}\n\n\tprivate resolveProvider<T extends keyof TMap>(t: T): PropertyDescriptor | undefined {\n\t\t// If we have the provider return it\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tconst provider = this.providers.get(t);\n\t\tif (provider === undefined) {\n\t\t\tfor (const parent of this.parents) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\t\tconst sp = { [t]: t } as FluidObjectSymbolProvider<Pick<TMap, T>>;\n\t\t\t\tconst syn = parent.synthesize<Pick<TMap, T>, Record<string, unknown>>(sp, {});\n\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(syn, t);\n\t\t\t\tif (descriptor !== undefined) {\n\t\t\t\t\treturn descriptor;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// The double nested gets are required for lazy loading the provider resolution\n\t\tif (typeof provider === \"function\") {\n\t\t\treturn {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\t\t\t\tget() {\n\t\t\t\t\tif (provider && typeof provider === \"function\") {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\tPromise.resolve(this[IFluidDependencySynthesizer])\n\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-call\n\t\t\t\t\t\t\t\t.then(async (fds): Promise<any> => provider(fds))\n\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\t\t\t\t\t.then((p) => p?.[t])\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tget() {\n\t\t\t\tif (provider) {\n\t\t\t\t\treturn new LazyPromise(async () => {\n\t\t\t\t\t\treturn Promise.resolve(provider).then((p) => {\n\t\t\t\t\t\t\tif (p) {\n\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\t\t\t\t\treturn p[t];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n}\n"]}
1
+ {"version":3,"file":"dependencyContainer.js","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAkE;AAElE,qFAA+E;AAS/E;;;;;GAKG;AACH,MAAa,mBAAmB;IAC/B,4FAA4F;IAC3E,SAAS,GAAG,IAAI,GAAG,EAAwC,CAAC;IAC5D,OAAO,CAAgC;IACxD,IAAW,2BAA2B;QACrC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,YAAmB,GAAG,OAAoD;QACzE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAoC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IACzF,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CACd,IAAO,EACP,QAA4C;QAE5C,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CACd,6CAA6C,MAAM,CAAC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AG,CAAC,CAAC;4BACjD,sEAAsE;6BACrE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CACrB,CAAC;oBACH,CAAC;gBACF,CAAC;aACD,CAAC;QACH,CAAC;QACD,OAAO;YACN,GAAG;gBACF,IAAI,QAAQ,EAAE,CAAC;oBACd,OAAO,IAAI,sBAAW,CAAC,KAAK,IAAI,EAAE;wBACjC,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;4BAC3C,IAAI,CAAC,EAAE,CAAC;gCACP,sEAAsE;gCACtE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;4BACb,CAAC;wBACF,CAAC,CAAC,CAAC;oBACJ,CAAC,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;SACD,CAAC;IACH,CAAC;CACD;AAnLD,kDAmLC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { LazyPromise } from \"@fluidframework/core-utils/internal\";\n\nimport { IFluidDependencySynthesizer } from \"./IFluidDependencySynthesizer.js\";\nimport type {\n\tAsyncFluidObjectProvider,\n\tAsyncOptionalFluidObjectProvider,\n\tAsyncRequiredFluidObjectProvider,\n\tFluidObjectProvider,\n\tFluidObjectSymbolProvider,\n} from \"./types.js\";\n\n/**\n * DependencyContainer is similar to a IoC Container. It takes providers and will\n * synthesize an object based on them when requested.\n * @legacy\n * @beta\n */\nexport class DependencyContainer<TMap> implements IFluidDependencySynthesizer {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: use a real type here\n\tprivate readonly providers = new Map<keyof TMap, FluidObjectProvider<any>>();\n\tprivate readonly parents: IFluidDependencySynthesizer[];\n\tpublic get IFluidDependencySynthesizer(): this {\n\t\treturn this;\n\t}\n\n\tpublic constructor(...parents: (IFluidDependencySynthesizer | undefined)[]) {\n\t\tthis.parents = parents.filter((v): v is IFluidDependencySynthesizer => v !== undefined);\n\t}\n\n\t/**\n\t * Add a new provider\n\t * @param type - Name of the Type T being provided\n\t * @param provider - A provider that will resolve the T correctly when asked\n\t * @throws If passing a type that's already registered\n\t */\n\tpublic register<T extends keyof TMap = keyof TMap>(\n\t\ttype: T,\n\t\tprovider: FluidObjectProvider<Pick<TMap, T>>,\n\t): void {\n\t\tif (this.providers.has(type)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Attempting to register a provider of type ${String(type)} that already exists`,\n\t\t\t);\n\t\t}\n\n\t\tthis.providers.set(type, provider);\n\t}\n\n\t/**\n\t * Remove a provider\n\t * @param type - Name of the provider to remove\n\t */\n\tpublic unregister(type: keyof TMap): void {\n\t\tif (this.providers.has(type)) {\n\t\t\tthis.providers.delete(type);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}\n\t */\n\tpublic synthesize<O, R = undefined | Record<string, never>>(\n\t\toptionalTypes: FluidObjectSymbolProvider<O>,\n\t\trequiredTypes: Required<FluidObjectSymbolProvider<R>>,\n\t): AsyncFluidObjectProvider<O, R> {\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\tconst base: AsyncFluidObjectProvider<O, R> = {} as AsyncFluidObjectProvider<O, R>;\n\t\tthis.generateRequired<R>(base, requiredTypes);\n\t\tthis.generateOptional<O>(base, optionalTypes);\n\t\tObject.defineProperty(base, IFluidDependencySynthesizer, { get: () => this });\n\t\treturn base;\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidDependencySynthesizer:interface).has}\n\t * @param excludeParents - If true, exclude checking parent registries\n\t */\n\tpublic has(type: string, excludeParents?: boolean): boolean {\n\t\tif (this.providers.has(type as keyof TMap)) {\n\t\t\treturn true;\n\t\t}\n\t\tif (excludeParents !== true) {\n\t\t\treturn this.parents.some((p: IFluidDependencySynthesizer) => p.has(type));\n\t\t}\n\t\treturn false;\n\t}\n\t/**\n\t * Get a provider for the given type.\n\t * @param provider - The name of the provider to get\n\t * @deprecated Needed for backwards compatability.\n\t */\n\tprivate getProvider(provider: string & keyof TMap): PropertyDescriptor | undefined {\n\t\t// this was removed, but some partners have trouble with back compat where they\n\t\t// use invalid patterns with FluidObject and IFluidDependencySynthesizer\n\t\t// this is just for back compat until those are removed\n\t\tif (this.has(provider)) {\n\t\t\tif (this.providers.has(provider)) {\n\t\t\t\treturn this.providers.get(provider);\n\t\t\t}\n\t\t\tfor (const parent of this.parents) {\n\t\t\t\tif (parent instanceof DependencyContainer) {\n\t\t\t\t\treturn parent.getProvider(provider);\n\t\t\t\t} else {\n\t\t\t\t\t// older implementations of the IFluidDependencySynthesizer exposed getProvider\n\t\t\t\t\tconst maybeGetProvider = parent as { getProvider?(provider: string & keyof TMap) };\n\t\t\t\t\tif (maybeGetProvider?.getProvider !== undefined) {\n\t\t\t\t\t\treturn maybeGetProvider.getProvider(provider);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate generateRequired<T>(\n\t\tbase: AsyncRequiredFluidObjectProvider<T>,\n\t\ttypes: Required<FluidObjectSymbolProvider<T>>,\n\t): void {\n\t\tif (types === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tfor (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n\t\t\tconst provider = this.resolveProvider(key);\n\t\t\tif (provider === undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Object attempted to be created without registered required provider ${String(key)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tObject.defineProperty(base, key, provider);\n\t\t}\n\t}\n\n\tprivate generateOptional<T>(\n\t\tbase: AsyncOptionalFluidObjectProvider<T>,\n\t\ttypes: FluidObjectSymbolProvider<T>,\n\t): void {\n\t\tif (types === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tfor (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n\t\t\t// back-compat: in 0.56 we allow undefined in the types, but we didn't before\n\t\t\t// this will keep runtime back compat, eventually we should support undefined properties\n\t\t\t// rather than properties that return promises that resolve to undefined\n\t\t\tconst provider = this.resolveProvider(key) ?? { get: async () => undefined };\n\t\t\tObject.defineProperty(base, key, provider);\n\t\t}\n\t}\n\n\tprivate resolveProvider<T extends keyof TMap>(t: T): PropertyDescriptor | undefined {\n\t\t// If we have the provider return it\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tconst provider = this.providers.get(t);\n\t\tif (provider === undefined) {\n\t\t\tfor (const parent of this.parents) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\t\tconst sp = { [t]: t } as FluidObjectSymbolProvider<Pick<TMap, T>>;\n\t\t\t\tconst syn = parent.synthesize<Pick<TMap, T>, Record<string, unknown>>(sp, {});\n\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(syn, t);\n\t\t\t\tif (descriptor !== undefined) {\n\t\t\t\t\treturn descriptor;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// The double nested gets are required for lazy loading the provider resolution\n\t\tif (typeof provider === \"function\") {\n\t\t\treturn {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\t\t\t\tget() {\n\t\t\t\t\tif (provider && typeof provider === \"function\") {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\tPromise.resolve(this[IFluidDependencySynthesizer])\n\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-call\n\t\t\t\t\t\t\t\t.then(async (fds): Promise<any> => provider(fds))\n\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\t\t\t\t\t.then((p) => p?.[t])\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tget() {\n\t\t\t\tif (provider) {\n\t\t\t\t\treturn new LazyPromise(async () => {\n\t\t\t\t\t\treturn Promise.resolve(provider).then((p) => {\n\t\t\t\t\t\t\tif (p) {\n\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\t\t\t\t\treturn p[t];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n}\n"]}
@@ -11,12 +11,13 @@ import { IFluidDependencySynthesizer } from "./IFluidDependencySynthesizer.js";
11
11
  * @beta
12
12
  */
13
13
  export class DependencyContainer {
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: use a real type here
15
+ providers = new Map();
16
+ parents;
14
17
  get IFluidDependencySynthesizer() {
15
18
  return this;
16
19
  }
17
20
  constructor(...parents) {
18
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: use a real type here
19
- this.providers = new Map();
20
21
  this.parents = parents.filter((v) => v !== undefined);
21
22
  }
22
23
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"dependencyContainer.js","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAS/E;;;;;GAKG;AACH,MAAM,OAAO,mBAAmB;IAI/B,IAAW,2BAA2B;QACrC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,YAAmB,GAAG,OAAoD;QAP1E,4FAA4F;QAC3E,cAAS,GAAG,IAAI,GAAG,EAAwC,CAAC;QAO5E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAoC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IACzF,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CACd,IAAO,EACP,QAA4C;QAE5C,IAAI,IAAI,CAAC,SAAS,CA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;4BACjD,iGAAiG;6BAChG,IAAI,CAAC,KAAK,EAAE,GAAG,EAAgB,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;4BACjD,sEAAsE;6BACrE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CACrB,CAAC;oBACH,CAAC;gBACF,CAAC;aACD,CAAC;QACH,CAAC;QACD,OAAO;YACN,GAAG;gBACF,IAAI,QAAQ,EAAE,CAAC;oBACd,OAAO,IAAI,WAAW,CAAC,KAAK,IAAI,EAAE;wBACjC,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;4BAC3C,IAAI,CAAC,EAAE,CAAC;gCACP,sEAAsE;gCACtE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;4BACb,CAAC;wBACF,CAAC,CAAC,CAAC;oBACJ,CAAC,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;SACD,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { LazyPromise } from \"@fluidframework/core-utils/internal\";\n\nimport { IFluidDependencySynthesizer } from \"./IFluidDependencySynthesizer.js\";\nimport type {\n\tAsyncFluidObjectProvider,\n\tAsyncOptionalFluidObjectProvider,\n\tAsyncRequiredFluidObjectProvider,\n\tFluidObjectProvider,\n\tFluidObjectSymbolProvider,\n} from \"./types.js\";\n\n/**\n * DependencyContainer is similar to a IoC Container. It takes providers and will\n * synthesize an object based on them when requested.\n * @legacy\n * @beta\n */\nexport class DependencyContainer<TMap> implements IFluidDependencySynthesizer {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: use a real type here\n\tprivate readonly providers = new Map<keyof TMap, FluidObjectProvider<any>>();\n\tprivate readonly parents: IFluidDependencySynthesizer[];\n\tpublic get IFluidDependencySynthesizer(): this {\n\t\treturn this;\n\t}\n\n\tpublic constructor(...parents: (IFluidDependencySynthesizer | undefined)[]) {\n\t\tthis.parents = parents.filter((v): v is IFluidDependencySynthesizer => v !== undefined);\n\t}\n\n\t/**\n\t * Add a new provider\n\t * @param type - Name of the Type T being provided\n\t * @param provider - A provider that will resolve the T correctly when asked\n\t * @throws If passing a type that's already registered\n\t */\n\tpublic register<T extends keyof TMap = keyof TMap>(\n\t\ttype: T,\n\t\tprovider: FluidObjectProvider<Pick<TMap, T>>,\n\t): void {\n\t\tif (this.providers.has(type)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Attempting to register a provider of type ${String(type)} that already exists`,\n\t\t\t);\n\t\t}\n\n\t\tthis.providers.set(type, provider);\n\t}\n\n\t/**\n\t * Remove a provider\n\t * @param type - Name of the provider to remove\n\t */\n\tpublic unregister(type: keyof TMap): void {\n\t\tif (this.providers.has(type)) {\n\t\t\tthis.providers.delete(type);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}\n\t */\n\tpublic synthesize<O, R = undefined | Record<string, never>>(\n\t\toptionalTypes: FluidObjectSymbolProvider<O>,\n\t\trequiredTypes: Required<FluidObjectSymbolProvider<R>>,\n\t): AsyncFluidObjectProvider<O, R> {\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\tconst base: AsyncFluidObjectProvider<O, R> = {} as AsyncFluidObjectProvider<O, R>;\n\t\tthis.generateRequired<R>(base, requiredTypes);\n\t\tthis.generateOptional<O>(base, optionalTypes);\n\t\tObject.defineProperty(base, IFluidDependencySynthesizer, { get: () => this });\n\t\treturn base;\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidDependencySynthesizer:interface).has}\n\t * @param excludeParents - If true, exclude checking parent registries\n\t */\n\tpublic has(type: string, excludeParents?: boolean): boolean {\n\t\tif (this.providers.has(type as keyof TMap)) {\n\t\t\treturn true;\n\t\t}\n\t\tif (excludeParents !== true) {\n\t\t\treturn this.parents.some((p: IFluidDependencySynthesizer) => p.has(type));\n\t\t}\n\t\treturn false;\n\t}\n\t/**\n\t * Get a provider for the given type.\n\t * @param provider - The name of the provider to get\n\t * @deprecated Needed for backwards compatability.\n\t */\n\tprivate getProvider(provider: string & keyof TMap): PropertyDescriptor | undefined {\n\t\t// this was removed, but some partners have trouble with back compat where they\n\t\t// use invalid patterns with FluidObject and IFluidDependencySynthesizer\n\t\t// this is just for back compat until those are removed\n\t\tif (this.has(provider)) {\n\t\t\tif (this.providers.has(provider)) {\n\t\t\t\treturn this.providers.get(provider);\n\t\t\t}\n\t\t\tfor (const parent of this.parents) {\n\t\t\t\tif (parent instanceof DependencyContainer) {\n\t\t\t\t\treturn parent.getProvider(provider);\n\t\t\t\t} else {\n\t\t\t\t\t// older implementations of the IFluidDependencySynthesizer exposed getProvider\n\t\t\t\t\tconst maybeGetProvider = parent as { getProvider?(provider: string & keyof TMap) };\n\t\t\t\t\tif (maybeGetProvider?.getProvider !== undefined) {\n\t\t\t\t\t\treturn maybeGetProvider.getProvider(provider);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate generateRequired<T>(\n\t\tbase: AsyncRequiredFluidObjectProvider<T>,\n\t\ttypes: Required<FluidObjectSymbolProvider<T>>,\n\t): void {\n\t\tif (types === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tfor (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n\t\t\tconst provider = this.resolveProvider(key);\n\t\t\tif (provider === undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Object attempted to be created without registered required provider ${String(key)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tObject.defineProperty(base, key, provider);\n\t\t}\n\t}\n\n\tprivate generateOptional<T>(\n\t\tbase: AsyncOptionalFluidObjectProvider<T>,\n\t\ttypes: FluidObjectSymbolProvider<T>,\n\t): void {\n\t\tif (types === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tfor (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n\t\t\t// back-compat: in 0.56 we allow undefined in the types, but we didn't before\n\t\t\t// this will keep runtime back compat, eventually we should support undefined properties\n\t\t\t// rather than properties that return promises that resolve to undefined\n\t\t\tconst provider = this.resolveProvider(key) ?? { get: async () => undefined };\n\t\t\tObject.defineProperty(base, key, provider);\n\t\t}\n\t}\n\n\tprivate resolveProvider<T extends keyof TMap>(t: T): PropertyDescriptor | undefined {\n\t\t// If we have the provider return it\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tconst provider = this.providers.get(t);\n\t\tif (provider === undefined) {\n\t\t\tfor (const parent of this.parents) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\t\tconst sp = { [t]: t } as FluidObjectSymbolProvider<Pick<TMap, T>>;\n\t\t\t\tconst syn = parent.synthesize<Pick<TMap, T>, Record<string, unknown>>(sp, {});\n\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(syn, t);\n\t\t\t\tif (descriptor !== undefined) {\n\t\t\t\t\treturn descriptor;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// The double nested gets are required for lazy loading the provider resolution\n\t\tif (typeof provider === \"function\") {\n\t\t\treturn {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\t\t\t\tget() {\n\t\t\t\t\tif (provider && typeof provider === \"function\") {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\tPromise.resolve(this[IFluidDependencySynthesizer])\n\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-call\n\t\t\t\t\t\t\t\t.then(async (fds): Promise<any> => provider(fds))\n\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\t\t\t\t\t.then((p) => p?.[t])\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tget() {\n\t\t\t\tif (provider) {\n\t\t\t\t\treturn new LazyPromise(async () => {\n\t\t\t\t\t\treturn Promise.resolve(provider).then((p) => {\n\t\t\t\t\t\t\tif (p) {\n\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\t\t\t\t\treturn p[t];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n}\n"]}
1
+ {"version":3,"file":"dependencyContainer.js","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAS/E;;;;;GAKG;AACH,MAAM,OAAO,mBAAmB;IAC/B,4FAA4F;IAC3E,SAAS,GAAG,IAAI,GAAG,EAAwC,CAAC;IAC5D,OAAO,CAAgC;IACxD,IAAW,2BAA2B;QACrC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,YAAmB,GAAG,OAAoD;QACzE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAoC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IACzF,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CACd,IAAO,EACP,QAA4C;QAE5C,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CACd,6CAA6C,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAC/E,CAAC;QACH,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACpC,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,IAAgB;QACjC,IAAI,IAAI,CAAC,S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AG;gBACF,IAAI,QAAQ,EAAE,CAAC;oBACd,OAAO,IAAI,WAAW,CAAC,KAAK,IAAI,EAAE;wBACjC,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;4BAC3C,IAAI,CAAC,EAAE,CAAC;gCACP,sEAAsE;gCACtE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;4BACb,CAAC;wBACF,CAAC,CAAC,CAAC;oBACJ,CAAC,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;SACD,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { LazyPromise } from \"@fluidframework/core-utils/internal\";\n\nimport { IFluidDependencySynthesizer } from \"./IFluidDependencySynthesizer.js\";\nimport type {\n\tAsyncFluidObjectProvider,\n\tAsyncOptionalFluidObjectProvider,\n\tAsyncRequiredFluidObjectProvider,\n\tFluidObjectProvider,\n\tFluidObjectSymbolProvider,\n} from \"./types.js\";\n\n/**\n * DependencyContainer is similar to a IoC Container. It takes providers and will\n * synthesize an object based on them when requested.\n * @legacy\n * @beta\n */\nexport class DependencyContainer<TMap> implements IFluidDependencySynthesizer {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: use a real type here\n\tprivate readonly providers = new Map<keyof TMap, FluidObjectProvider<any>>();\n\tprivate readonly parents: IFluidDependencySynthesizer[];\n\tpublic get IFluidDependencySynthesizer(): this {\n\t\treturn this;\n\t}\n\n\tpublic constructor(...parents: (IFluidDependencySynthesizer | undefined)[]) {\n\t\tthis.parents = parents.filter((v): v is IFluidDependencySynthesizer => v !== undefined);\n\t}\n\n\t/**\n\t * Add a new provider\n\t * @param type - Name of the Type T being provided\n\t * @param provider - A provider that will resolve the T correctly when asked\n\t * @throws If passing a type that's already registered\n\t */\n\tpublic register<T extends keyof TMap = keyof TMap>(\n\t\ttype: T,\n\t\tprovider: FluidObjectProvider<Pick<TMap, T>>,\n\t): void {\n\t\tif (this.providers.has(type)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Attempting to register a provider of type ${String(type)} that already exists`,\n\t\t\t);\n\t\t}\n\n\t\tthis.providers.set(type, provider);\n\t}\n\n\t/**\n\t * Remove a provider\n\t * @param type - Name of the provider to remove\n\t */\n\tpublic unregister(type: keyof TMap): void {\n\t\tif (this.providers.has(type)) {\n\t\t\tthis.providers.delete(type);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}\n\t */\n\tpublic synthesize<O, R = undefined | Record<string, never>>(\n\t\toptionalTypes: FluidObjectSymbolProvider<O>,\n\t\trequiredTypes: Required<FluidObjectSymbolProvider<R>>,\n\t): AsyncFluidObjectProvider<O, R> {\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\tconst base: AsyncFluidObjectProvider<O, R> = {} as AsyncFluidObjectProvider<O, R>;\n\t\tthis.generateRequired<R>(base, requiredTypes);\n\t\tthis.generateOptional<O>(base, optionalTypes);\n\t\tObject.defineProperty(base, IFluidDependencySynthesizer, { get: () => this });\n\t\treturn base;\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidDependencySynthesizer:interface).has}\n\t * @param excludeParents - If true, exclude checking parent registries\n\t */\n\tpublic has(type: string, excludeParents?: boolean): boolean {\n\t\tif (this.providers.has(type as keyof TMap)) {\n\t\t\treturn true;\n\t\t}\n\t\tif (excludeParents !== true) {\n\t\t\treturn this.parents.some((p: IFluidDependencySynthesizer) => p.has(type));\n\t\t}\n\t\treturn false;\n\t}\n\t/**\n\t * Get a provider for the given type.\n\t * @param provider - The name of the provider to get\n\t * @deprecated Needed for backwards compatability.\n\t */\n\tprivate getProvider(provider: string & keyof TMap): PropertyDescriptor | undefined {\n\t\t// this was removed, but some partners have trouble with back compat where they\n\t\t// use invalid patterns with FluidObject and IFluidDependencySynthesizer\n\t\t// this is just for back compat until those are removed\n\t\tif (this.has(provider)) {\n\t\t\tif (this.providers.has(provider)) {\n\t\t\t\treturn this.providers.get(provider);\n\t\t\t}\n\t\t\tfor (const parent of this.parents) {\n\t\t\t\tif (parent instanceof DependencyContainer) {\n\t\t\t\t\treturn parent.getProvider(provider);\n\t\t\t\t} else {\n\t\t\t\t\t// older implementations of the IFluidDependencySynthesizer exposed getProvider\n\t\t\t\t\tconst maybeGetProvider = parent as { getProvider?(provider: string & keyof TMap) };\n\t\t\t\t\tif (maybeGetProvider?.getProvider !== undefined) {\n\t\t\t\t\t\treturn maybeGetProvider.getProvider(provider);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate generateRequired<T>(\n\t\tbase: AsyncRequiredFluidObjectProvider<T>,\n\t\ttypes: Required<FluidObjectSymbolProvider<T>>,\n\t): void {\n\t\tif (types === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tfor (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n\t\t\tconst provider = this.resolveProvider(key);\n\t\t\tif (provider === undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Object attempted to be created without registered required provider ${String(key)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tObject.defineProperty(base, key, provider);\n\t\t}\n\t}\n\n\tprivate generateOptional<T>(\n\t\tbase: AsyncOptionalFluidObjectProvider<T>,\n\t\ttypes: FluidObjectSymbolProvider<T>,\n\t): void {\n\t\tif (types === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tfor (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n\t\t\t// back-compat: in 0.56 we allow undefined in the types, but we didn't before\n\t\t\t// this will keep runtime back compat, eventually we should support undefined properties\n\t\t\t// rather than properties that return promises that resolve to undefined\n\t\t\tconst provider = this.resolveProvider(key) ?? { get: async () => undefined };\n\t\t\tObject.defineProperty(base, key, provider);\n\t\t}\n\t}\n\n\tprivate resolveProvider<T extends keyof TMap>(t: T): PropertyDescriptor | undefined {\n\t\t// If we have the provider return it\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tconst provider = this.providers.get(t);\n\t\tif (provider === undefined) {\n\t\t\tfor (const parent of this.parents) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\t\tconst sp = { [t]: t } as FluidObjectSymbolProvider<Pick<TMap, T>>;\n\t\t\t\tconst syn = parent.synthesize<Pick<TMap, T>, Record<string, unknown>>(sp, {});\n\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(syn, t);\n\t\t\t\tif (descriptor !== undefined) {\n\t\t\t\t\treturn descriptor;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// The double nested gets are required for lazy loading the provider resolution\n\t\tif (typeof provider === \"function\") {\n\t\t\treturn {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\t\t\t\tget() {\n\t\t\t\t\tif (provider && typeof provider === \"function\") {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\tPromise.resolve(this[IFluidDependencySynthesizer])\n\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-call\n\t\t\t\t\t\t\t\t.then(async (fds): Promise<any> => provider(fds))\n\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\t\t\t\t\t.then((p) => p?.[t])\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tget() {\n\t\t\t\tif (provider) {\n\t\t\t\t\treturn new LazyPromise(async () => {\n\t\t\t\t\t\treturn Promise.resolve(provider).then((p) => {\n\t\t\t\t\t\t\tif (p) {\n\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\t\t\t\t\treturn p[t];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n}\n"]}
package/lib/legacy.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  /*
7
7
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
- * Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib --node10TypeCompat" in @fluid-tools/build-cli.
8
+ * Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib" in @fluid-tools/build-cli.
9
9
  */
10
10
 
11
11
  export {
package/lib/public.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  /*
7
7
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
- * Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib --node10TypeCompat" in @fluid-tools/build-cli.
8
+ * Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib" in @fluid-tools/build-cli.
9
9
  */
10
10
 
11
11
  export {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/synthesize",
3
- "version": "2.117.0",
3
+ "version": "3.0.0",
4
4
  "description": "A library for synthesizing scope objects.",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -14,38 +14,24 @@
14
14
  "type": "module",
15
15
  "exports": {
16
16
  ".": {
17
- "import": {
18
- "types": "./lib/public.d.ts",
19
- "default": "./lib/index.js"
20
- },
21
- "require": {
22
- "types": "./dist/public.d.ts",
23
- "default": "./dist/index.js"
17
+ "types": "./lib/public.d.ts",
18
+ "default": "./lib/index.js",
19
+ "internal-entrypoint-generation": {
20
+ "types": "./dist/public.d.ts"
24
21
  }
25
22
  },
26
23
  "./legacy": {
27
- "import": {
28
- "types": "./lib/legacy.d.ts",
29
- "default": "./lib/index.js"
30
- },
31
- "require": {
32
- "types": "./dist/legacy.d.ts",
33
- "default": "./dist/index.js"
24
+ "types": "./lib/legacy.d.ts",
25
+ "default": "./lib/index.js",
26
+ "internal-entrypoint-generation": {
27
+ "types": "./dist/legacy.d.ts"
34
28
  }
35
29
  },
36
30
  "./internal": {
37
- "import": {
38
- "types": "./lib/index.d.ts",
39
- "default": "./lib/index.js"
40
- },
41
- "require": {
42
- "types": "./dist/index.d.ts",
43
- "default": "./dist/index.js"
44
- }
31
+ "types": "./lib/index.d.ts",
32
+ "default": "./lib/index.js"
45
33
  }
46
34
  },
47
- "main": "lib/index.js",
48
- "types": "lib/public.d.ts",
49
35
  "c8": {
50
36
  "all": true,
51
37
  "cache-dir": "nyc/.cache",
@@ -69,19 +55,19 @@
69
55
  "temp-directory": "nyc/.nyc_output"
70
56
  },
71
57
  "dependencies": {
72
- "@fluidframework/core-utils": "~2.117.0"
58
+ "@fluidframework/core-utils": "~3.0.0"
73
59
  },
74
60
  "devDependencies": {
75
61
  "@arethetypeswrong/cli": "^0.18.5",
76
62
  "@biomejs/biome": "~2.4.5",
77
- "@fluid-internal/mocha-test-setup": "~2.117.0",
63
+ "@fluid-internal/mocha-test-setup": "~3.0.0",
78
64
  "@fluid-tools/build-cli": "^0.67.0",
79
65
  "@fluidframework/build-common": "^2.0.3",
80
66
  "@fluidframework/build-tools": "^0.67.0",
81
- "@fluidframework/core-interfaces": "~2.117.0",
82
- "@fluidframework/datastore": "~2.117.0",
67
+ "@fluidframework/core-interfaces": "~3.0.0",
68
+ "@fluidframework/datastore": "~3.0.0",
83
69
  "@fluidframework/eslint-config-fluid": "^14.0.0",
84
- "@fluidframework/runtime-utils": "~2.117.0",
70
+ "@fluidframework/runtime-utils": "~3.0.0",
85
71
  "@fluidframework/synthesize-previous": "npm:@fluidframework/synthesize@2.116.0",
86
72
  "@microsoft/api-extractor": "7.58.1",
87
73
  "@types/mocha": "^10.0.10",
@@ -95,7 +81,7 @@
95
81
  "mocha": "^11.7.5",
96
82
  "mocha-multi-reporters": "^1.5.1",
97
83
  "rimraf": "^6.1.3",
98
- "typescript": "~5.4.5"
84
+ "typescript": "~6.0.3"
99
85
  },
100
86
  "typeValidation": {
101
87
  "broken": {},
@@ -104,19 +90,20 @@
104
90
  "scripts": {
105
91
  "build": "fluid-build . --task build",
106
92
  "build:api-reports": "concurrently \"npm:build:api-reports:*\"",
107
- "build:api-reports:current": "api-extractor run --local --config api-extractor/api-extractor.current.json",
108
- "build:api-reports:legacy": "api-extractor run --local --config api-extractor/api-extractor.legacy.json",
93
+ "build:api-reports:current": "api-extractor run --local --config api-extractor/api-extractor-report.current.json",
94
+ "build:api-reports:legacy": "api-extractor run --local --config api-extractor/api-extractor-report.legacy.json",
95
+ "build:cjs": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
109
96
  "build:commonjs": "fluid-build . --task commonjs",
110
97
  "build:compile": "fluid-build . --task compile",
111
- "build:docs": "api-extractor run --local",
98
+ "build:docs": "api-extractor run --local --config api-extractor/api-extractor-model.json",
112
99
  "build:entrypoints": "fluid-build . --task build:entrypoints",
113
100
  "build:entrypoints:cjs": "flub generate entrypoints --resolutionConditions require --outFileLegacyBeta legacy --outDir ./dist",
114
- "build:entrypoints:esm": "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib --node10TypeCompat",
115
- "build:esnext": "tsc --project ./tsconfig.json",
101
+ "build:entrypoints:esm": "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib",
102
+ "build:esm": "tsc --project ./tsconfig.json",
116
103
  "build:test": "concurrently npm:build:test:esm npm:build:test:cjs",
117
104
  "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
118
105
  "build:test:esm": "tsc --project ./src/test/tsconfig.json",
119
- "check:are-the-types-wrong": "attw --pack .",
106
+ "check:are-the-types-wrong": "attw --pack . --profile esm-only",
120
107
  "check:biome": "biome check .",
121
108
  "check:exports": "concurrently \"npm:check:exports:*\"",
122
109
  "check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
@@ -125,10 +112,11 @@
125
112
  "check:exports:esm:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.esm.json",
126
113
  "check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
127
114
  "check:format": "npm run check:biome",
115
+ "check:types:inexactOptionalPropertyTypes": "tsc --project ./tsconfig.json --noEmit --exactOptionalPropertyTypes false --skipLibCheck --emitDeclarationOnly false --tsBuildInfoFile ./tsconfig.inexactOptionalPropertyTypes.tsbuildinfo",
128
116
  "ci:build:api-reports": "concurrently \"npm:ci:build:api-reports:*\"",
129
- "ci:build:api-reports:current": "api-extractor run --config api-extractor/api-extractor.current.json",
130
- "ci:build:api-reports:legacy": "api-extractor run --config api-extractor/api-extractor.legacy.json",
131
- "ci:build:docs": "api-extractor run",
117
+ "ci:build:api-reports:current": "api-extractor run --config api-extractor/api-extractor-report.current.json",
118
+ "ci:build:api-reports:legacy": "api-extractor run --config api-extractor/api-extractor-report.legacy.json",
119
+ "ci:build:docs": "api-extractor run --config api-extractor/api-extractor-model.json",
132
120
  "clean": "rimraf --glob dist lib {alpha,beta,internal,legacy}.d.ts \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
133
121
  "eslint": "eslint --quiet --format stylish src",
134
122
  "eslint:fix": "eslint --quiet --format stylish src --fix --fix-type problem,suggestion,layout",
@@ -142,7 +130,6 @@
142
130
  "test:mocha:cjs": "cross-env FLUID_TEST_MODULE_SYSTEM=CJS mocha",
143
131
  "test:mocha:esm": "mocha",
144
132
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
145
- "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
146
133
  "typetests:gen": "flub generate typetests --dir . -v"
147
134
  }
148
135
  }
package/tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "../../../common/build/build-common/tsconfig.node16.json",
2
+ "extends": "../../../common/build/build-common/tsconfig.node20.json",
3
3
  "include": ["src/**/*"],
4
4
  "exclude": ["src/test/**/*"],
5
5
  "compilerOptions": {
package/internal.d.ts DELETED
@@ -1,11 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
-
6
- /*
7
- * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
- * Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib --node10TypeCompat" in @fluid-tools/build-cli.
9
- */
10
-
11
- export * from "./lib/index.js";
package/legacy.d.ts DELETED
@@ -1,11 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
-
6
- /*
7
- * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
- * Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib --node10TypeCompat" in @fluid-tools/build-cli.
9
- */
10
-
11
- export * from "./lib/legacy.js";