@fluidframework/core-utils
Advanced tools
Comparing version 2.0.0-dev-rc.3.0.0.254866 to 2.0.0-dev-rc.4.0.0.261659
@@ -141,3 +141,3 @@ ## API Report File for "@fluidframework/core-utils" | ||
export class Timer implements ITimer { | ||
constructor(defaultTimeout: number, defaultHandler: () => void, getCurrentTick?: () => number); | ||
constructor(defaultTimeout: number, defaultHandler: () => void, exceptionHandler?: ((error: unknown) => void) | undefined); | ||
clear(): void; | ||
@@ -144,0 +144,0 @@ get hasTimer(): boolean; |
# @fluidframework/core-utils | ||
## 2.0.0-rc.3.0.0 | ||
### Major Changes | ||
- Packages now use package.json "exports" and require modern module resolution [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae) | ||
Fluid Framework packages have been updated to use the [package.json "exports" | ||
field](https://nodejs.org/docs/latest-v18.x/api/packages.html#exports) to define explicit entry points for both | ||
TypeScript types and implementation code. | ||
This means that using Fluid Framework packages require the following TypeScript settings in tsconfig.json: | ||
- `"moduleResolution": "Node16"` with `"module": "Node16"` | ||
- `"moduleResolution": "Bundler"` with `"module": "ESNext"` | ||
We recommend using Node16/Node16 unless absolutely necessary. That will produce transpiled JavaScript that is suitable | ||
for use with modern versions of Node.js _and_ Bundlers. | ||
[See the TypeScript documentation](https://www.typescriptlang.org/tsconfig#moduleResolution) for more information | ||
regarding the module and moduleResolution options. | ||
**Node10 moduleResolution is not supported; it does not support Fluid Framework's API structuring pattern that is used | ||
to distinguish stable APIs from those that are in development.** | ||
## 2.0.0-rc.2.0.0 | ||
@@ -4,0 +27,0 @@ |
@@ -10,1 +10,4 @@ /*! | ||
*/ | ||
export {} | ||
@@ -44,3 +44,3 @@ /*! | ||
private readonly defaultHandler; | ||
private readonly getCurrentTick; | ||
private readonly exceptionHandler?; | ||
/** | ||
@@ -51,3 +51,4 @@ * Returns true if the timer is running. | ||
private runningState; | ||
constructor(defaultTimeout: number, defaultHandler: () => void, getCurrentTick?: () => number); | ||
private readonly getCurrentTick; | ||
constructor(defaultTimeout: number, defaultHandler: () => void, exceptionHandler?: ((error: unknown) => void) | undefined); | ||
/** | ||
@@ -54,0 +55,0 @@ * Calls setTimeout and tracks the resulting timeout. |
@@ -50,6 +50,7 @@ "use strict"; | ||
} | ||
constructor(defaultTimeout, defaultHandler, getCurrentTick = () => Date.now()) { | ||
constructor(defaultTimeout, defaultHandler, exceptionHandler) { | ||
this.defaultTimeout = defaultTimeout; | ||
this.defaultHandler = defaultHandler; | ||
this.getCurrentTick = getCurrentTick; | ||
this.exceptionHandler = exceptionHandler; | ||
this.getCurrentTick = () => Date.now(); | ||
} | ||
@@ -135,3 +136,16 @@ /** | ||
this.clear(); | ||
handler(); | ||
try { | ||
handler(); | ||
} | ||
catch (error) { | ||
if (this.exceptionHandler) { | ||
this.exceptionHandler(error); | ||
} | ||
else { | ||
// This will be unhandled exception, but it's better to have unhandled exception than swallow it. | ||
// Applications might have telemetry to report unhandled exceptions, letting us know where we are missing | ||
// exception handlers. | ||
throw error; | ||
} | ||
} | ||
} | ||
@@ -138,0 +152,0 @@ else { |
@@ -10,1 +10,4 @@ /*! | ||
*/ | ||
export {} | ||
@@ -44,3 +44,3 @@ /*! | ||
private readonly defaultHandler; | ||
private readonly getCurrentTick; | ||
private readonly exceptionHandler?; | ||
/** | ||
@@ -51,3 +51,4 @@ * Returns true if the timer is running. | ||
private runningState; | ||
constructor(defaultTimeout: number, defaultHandler: () => void, getCurrentTick?: () => number); | ||
private readonly getCurrentTick; | ||
constructor(defaultTimeout: number, defaultHandler: () => void, exceptionHandler?: ((error: unknown) => void) | undefined); | ||
/** | ||
@@ -54,0 +55,0 @@ * Calls setTimeout and tracks the resulting timeout. |
@@ -46,6 +46,7 @@ /*! | ||
} | ||
constructor(defaultTimeout, defaultHandler, getCurrentTick = () => Date.now()) { | ||
constructor(defaultTimeout, defaultHandler, exceptionHandler) { | ||
this.defaultTimeout = defaultTimeout; | ||
this.defaultHandler = defaultHandler; | ||
this.getCurrentTick = getCurrentTick; | ||
this.exceptionHandler = exceptionHandler; | ||
this.getCurrentTick = () => Date.now(); | ||
} | ||
@@ -131,3 +132,16 @@ /** | ||
this.clear(); | ||
handler(); | ||
try { | ||
handler(); | ||
} | ||
catch (error) { | ||
if (this.exceptionHandler) { | ||
this.exceptionHandler(error); | ||
} | ||
else { | ||
// This will be unhandled exception, but it's better to have unhandled exception than swallow it. | ||
// Applications might have telemetry to report unhandled exceptions, letting us know where we are missing | ||
// exception handlers. | ||
throw error; | ||
} | ||
} | ||
} | ||
@@ -134,0 +148,0 @@ else { |
{ | ||
"name": "@fluidframework/core-utils", | ||
"version": "2.0.0-dev-rc.3.0.0.254866", | ||
"version": "2.0.0-dev-rc.4.0.0.261659", | ||
"description": "Not intended for use outside the Fluid client repo.", | ||
@@ -26,9 +26,9 @@ "homepage": "https://fluidframework.com", | ||
}, | ||
"./alpha": { | ||
"./legacy": { | ||
"import": { | ||
"types": "./lib/alpha.d.ts", | ||
"types": "./lib/legacy.d.ts", | ||
"default": "./lib/index.js" | ||
}, | ||
"require": { | ||
"types": "./dist/alpha.d.ts", | ||
"types": "./dist/legacy.d.ts", | ||
"default": "./dist/index.js" | ||
@@ -48,4 +48,4 @@ } | ||
}, | ||
"main": "dist/index.js", | ||
"types": "./dist/public.d.ts", | ||
"main": "lib/index.js", | ||
"types": "lib/public.d.ts", | ||
"c8": { | ||
@@ -74,7 +74,8 @@ "all": true, | ||
"@biomejs/biome": "^1.6.2", | ||
"@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.3.0.0.254866", | ||
"@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.4.0.0.261659", | ||
"@fluid-tools/benchmark": "^0.47.0", | ||
"@fluid-tools/build-cli": "^0.35.0", | ||
"@fluid-tools/build-cli": "0.38.0-259537", | ||
"@fluidframework/build-common": "^2.0.3", | ||
"@fluidframework/build-tools": "^0.35.0", | ||
"@fluidframework/build-tools": "0.38.0-259537", | ||
"@fluidframework/core-utils-previous": "npm:@fluidframework/core-utils@2.0.0-rc.3.0.0", | ||
"@fluidframework/eslint-config-fluid": "^5.1.0", | ||
@@ -100,3 +101,2 @@ "@microsoft/api-extractor": "^7.42.3", | ||
"typeValidation": { | ||
"disabled": true, | ||
"broken": {} | ||
@@ -106,4 +106,4 @@ }, | ||
"api": "fluid-build . --task api", | ||
"api-extractor:commonjs": "flub generate entrypoints --outDir ./dist", | ||
"api-extractor:esnext": "flub generate entrypoints --outDir ./lib", | ||
"api-extractor:commonjs": "flub generate entrypoints --outFileAlpha legacy --outDir ./dist", | ||
"api-extractor:esnext": "flub generate entrypoints --outFileAlpha legacy --outDir ./lib --node10TypeCompat", | ||
"bench": "mocha --recursive \"lib/test/**/*.spec.*js\" --timeout 999999 --perfMode --parentProcess --fgrep @Benchmark --reporter @fluid-tools/benchmark/dist/MochaReporter.js", | ||
@@ -119,7 +119,7 @@ "bench:profile": "mocha --recursive \"lib/test/**/*.spec.*js\" --v8-prof --v8-logfile=profile.log --v8-no-logfile-per-isolate --timeout 999999 --perfMode --fgrep @Benchmark --reporter @fluid-tools/benchmark/dist/MochaReporter.js && node --prof-process profile.log > profile.txt && rimraf profile.log && echo See results in profile.txt", | ||
"build:test:esm": "tsc --project ./src/test/tsconfig.json", | ||
"check:are-the-types-wrong": "attw --pack . --entrypoints .", | ||
"check:are-the-types-wrong": "attw --pack .", | ||
"check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore", | ||
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json", | ||
"ci:build:docs": "api-extractor run", | ||
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc", | ||
"clean": "rimraf --glob dist lib \"*.d.ts\" \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc", | ||
"eslint": "eslint --format stylish src", | ||
@@ -139,5 +139,5 @@ "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout", | ||
"tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist", | ||
"typetests:gen": "fluid-type-test-generator", | ||
"typetests:gen": "flub generate typetests --dir . -v --publicFallback", | ||
"typetests:prepare": "flub typetests --dir . --reset --previous --normalize" | ||
} | ||
} |
@@ -113,2 +113,3 @@ /*! | ||
private runningState: IRunningTimerState | undefined; | ||
private readonly getCurrentTick: () => number = (): number => Date.now(); | ||
@@ -118,3 +119,3 @@ public constructor( | ||
private readonly defaultHandler: () => void, | ||
private readonly getCurrentTick: () => number = (): number => Date.now(), | ||
private readonly exceptionHandler?: (error: unknown) => void, | ||
) {} | ||
@@ -211,3 +212,14 @@ | ||
this.clear(); | ||
handler(); | ||
try { | ||
handler(); | ||
} catch (error) { | ||
if (this.exceptionHandler) { | ||
this.exceptionHandler(error); | ||
} else { | ||
// This will be unhandled exception, but it's better to have unhandled exception than swallow it. | ||
// Applications might have telemetry to report unhandled exceptions, letting us know where we are missing | ||
// exception handlers. | ||
throw error; | ||
} | ||
} | ||
} else { | ||
@@ -214,0 +226,0 @@ // Restart with remaining time |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
243800
3466
26