From 9eed19e43c8a010ba0f7ab0e2a7425bda01eb4bc Mon Sep 17 00:00:00 2001 From: Zhiyuan Liang Date: Sun, 9 Nov 2025 15:10:38 +0800 Subject: [PATCH] update rollup --- .../package.json | 5 ++-- .../rollup.config.mjs | 18 ++----------- .../tsconfig.json | 15 +++++++---- .../package.json | 7 +++--- .../rollup.config.mjs | 18 ++----------- .../tsconfig.json | 20 ++++++++++----- src/feature-management/package.json | 7 +++--- src/feature-management/rollup.config.mjs | 25 ++++--------------- src/feature-management/tsconfig.json | 18 ++++++++++--- 9 files changed, 55 insertions(+), 78 deletions(-) diff --git a/src/feature-management-applicationinsights-browser/package.json b/src/feature-management-applicationinsights-browser/package.json index 8825db5..ed1e735 100644 --- a/src/feature-management-applicationinsights-browser/package.json +++ b/src/feature-management-applicationinsights-browser/package.json @@ -4,16 +4,15 @@ "description": "Feature Management Application Insights Plugin for Browser provides a solution for sending feature flag evaluation events produced by the Feature Management library.", "main": "./dist/esm/index.js", "type": "module", - "types": "types/index.d.ts", + "types": "./dist/types/index.d.ts", "files": [ "dist/", - "types/", "LICENSE", "README.md" ], "scripts": { "build": "npm run link && npm run clean && rollup --config", - "clean": "rimraf dist types", + "clean": "rimraf dist", "link": "npm link ../feature-management", "dev": "rollup --config --watch", "lint": "eslint src/", diff --git a/src/feature-management-applicationinsights-browser/rollup.config.mjs b/src/feature-management-applicationinsights-browser/rollup.config.mjs index 43dbe1e..f238142 100644 --- a/src/feature-management-applicationinsights-browser/rollup.config.mjs +++ b/src/feature-management-applicationinsights-browser/rollup.config.mjs @@ -16,28 +16,14 @@ export default [ ], plugins: [ typescript({ - compilerOptions: { - "lib": [ - "DOM", - "WebWorker", - "ESNext" - ], - "skipDefaultLibCheck": true, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "target": "ES2022", - "strictNullChecks": true, - "strictFunctionTypes": true, - "sourceMap": true, - "inlineSources": true - } + tsconfig: "./tsconfig.json", }) ], }, { external: ["@microsoft/feature-management"], input: "src/index.ts", - output: [{ file: "types/index.d.ts", format: "esm" }], + output: [{ file: "dist/types/index.d.ts", format: "esm" }], plugins: [dts()], } ]; diff --git a/src/feature-management-applicationinsights-browser/tsconfig.json b/src/feature-management-applicationinsights-browser/tsconfig.json index 1b95c57..743a3d5 100644 --- a/src/feature-management-applicationinsights-browser/tsconfig.json +++ b/src/feature-management-applicationinsights-browser/tsconfig.json @@ -1,21 +1,26 @@ { "compilerOptions": { + // Include ES2022 (modern JS), ESNext (future features), DOM and web worker APIs for browser support. "lib": [ "DOM", "WebWorker", "ESNext", "ES2022" ], - "skipDefaultLibCheck": true, - "module": "ESNext", - "moduleResolution": "Node", + // Generate modern JavaScript syntax compatible with modern browsers. "target": "ES2022", + + // Use Node-style resolution to locate imports + "moduleResolution": "Node", + + // Ensure strict type-checking "strictNullChecks": true, "strictFunctionTypes": true, + "skipDefaultLibCheck": true, + + // Generate source maps and inline original TypeScript sources for debugging. "sourceMap": true, "inlineSources": true, - "allowSyntheticDefaultImports": true, - "esModuleInterop": true }, "exclude": [ "node_modules", diff --git a/src/feature-management-applicationinsights-node/package.json b/src/feature-management-applicationinsights-node/package.json index ea11956..3292186 100644 --- a/src/feature-management-applicationinsights-node/package.json +++ b/src/feature-management-applicationinsights-node/package.json @@ -4,7 +4,6 @@ "description": "Feature Management Application Insights Plugin for Node.js provides a solution for sending feature flag evaluation events produced by the Feature Management library.", "files": [ "dist/", - "types/", "LICENSE", "README.md" ], @@ -12,18 +11,18 @@ "./package.json": "./package.json", ".": { "import": { - "types": "./types/index.d.ts", + "types": "./dist/types/index.d.ts", "default": "./dist/esm/index.js" }, "require": { - "types": "./types/index.d.ts", + "types": "./dist/types/index.d.ts", "default": "./dist/commonjs/index.js" } } }, "scripts": { "build": "npm run link && npm run clean && rollup --config", - "clean": "rimraf dist types", + "clean": "rimraf dist", "link": "npm link ../feature-management", "dev": "rollup --config --watch", "lint": "eslint src/", diff --git a/src/feature-management-applicationinsights-node/rollup.config.mjs b/src/feature-management-applicationinsights-node/rollup.config.mjs index 9c3e826..aff721f 100644 --- a/src/feature-management-applicationinsights-node/rollup.config.mjs +++ b/src/feature-management-applicationinsights-node/rollup.config.mjs @@ -22,28 +22,14 @@ export default [ ], plugins: [ typescript({ - compilerOptions: { - "lib": [ - "DOM", - "WebWorker", - "ESNext" - ], - "skipDefaultLibCheck": true, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "target": "ES2022", - "strictNullChecks": true, - "strictFunctionTypes": true, - "sourceMap": true, - "inlineSources": true - } + tsconfig: "./tsconfig.json", }) ], }, { external: ["@microsoft/feature-management"], input: "src/index.ts", - output: [{ file: "types/index.d.ts", format: "esm" }], + output: [{ file: "dist/types/index.d.ts", format: "esm" }], plugins: [dts()], } ]; diff --git a/src/feature-management-applicationinsights-node/tsconfig.json b/src/feature-management-applicationinsights-node/tsconfig.json index 1b95c57..c0a9ecc 100644 --- a/src/feature-management-applicationinsights-node/tsconfig.json +++ b/src/feature-management-applicationinsights-node/tsconfig.json @@ -1,21 +1,29 @@ { "compilerOptions": { + // Include ES2022 (modern JS), ESNext (future features) and web worker APIs. "lib": [ - "DOM", "WebWorker", "ESNext", "ES2022" ], - "skipDefaultLibCheck": true, - "module": "ESNext", - "moduleResolution": "Node", + // Generate modern JavaScript syntax compatible with Node 18+. "target": "ES2022", + + // Use Node-style resolution to locate imports + "moduleResolution": "Node", + + // Allow default imports from CommonJS modules. + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + + // Ensure strict type-checking "strictNullChecks": true, "strictFunctionTypes": true, + "skipDefaultLibCheck": true, + + // Generate source maps and inline original TypeScript sources for debugging. "sourceMap": true, "inlineSources": true, - "allowSyntheticDefaultImports": true, - "esModuleInterop": true }, "exclude": [ "node_modules", diff --git a/src/feature-management/package.json b/src/feature-management/package.json index e041c98..c006818 100644 --- a/src/feature-management/package.json +++ b/src/feature-management/package.json @@ -4,7 +4,6 @@ "description": "Feature Management is a library for enabling/disabling features at runtime. Developers can use feature flags in simple use cases like conditional statement to more advanced scenarios like conditionally adding routes.", "files": [ "dist/", - "types/", "LICENSE", "README.md" ], @@ -12,11 +11,11 @@ "./package.json": "./package.json", ".": { "import": { - "types": "./types/index.d.ts", + "types": "./dist/types/index.d.ts", "default": "./dist/esm/index.js" }, "require": { - "types": "./types/index.d.ts", + "types": "./dist/types/index.d.ts", "default": "./dist/commonjs/index.js" } } @@ -26,7 +25,7 @@ "build-test": "npm run build-test-esm && npm run build-test-cjs", "build-test-esm": "tsc -p ./tsconfig.test.esm.json && cpy esm-package.json out/esm --rename=package.json", "build-test-cjs": "tsc -p ./tsconfig.test.cjs.json && cpy cjs-package.json out/commonjs --rename=package.json", - "clean": "rimraf dist out types", + "clean": "rimraf dist out", "dev": "rollup --config --watch", "lint": "eslint src/ test/ --ignore-pattern test/browser/testcases.js", "fix-lint": "eslint src/ test/ --fix --ignore-pattern test/browser/testcases.js", diff --git a/src/feature-management/rollup.config.mjs b/src/feature-management/rollup.config.mjs index 1d61acd..b204a1e 100644 --- a/src/feature-management/rollup.config.mjs +++ b/src/feature-management/rollup.config.mjs @@ -4,7 +4,9 @@ import dts from "rollup-plugin-dts"; export default [ { - external: ["crypto"], + external: [ + "crypto" + ], input: "src/index.ts", output: [ { @@ -28,30 +30,13 @@ export default [ ], plugins: [ typescript({ - compilerOptions: { - "lib": [ - "DOM", - "WebWorker", - "ESNext" - ], - "skipDefaultLibCheck": true, - "module": "ESNext", - "moduleResolution": "Node", - "target": "ES2022", - "strictNullChecks": true, - "strictFunctionTypes": true, - "sourceMap": true, - "inlineSources": true - }, - "exclude": [ - "test/**/*" - ] + tsconfig: "./tsconfig.json", }) ], }, { input: "src/index.ts", - output: [{ file: "types/index.d.ts", format: "esm" }], + output: [{ file: "dist/types/index.d.ts", format: "esm" }], plugins: [dts()], }, ]; diff --git a/src/feature-management/tsconfig.json b/src/feature-management/tsconfig.json index 837eaf6..e253840 100644 --- a/src/feature-management/tsconfig.json +++ b/src/feature-management/tsconfig.json @@ -1,20 +1,30 @@ { "compilerOptions": { + // Include ES2022 (modern JS), ESNext (future features), DOM and web worker APIs for browser support. "lib": [ "DOM", "WebWorker", "ESNext", "ES2022" ], - "skipDefaultLibCheck": true, - "moduleResolution": "Node", + // Generate modern JavaScript syntax compatible with Node 18+ and modern browsers. "target": "ES2022", + + // Use Node-style resolution to locate imports + "moduleResolution": "Node", + + // Allow default imports from CommonJS modules. + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + + // Ensure strict type-checking "strictNullChecks": true, "strictFunctionTypes": true, + "skipDefaultLibCheck": true, + + // Generate source maps and inline original TypeScript sources for debugging. "sourceMap": true, "inlineSources": true, - "allowSyntheticDefaultImports": true, - "esModuleInterop": true }, "exclude": [ "node_modules",