Skip to content

Commit

Permalink
RC5.0: Make using API trimming optional (#21679)
Browse files Browse the repository at this point in the history
Makes API trimming optional in RC5

Cherry pick of
23c2373

---------

Co-authored-by: Sonali Deshpande <[email protected]>
Co-authored-by: Jason Hartman <[email protected]>
  • Loading branch information
3 people authored Jul 1, 2024
1 parent 22065ea commit f063edb
Show file tree
Hide file tree
Showing 117 changed files with 929 additions and 166 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts"
}
14 changes: 11 additions & 3 deletions azure/packages/azure-service-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@
"type": "module",
"exports": {
".": {
"trimmedAPI": {
"types": {
"import": "./lib/public.d.ts",
"require": "./dist/public.d.ts"
}
},
"import": {
"types": "./lib/public.d.ts",
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"require": {
"types": "./dist/public.d.ts",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
Expand All @@ -45,7 +51,7 @@
}
},
"main": "lib/index.js",
"types": "lib/public.d.ts",
"types": "lib/index.d.ts",
"scripts": {
"api": "fluid-build . --task api",
"api-extractor:commonjs": "flub generate entrypoints --outFileAlpha legacy --outDir ./dist",
Expand All @@ -62,6 +68,7 @@
"check:biome": "biome check . --formatter-enabled=true",
"check:exports": "concurrently \"npm:check:exports:*\"",
"check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
"check:exports:cjs:index": "api-extractor run --config api-extractor/api-extractor-lint-index.cjs.json",
"check:exports:cjs:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.cjs.json",
"check:exports:cjs:public": "api-extractor run --config api-extractor/api-extractor-lint-public.cjs.json",
"check:exports:esm:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.esm.json",
Expand Down Expand Up @@ -106,6 +113,7 @@
"rimraf": "^4.4.0",
"typescript": "~5.4.5"
},
"exportsComments": "The 'trimmedAPI' export condition is set as a workaround for 'flub generate entrypoints', which expects `exports` to contain an entry for all entrypoints. The custom condition effectively hides the public entrypoint unless the 'trimmedAPI' condition is set manually.",
"typeValidation": {
"broken": {}
}
Expand Down
6 changes: 6 additions & 0 deletions common/build/build-common/tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
"strict": true,
"target": "ES2020",
"types": [],
// The 'trimmedAPI' export condition enables use of preferred import types for root (".") package imports.
// This allows FF to validate that only public APIs are used with a default import and gives customers
// the ability to opt into using the trimmed API. Ideally the condition would be reversed such that
// customers would opt out, but we know that some tooling and configurations are not consistent such
// that opting out would be easy and reliable.
"customConditions": ["trimmedAPI"],
"exactOptionalPropertyTypes": true,
"noUncheckedIndexedAccess": true,
},
Expand Down
2 changes: 1 addition & 1 deletion common/build/build-common/tsconfig.test.node16.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": ["./tsconfig.base.json", "./tsconfig.node16.json"],
"compilerOptions": {
"composite": false,
"customConditions": ["allow-ff-test-exports"],
"customConditions": ["trimmedAPI", "allow-ff-test-exports"],
"types": ["node"],
"declaration": false,
"declarationMap": false,
Expand Down
13 changes: 10 additions & 3 deletions common/lib/protocol-definitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@
"type": "module",
"exports": {
".": {
"trimmedAPI": {
"types": {
"import": "./lib/public.d.ts",
"require": "./dist/public.d.ts"
}
},
"import": {
"types": "./lib/public.d.ts",
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"require": {
"types": "./dist/public.d.ts",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
Expand All @@ -45,7 +51,7 @@
}
},
"main": "lib/index.js",
"types": "lib/public.d.ts",
"types": "lib/index.d.ts",
"scripts": {
"api": "fluid-build . --task api",
"api-extractor:commonjs": "flub generate entrypoints --outFileAlpha legacy --outDir ./dist",
Expand Down Expand Up @@ -89,6 +95,7 @@
"typescript": "~5.1.6"
},
"packageManager": "[email protected]+sha512.d1a029e1a447ad90bc96cd58b0fad486d2993d531856396f7babf2d83eb1823bb83c5a3d0fc18f675b2d10321d49eb161fece36fe8134aa5823ecd215feed392",
"exportsComments": "The 'trimmedAPI' export condition is set as a workaround for 'flub generate entrypoints', which expects `exports` to contain an entry for all entrypoints. The custom condition effectively hides the public entrypoint unless the 'trimmedAPI' condition is set manually.",
"fluidBuild": {
"tasks": {
"tsc": [
Expand Down
7 changes: 7 additions & 0 deletions experimental/dds/tree/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
"type": "module",
"exports": {
".": {
"trimmedAPI": {
"types": {
"import": "./lib/public.d.ts",
"require": "./dist/public.d.ts"
}
},
"import": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
Expand Down Expand Up @@ -129,6 +135,7 @@
"rimraf": "^4.4.0",
"typescript": "~5.4.5"
},
"exportsComments": "The 'trimmedAPI' export condition is set as a workaround for 'flub generate entrypoints', which expects `exports` to contain an entry for all entrypoints. The custom condition effectively hides the public entrypoint unless the 'trimmedAPI' condition is set manually.",
"typeValidation": {
"disabled": true,
"broken": {}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts"
}
14 changes: 11 additions & 3 deletions packages/common/container-definitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@
"type": "module",
"exports": {
".": {
"trimmedAPI": {
"types": {
"import": "./lib/public.d.ts",
"require": "./dist/public.d.ts"
}
},
"import": {
"types": "./lib/public.d.ts",
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"require": {
"types": "./dist/public.d.ts",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
Expand All @@ -45,7 +51,7 @@
}
},
"main": "lib/index.js",
"types": "lib/public.d.ts",
"types": "lib/index.d.ts",
"scripts": {
"api": "fluid-build . --task api",
"api-extractor:commonjs": "flub generate entrypoints --outFileAlpha legacy --outDir ./dist",
Expand All @@ -62,6 +68,7 @@
"check:biome": "biome check . --formatter-enabled=true",
"check:exports": "concurrently \"npm:check:exports:*\"",
"check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
"check:exports:cjs:index": "api-extractor run --config api-extractor/api-extractor-lint-index.cjs.json",
"check:exports:cjs:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.cjs.json",
"check:exports:cjs:public": "api-extractor run --config api-extractor/api-extractor-lint-public.cjs.json",
"check:exports:esm:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.esm.json",
Expand Down Expand Up @@ -107,6 +114,7 @@
"rimraf": "^4.4.0",
"typescript": "~5.4.5"
},
"exportsComments": "The 'trimmedAPI' export condition is set as a workaround for 'flub generate entrypoints', which expects `exports` to contain an entry for all entrypoints. The custom condition effectively hides the public entrypoint unless the 'trimmedAPI' condition is set manually.",
"typeValidation": {
"broken": {}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts"
}
14 changes: 11 additions & 3 deletions packages/common/core-interfaces/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@
"type": "module",
"exports": {
".": {
"trimmedAPI": {
"types": {
"import": "./lib/public.d.ts",
"require": "./dist/public.d.ts"
}
},
"import": {
"types": "./lib/public.d.ts",
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"require": {
"types": "./dist/public.d.ts",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
Expand All @@ -45,7 +51,7 @@
}
},
"main": "lib/index.js",
"types": "lib/public.d.ts",
"types": "lib/index.d.ts",
"scripts": {
"api": "fluid-build . --task api",
"api-extractor:commonjs": "flub generate entrypoints --outFileAlpha legacy --outDir ./dist",
Expand All @@ -62,6 +68,7 @@
"check:biome": "biome check . --formatter-enabled=true",
"check:exports": "concurrently \"npm:check:exports:*\"",
"check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
"check:exports:cjs:index": "api-extractor run --config api-extractor/api-extractor-lint-index.cjs.json",
"check:exports:cjs:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.cjs.json",
"check:exports:cjs:public": "api-extractor run --config api-extractor/api-extractor-lint-public.cjs.json",
"check:exports:esm:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.esm.json",
Expand Down Expand Up @@ -103,6 +110,7 @@
"rimraf": "^4.4.0",
"typescript": "~5.4.5"
},
"exportsComments": "The 'trimmedAPI' export condition is set as a workaround for 'flub generate entrypoints', which expects `exports` to contain an entry for all entrypoints. The custom condition effectively hides the public entrypoint unless the 'trimmedAPI' condition is set manually.",
"typeValidation": {
"broken": {}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts"
}
14 changes: 11 additions & 3 deletions packages/common/core-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@
"type": "module",
"exports": {
".": {
"trimmedAPI": {
"types": {
"import": "./lib/public.d.ts",
"require": "./dist/public.d.ts"
}
},
"import": {
"types": "./lib/public.d.ts",
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"require": {
"types": "./dist/public.d.ts",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
Expand All @@ -45,7 +51,7 @@
}
},
"main": "lib/index.js",
"types": "lib/public.d.ts",
"types": "lib/index.d.ts",
"scripts": {
"api": "fluid-build . --task api",
"api-extractor:commonjs": "flub generate entrypoints --outFileAlpha legacy --outDir ./dist",
Expand All @@ -64,6 +70,7 @@
"check:biome": "biome check . --formatter-enabled=true",
"check:exports": "concurrently \"npm:check:exports:*\"",
"check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
"check:exports:cjs:index": "api-extractor run --config api-extractor/api-extractor-lint-index.cjs.json",
"check:exports:cjs:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.cjs.json",
"check:exports:cjs:public": "api-extractor run --config api-extractor/api-extractor-lint-public.cjs.json",
"check:exports:esm:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.esm.json",
Expand Down Expand Up @@ -139,6 +146,7 @@
"sinon": "^17.0.1",
"typescript": "~5.4.5"
},
"exportsComments": "The 'trimmedAPI' export condition is set as a workaround for 'flub generate entrypoints', which expects `exports` to contain an entry for all entrypoints. The custom condition effectively hides the public entrypoint unless the 'trimmedAPI' condition is set manually.",
"typeValidation": {
"broken": {}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts"
}
14 changes: 11 additions & 3 deletions packages/common/driver-definitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@
"type": "module",
"exports": {
".": {
"trimmedAPI": {
"types": {
"import": "./lib/public.d.ts",
"require": "./dist/public.d.ts"
}
},
"import": {
"types": "./lib/public.d.ts",
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"require": {
"types": "./dist/public.d.ts",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
Expand All @@ -45,7 +51,7 @@
}
},
"main": "lib/index.js",
"types": "lib/public.d.ts",
"types": "lib/index.d.ts",
"scripts": {
"api": "fluid-build . --task api",
"api-extractor:commonjs": "flub generate entrypoints --outFileAlpha legacy --outDir ./dist",
Expand All @@ -58,6 +64,7 @@
"check:biome": "biome check . --formatter-enabled=true",
"check:exports": "concurrently \"npm:check:exports:*\"",
"check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
"check:exports:cjs:index": "api-extractor run --config api-extractor/api-extractor-lint-index.cjs.json",
"check:exports:cjs:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.cjs.json",
"check:exports:cjs:public": "api-extractor run --config api-extractor/api-extractor-lint-public.cjs.json",
"check:exports:esm:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.esm.json",
Expand Down Expand Up @@ -101,6 +108,7 @@
"rimraf": "^4.4.0",
"typescript": "~5.4.5"
},
"exportsComments": "The 'trimmedAPI' export condition is set as a workaround for 'flub generate entrypoints', which expects `exports` to contain an entry for all entrypoints. The custom condition effectively hides the public entrypoint unless the 'trimmedAPI' condition is set manually.",
"fluidBuild": {
"tasks": {
"tsc": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts"
}
16 changes: 13 additions & 3 deletions packages/dds/cell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,20 @@
"type": "module",
"exports": {
".": {
"trimmedAPI": {
"import": {
"types": "./lib/public.d.ts"
},
"require": {
"types": "./dist/public.d.ts"
}
},
"import": {
"types": "./lib/public.d.ts",
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"require": {
"types": "./dist/public.d.ts",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
Expand All @@ -35,7 +43,7 @@
}
},
"main": "lib/index.js",
"types": "lib/public.d.ts",
"types": "lib/index.d.ts",
"scripts": {
"api": "fluid-build . --task api",
"api-extractor:commonjs": "flub generate entrypoints --outFileAlpha legacy --outDir ./dist",
Expand All @@ -53,6 +61,7 @@
"check:biome": "biome check . --formatter-enabled=true",
"check:exports": "concurrently \"npm:check:exports:*\"",
"check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
"check:exports:cjs:index": "api-extractor run --config api-extractor/api-extractor-lint-index.cjs.json",
"check:exports:cjs:public": "api-extractor run --config api-extractor/api-extractor-lint-public.cjs.json",
"check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
"check:format": "npm run check:biome",
Expand Down Expand Up @@ -134,6 +143,7 @@
"rimraf": "^4.4.0",
"typescript": "~5.4.5"
},
"exportsComments": "The 'trimmedAPI' export condition is set as a workaround for 'flub generate entrypoints', which expects `exports` to contain an entry for all entrypoints. The custom condition effectively hides the public entrypoint unless the 'trimmedAPI' condition is set manually.",
"typeValidation": {
"broken": {}
}
Expand Down
Loading

0 comments on commit f063edb

Please sign in to comment.