uawdijnntqw1x1x1
IP : 216.73.216.110
Hostname : 6.87.74.97.host.secureserver.net
Kernel : Linux 6.87.74.97.host.secureserver.net 4.18.0-553.83.1.el8_10.x86_64 #1 SMP Mon Nov 10 04:22:44 EST 2025 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
emeraadmin
/
www
/
node_modules
/
summernote
/
plugin
/
..
/
..
/
debug
/
..
/
..
/
src
/
..
/
4d695
/
@react-dnd.tar
/
/
invariant/src/index.ts000064400000002224151701475600011013 0ustar00/** * Use invariant() to assert state which your program assumes to be true. * * Provide sprintf-style format (only %s is supported) and arguments * to provide information about what broke and what you were * expecting. * * The invariant message will be stripped in production, but the invariant * will remain to ensure logic does not differ in production. */ export function invariant(condition: any, format: string, ...args: any[]) { if (process.env.NODE_ENV !== 'production') { if (format === undefined) { throw new Error('invariant requires an error message argument'); } } if (!condition) { let error; if (format === undefined) { error = new Error( 'Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.' ); } else { let argIndex = 0; error = new Error( format.replace(/%s/g, function() { return args[argIndex++]; }) ); error.name = 'Invariant Violation'; } (error as any).framesToPop = 1; // we don't care about invariant's own frame throw error; } } invariant/package.json000064400000003727151701475600011044 0ustar00{ "_from": "@react-dnd/invariant@^2.0.0", "_id": "@react-dnd/invariant@2.0.0", "_inBundle": false, "_integrity": "sha512-xL4RCQBCBDJ+GRwKTFhGUW8GXa4yoDfJrPbLblc3U09ciS+9ZJXJ3Qrcs/x2IODOdIE5kQxvMmE2UKyqUictUw==", "_location": "/@react-dnd/invariant", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "@react-dnd/invariant@^2.0.0", "name": "@react-dnd/invariant", "escapedName": "@react-dnd%2finvariant", "scope": "@react-dnd", "rawSpec": "^2.0.0", "saveSpec": null, "fetchSpec": "^2.0.0" }, "_requiredBy": [ "/dnd-core" ], "_resolved": "https://registry.npmjs.org/@react-dnd/invariant/-/invariant-2.0.0.tgz", "_shasum": "09d2e81cd39e0e767d7da62df9325860f24e517e", "_spec": "@react-dnd/invariant@^2.0.0", "_where": "C:\\xampp\\htdocs\\emeraltd\\node_modules\\dnd-core", "author": { "name": "Andres Suarez", "email": "zertosh@gmail.com" }, "bugs": { "url": "https://github.com/react-dnd/invariant/issues" }, "bundleDependencies": false, "deprecated": false, "description": "invariantx", "devDependencies": { "@types/jest": "^24.0.23", "husky": "^3.1.0", "tsdx": "^0.11.0", "tslib": "^1.10.0", "typescript": "^3.7.2" }, "homepage": "https://github.com/react-dnd/invariant#readme", "husky": { "hooks": { "pre-commit": "tsdx lint" } }, "keywords": [ "test", "invariant" ], "license": "MIT", "main": "dist/index.js", "module": "dist/invariant.esm.js", "name": "@react-dnd/invariant", "peerDependencies": {}, "prettier": { "printWidth": 80, "semi": true, "singleQuote": true, "trailingComma": "es5" }, "private": false, "repository": { "type": "git", "url": "git+https://github.com/react-dnd/invariant.git" }, "scripts": { "build": "tsdx build", "lint": "tsdx lint", "start": "tsdx watch", "test": "tsdx test" }, "typings": "dist/index.d.ts", "version": "2.0.0" } invariant/test/production.spec.ts000064400000001406151701475600013214 0ustar00import invariant from '../src'; describe('production mode', () => { const OLD_ENV = process.env; beforeEach(() => { jest.resetModules(); // this is important - it clears the cache process.env = { ...OLD_ENV }; delete process.env.NODE_ENV; }); afterEach(() => { process.env = OLD_ENV; }); it('works', () => { process.env.NODE_ENV = 'production'; expect(function() { invariant(true, 'invariant message'); }).not.toThrow(); expect(function() { invariant(false, 'invariant message'); }).toThrow(/invariant message/); expect(function() { (invariant as any)(true); }).not.toThrow(); expect(function() { (invariant as any)(false); }).toThrow(/minified exception occurred/i); }); }); invariant/test/development.spec.ts000064400000001416151701475600013351 0ustar00import invariant from '../src'; describe('development mode', () => { const OLD_ENV = process.env; beforeEach(() => { jest.resetModules(); // this is important - it clears the cache process.env = { ...OLD_ENV }; delete process.env.NODE_ENV; }); afterEach(() => { process.env = OLD_ENV; }); it('works', () => { process.env.NODE_ENV = 'development'; expect(function() { invariant(true, 'invariant message'); }).not.toThrow(); expect(function() { invariant(false, 'invariant message'); }).toThrow(/invariant message/); expect(function() { (invariant as any)(true); }).toThrow(/requires an error/i); expect(function() { (invariant as any)(false); }).toThrow(/requires an error/i); }); }); invariant/LICENSE000064400000002070151701475600007551 0ustar00MIT License Copyright (c) 2013-present, Facebook, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. invariant/dist/invariant.esm.js000064400000002440151701475600012624 0ustar00/** * Use invariant() to assert state which your program assumes to be true. * * Provide sprintf-style format (only %s is supported) and arguments * to provide information about what broke and what you were * expecting. * * The invariant message will be stripped in production, but the invariant * will remain to ensure logic does not differ in production. */ function invariant(condition, format) { for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { args[_key - 2] = arguments[_key]; } if (process.env.NODE_ENV !== 'production') { if (format === undefined) { throw new Error('invariant requires an error message argument'); } } if (!condition) { var error; if (format === undefined) { error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); } else { var argIndex = 0; error = new Error(format.replace(/%s/g, function () { return args[argIndex++]; })); error.name = 'Invariant Violation'; } error.framesToPop = 1; // we don't care about invariant's own frame throw error; } } export { invariant }; //# sourceMappingURL=invariant.esm.js.map invariant/dist/invariant.esm.js.map000064400000003677151701475600013415 0ustar00{"version":3,"file":"invariant.esm.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nexport function invariant(condition: any, format: string, ...args: any[]) {\n if (process.env.NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n let error;\n if (format === undefined) {\n error = new Error(\n 'Minified exception occurred; use the non-minified dev environment ' +\n 'for the full error message and additional helpful warnings.'\n );\n } else {\n let argIndex = 0;\n error = new Error(\n format.replace(/%s/g, function() {\n return args[argIndex++];\n })\n );\n error.name = 'Invariant Violation';\n }\n\n (error as any).framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n}\n"],"names":["invariant","condition","format","args","process","env","NODE_ENV","undefined","Error","error","argIndex","replace","name","framesToPop"],"mappings":"AAAA;;;;;;;;;;AAWA,SAAgBA,UAAUC,WAAgBC;oCAAmBC;IAAAA;;;MACvDC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAA7B,EAA2C;QACrCJ,MAAM,KAAKK,SAAf,EAA0B;YAClB,IAAIC,KAAJ,CAAU,8CAAV,CAAN;;;;MAIA,CAACP,SAAL,EAAgB;QACVQ,KAAJ;;QACIP,MAAM,KAAKK,SAAf,EAA0B;MACxBE,KAAK,GAAG,IAAID,KAAJ,CACN,uEACE,6DAFI,CAAR;KADF,MAKO;UACDE,QAAQ,GAAG,CAAf;MACAD,KAAK,GAAG,IAAID,KAAJ,CACNN,MAAM,CAACS,OAAP,CAAe,KAAf,EAAsB;eACbR,IAAI,CAACO,QAAQ,EAAT,CAAX;OADF,CADM,CAAR;MAKAD,KAAK,CAACG,IAAN,GAAa,qBAAb;;;IAGDH,KAAa,CAACI,WAAd,GAA4B,CAA5B,CAjBa;;UAkBRJ,KAAN;;;;;;"}invariant/dist/invariant.cjs.production.min.js.map000064400000003132151701475600016341 0ustar00{"version":3,"file":"invariant.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nexport function invariant(condition: any, format: string, ...args: any[]) {\n if (process.env.NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n let error;\n if (format === undefined) {\n error = new Error(\n 'Minified exception occurred; use the non-minified dev environment ' +\n 'for the full error message and additional helpful warnings.'\n );\n } else {\n let argIndex = 0;\n error = new Error(\n format.replace(/%s/g, function() {\n return args[argIndex++];\n })\n );\n error.name = 'Invariant Violation';\n }\n\n (error as any).framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n}\n"],"names":["condition","format","args","error","undefined","Error","argIndex","replace","name","framesToPop"],"mappings":"wCAW0BA,EAAgBC,8BAAmBC,mCAAAA,wBAOtDF,EAAW,KACVG,UACWC,IAAXH,EACFE,EAAQ,IAAIE,MACV,qIAGG,KACDC,EAAW,GACfH,EAAQ,IAAIE,MACVJ,EAAOM,QAAQ,OAAO,kBACbL,EAAKI,UAGVE,KAAO,4BAGdL,EAAcM,YAAc,EACvBN"}invariant/dist/invariant.cjs.production.min.js000064400000000737151701475600015575 0ustar00"use strict";exports.invariant=function(r,e){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];if(!r){var a;if(void 0===e)a=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var t=0;(a=new Error(e.replace(/%s/g,(function(){return i[t++]})))).name="Invariant Violation"}throw a.framesToPop=1,a}}; //# sourceMappingURL=invariant.cjs.production.min.js.map invariant/dist/test/production.spec.d.ts000064400000000014151701475600014373 0ustar00export {}; invariant/dist/test/development.spec.d.ts000064400000000014151701475600014527 0ustar00export {}; invariant/dist/index.js000064400000000304151701475600011152 0ustar00 'use strict' if (process.env.NODE_ENV === 'production') { module.exports = require('./invariant.cjs.production.min.js') } else { module.exports = require('./invariant.cjs.development.js') } invariant/dist/invariant.cjs.development.js.map000064400000003604151701475600015717 0ustar00{"version":3,"file":"invariant.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nexport function invariant(condition: any, format: string, ...args: any[]) {\n if (process.env.NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n let error;\n if (format === undefined) {\n error = new Error(\n 'Minified exception occurred; use the non-minified dev environment ' +\n 'for the full error message and additional helpful warnings.'\n );\n } else {\n let argIndex = 0;\n error = new Error(\n format.replace(/%s/g, function() {\n return args[argIndex++];\n })\n );\n error.name = 'Invariant Violation';\n }\n\n (error as any).framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n}\n"],"names":["invariant","condition","format","args","undefined","Error","error","argIndex","replace","name","framesToPop"],"mappings":";;AAAA;;;;;;;;;;AAWA,SAAgBA,UAAUC,WAAgBC;oCAAmBC;IAAAA;;;EAChB;QACrCD,MAAM,KAAKE,SAAf,EAA0B;YAClB,IAAIC,KAAJ,CAAU,8CAAV,CAAN;;;;MAIA,CAACJ,SAAL,EAAgB;QACVK,KAAJ;;QACIJ,MAAM,KAAKE,SAAf,EAA0B;MACxBE,KAAK,GAAG,IAAID,KAAJ,CACN,uEACE,6DAFI,CAAR;KADF,MAKO;UACDE,QAAQ,GAAG,CAAf;MACAD,KAAK,GAAG,IAAID,KAAJ,CACNH,MAAM,CAACM,OAAP,CAAe,KAAf,EAAsB;eACbL,IAAI,CAACI,QAAQ,EAAT,CAAX;OADF,CADM,CAAR;MAKAD,KAAK,CAACG,IAAN,GAAa,qBAAb;;;IAGDH,KAAa,CAACI,WAAd,GAA4B,CAA5B,CAjBa;;UAkBRJ,KAAN;;;;;;"}invariant/dist/index.d.ts000064400000000725151701475600011415 0ustar00/** * Use invariant() to assert state which your program assumes to be true. * * Provide sprintf-style format (only %s is supported) and arguments * to provide information about what broke and what you were * expecting. * * The invariant message will be stripped in production, but the invariant * will remain to ensure logic does not differ in production. */ export declare function invariant(condition: any, format: string, ...args: any[]): void; invariant/dist/invariant.cjs.development.js000064400000002431151701475600015140 0ustar00'use strict'; /** * Use invariant() to assert state which your program assumes to be true. * * Provide sprintf-style format (only %s is supported) and arguments * to provide information about what broke and what you were * expecting. * * The invariant message will be stripped in production, but the invariant * will remain to ensure logic does not differ in production. */ function invariant(condition, format) { for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { args[_key - 2] = arguments[_key]; } { if (format === undefined) { throw new Error('invariant requires an error message argument'); } } if (!condition) { var error; if (format === undefined) { error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); } else { var argIndex = 0; error = new Error(format.replace(/%s/g, function () { return args[argIndex++]; })); error.name = 'Invariant Violation'; } error.framesToPop = 1; // we don't care about invariant's own frame throw error; } } exports.invariant = invariant; //# sourceMappingURL=invariant.cjs.development.js.map invariant/README.md000064400000003351151701475600010026 0ustar00# invariant [](https://actions-badge.atrox.dev/react-dnd/invariant/goto) A mirror of Facebook's `invariant` (e.g. [React](https://github.com/facebook/react/blob/v0.13.3/src/vendor/core/invariant.js), [flux](https://github.com/facebook/flux/blob/2.0.2/src/invariant.js)). A way to provide descriptive errors in development but generic errors in production. ## Note: This has been forked by react-dnd for ESM and TypeScript support ## Install With [npm](http://npmjs.org) do: ```sh npm install invariant ``` ## `invariant(condition, message)` ```js var invariant = require('invariant'); invariant(someTruthyVal, 'This will not throw'); // No errors invariant(someFalseyVal, 'This will throw an error with this message'); // Error: Invariant Violation: This will throw an error with this message ``` **Note:** When `process.env.NODE_ENV` is not `production`, the message is required. If omitted, `invariant` will throw regardless of the truthiness of the condition. When `process.env.NODE_ENV` is `production`, the message is optional – so they can be minified away. ### Browser When used with [browserify](https://github.com/substack/node-browserify), it'll use `browser.js` (instead of `invariant.js`) and the [envify](https://github.com/hughsk/envify) transform will inline the value of `process.env.NODE_ENV`. ### Node The node version is optimized around the performance implications of accessing `process.env`. The value of `process.env.NODE_ENV` is cached, and repeatedly used instead of reading `process.env`. See [Server rendering is slower with npm react #812](https://github.com/facebook/react/issues/812) invariant/tsconfig.json000064400000001344151701475600011256 0ustar00{ "include": ["src", "types", "test"], "compilerOptions": { "target": "es5", "module": "esnext", "lib": ["dom", "esnext"], "importHelpers": true, "declaration": true, "sourceMap": true, "rootDir": "./", "strict": true, "noImplicitAny": true, "strictNullChecks": true, "strictFunctionTypes": true, "strictPropertyInitialization": true, "noImplicitThis": true, "alwaysStrict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "moduleResolution": "node", "baseUrl": "./", "paths": { "*": ["src/*", "node_modules/*"] }, "jsx": "react", "esModuleInterop": true } } invariant/CHANGELOG.md000064400000002413151701475600010356 0ustar002.2.4 / 2018-03-13 ================== * Use flow strict mode (i.e. `@flow strict`). 2.2.3 / 2018-02-19 ================== * Change license from BSD+Patents to MIT. 2.2.2 / 2016-11-15 ================== * Add LICENSE file. * Misc housekeeping. 2.2.1 / 2016-03-09 ================== * Use `NODE_ENV` variable instead of `__DEV__` to cache `process.env.NODE_ENV`. 2.2.0 / 2015-11-17 ================== * Use `error.name` instead of `Invariant Violation`. 2.1.3 / 2015-11-17 ================== * Remove `@provideModule` pragma. 2.1.2 / 2015-10-27 ================== * Fix license. 2.1.1 / 2015-09-20 ================== * Use correct SPDX license. * Test "browser.js" using browserify. * Switch from "envify" to "loose-envify". 2.1.0 / 2015-06-03 ================== * Add "envify" as a dependency. * Fixed license field in "package.json". 2.0.0 / 2015-02-21 ================== * Switch to using the "browser" field. There are now browser and server versions that respect the "format" in production. 1.0.2 / 2014-09-24 ================== * Added tests, npmignore and gitignore. * Clarifications in README. 1.0.1 / 2014-09-24 ================== * Actually include 'invariant.js'. 1.0.0 / 2014-09-24 ================== * Initial release. invariant/.github/workflows/nodejs.yml000064400000000743151701475600014153 0ustar00name: Node CI on: [push, pull_request] jobs: build: runs-on: ubuntu-latest strategy: matrix: node-version: [8.x, 10.x, 12.x] steps: - uses: actions/checkout@v1 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - name: npm install, build, and test run: | yarn install yarn build yarn test env: CI: true shallowequal/src/index.ts000064400000002177151701475600011530 0ustar00export function shallowEqual<T>( objA: T, objB: T, compare?: (a: T, b: T, key?: string) => boolean | void, compareContext?: any ) { var compareResult = compare ? compare.call(compareContext, objA, objB) : void 0; if (compareResult !== void 0) { return !!compareResult; } if (objA === objB) { return true; } if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) { return false; } var keysA = Object.keys(objA); var keysB = Object.keys(objB); if (keysA.length !== keysB.length) { return false; } var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); // Test for A's keys different from B. for (var idx = 0; idx < keysA.length; idx++) { var key = keysA[idx]; if (!bHasOwnProperty(key)) { return false; } var valueA = (objA as any)[key]; var valueB = (objB as any)[key]; compareResult = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; if ( compareResult === false || (compareResult === void 0 && valueA !== valueB) ) { return false; } } return true; } shallowequal/package.json000064400000004175151701475600011550 0ustar00{ "_from": "@react-dnd/shallowequal@^2.0.0", "_id": "@react-dnd/shallowequal@2.0.0", "_inBundle": false, "_integrity": "sha512-Pc/AFTdwZwEKJxFJvlxrSmGe/di+aAOBn60sremrpLo6VI/6cmiUYNNwlI5KNYttg7uypzA3ILPMPgxB2GYZEg==", "_location": "/@react-dnd/shallowequal", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "@react-dnd/shallowequal@^2.0.0", "name": "@react-dnd/shallowequal", "escapedName": "@react-dnd%2fshallowequal", "scope": "@react-dnd", "rawSpec": "^2.0.0", "saveSpec": null, "fetchSpec": "^2.0.0" }, "_requiredBy": [ "/react-dnd" ], "_resolved": "https://registry.npmjs.org/@react-dnd/shallowequal/-/shallowequal-2.0.0.tgz", "_shasum": "a3031eb54129f2c66b2753f8404266ec7bf67f0a", "_spec": "@react-dnd/shallowequal@^2.0.0", "_where": "C:\\xampp\\htdocs\\emeraltd\\node_modules\\react-dnd", "author": { "name": "Alberto Leal", "email": "mailforalberto@gmail.com", "url": "github.com/dashed" }, "bugs": { "url": "https://github.com/react-dnd/shallowequal/issues" }, "bundleDependencies": false, "deprecated": false, "description": "Like lodash isEqualWith but for shallow equal.", "devDependencies": { "@types/jest": "^24.0.23", "husky": "^3.1.0", "tsdx": "^0.11.0", "tslib": "^1.10.0", "typescript": "^3.7.2" }, "homepage": "https://github.com/react-dnd/shallowequal#readme", "husky": { "hooks": { "pre-commit": "tsdx lint" } }, "keywords": [ "shallowequal", "shallow", "equal", "isequal", "compare", "isequalwith" ], "license": "MIT", "main": "dist/index.js", "module": "dist/shallowequal.esm.js", "name": "@react-dnd/shallowequal", "peerDependencies": {}, "prettier": { "printWidth": 80, "semi": true, "singleQuote": true, "trailingComma": "es5" }, "repository": { "type": "git", "url": "git+https://github.com/react-dnd/shallowequal.git" }, "scripts": { "build": "tsdx build", "lint": "tsdx lint", "start": "tsdx watch", "test": "tsdx test" }, "typings": "dist/index.d.ts", "version": "2.0.0" } shallowequal/test/shallowequal.spec.ts000064400000010634151701475600014240 0ustar00import { shallowEqual } from '../src/index'; describe('shallowequal', function() { // eslint-disable-next-line no-sparse-arrays const falsey = [, '', 0, false, NaN, null, undefined]; // test cases copied from https://github.com/facebook/fbjs/blob/82247de1c33e6f02a199778203643eaee16ea4dc/src/core/__tests__/shallowEqual-test.js it('returns false if either argument is null', () => { expect(shallowEqual(null, {})).toEqual(false); expect(shallowEqual({}, null)).toEqual(false); }); it('returns true if both arguments are null or undefined', () => { expect(shallowEqual(null, null)).toEqual(true); expect(shallowEqual(undefined, undefined)).toEqual(true); }); it('returns true if arguments are shallow equal', () => { expect(shallowEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2, c: 3 })).toEqual( true ); }); it('returns false if arguments are not objects and not equal', () => { expect(shallowEqual(1, 2)).toEqual(false); }); it('returns false if only one argument is not an object', () => { expect(shallowEqual<any>(1, {})).toEqual(false); }); it('returns false if first argument has too many keys', () => { expect(shallowEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2 })).toEqual(false); }); it('returns false if second argument has too many keys', () => { expect(shallowEqual({ a: 1, b: 2 }, { a: 1, b: 2, c: 3 })).toEqual(false); }); it('returns true if values are not primitives but are ===', () => { let obj = {}; expect( shallowEqual({ a: 1, b: 2, c: obj }, { a: 1, b: 2, c: obj }) ).toEqual(true); }); // subsequent test cases are copied from lodash tests it('returns false if arguments are not shallow equal', () => { expect(shallowEqual({ a: 1, b: 2, c: {} }, { a: 1, b: 2, c: {} })).toEqual( false ); }); it('should provide the correct `customizer` arguments', () => { let argsList: any[] = []; const arry = [1, 2]; const object1: any = { a: arry, b: null }; const object2: any = { a: arry, b: null }; object1.b = object2; object2.b = object1; const expected = [ [object1, object2], [object1.a, object2.a, 'a'], [object1.b, object2.b, 'b'], ]; shallowEqual(object1, object2, function(...args) { argsList.push(args); }); expect(argsList).toEqual(expected); }); it('should set the `this` binding', () => { const actual = shallowEqual( 'a', 'b', function compare(this: any, a, b) { return this[a] === this[b]; }, { a: 1, b: 1 } ); expect(actual).toEqual(true); }); it('should handle comparisons if `customizer` returns `undefined`', () => { const noop = () => void 0; expect(shallowEqual('a', 'a', noop)).toEqual(true); expect(shallowEqual(['a'], ['a'], noop)).toEqual(true); expect(shallowEqual({ '0': 'a' }, { '0': 'a' }, noop)).toEqual(true); }); it('should not handle comparisons if `customizer` returns `true`', () => { const customizer = (value: any) => typeof value === 'string' || undefined; expect(shallowEqual('a', 'b', customizer)).toEqual(true); expect(shallowEqual(['a'], ['b'], customizer)).toEqual(true); expect(shallowEqual({ '0': 'a' }, { '0': 'b' }, customizer)).toEqual(true); }); it('should not handle comparisons if `customizer` returns `false`', () => { const customizer = (value: any) => typeof value === 'string' ? false : undefined; expect(shallowEqual('a', 'a', customizer)).toEqual(false); expect(shallowEqual(['a'], ['a'], customizer)).toEqual(false); expect(shallowEqual({ '0': 'a' }, { '0': 'a' }, customizer)).toEqual(false); }); it('should return a boolean value even if `customizer` does not', () => { let actual = shallowEqual('a', 'b', () => 'c' as any); expect(actual).toEqual(true); const values = falsey.filter(v => v !== undefined); const expected = values.map(() => false); const result: boolean[] = []; values.forEach(value => { result.push(shallowEqual('a', 'a', () => value as any)); }); expect(result).toEqual(expected); }); it('should treat objects created by `Object.create(null)` like any other plain object', () => { class Foo { public a = 1; } const object2 = { a: 1 }; expect(shallowEqual(new Foo(), object2)).toEqual(true); const object1 = Object.create(null); object1.a = 1; expect(shallowEqual(object1, object2)).toEqual(true); }); }); shallowequal/LICENSE000064400000002134151701475600010260 0ustar00MIT License Copyright (c) 2017 Alberto Leal <mailforalberto@gmail.com> (github.com/dashed) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. shallowequal/dist/shallowequal.cjs.development.js.map000064400000005063151701475600017134 0ustar00{"version":3,"file":"shallowequal.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["export function shallowEqual<T>(\n objA: T,\n objB: T,\n compare?: (a: T, b: T, key?: string) => boolean | void,\n compareContext?: any\n) {\n var compareResult = compare\n ? compare.call(compareContext, objA, objB)\n : void 0;\n if (compareResult !== void 0) {\n return !!compareResult;\n }\n\n if (objA === objB) {\n return true;\n }\n\n if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {\n return false;\n }\n\n var keysA = Object.keys(objA);\n var keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);\n\n // Test for A's keys different from B.\n for (var idx = 0; idx < keysA.length; idx++) {\n var key = keysA[idx];\n\n if (!bHasOwnProperty(key)) {\n return false;\n }\n\n var valueA = (objA as any)[key];\n var valueB = (objB as any)[key];\n\n compareResult = compare\n ? compare.call(compareContext, valueA, valueB, key)\n : void 0;\n\n if (\n compareResult === false ||\n (compareResult === void 0 && valueA !== valueB)\n ) {\n return false;\n }\n }\n\n return true;\n}\n"],"names":["shallowEqual","objA","objB","compare","compareContext","compareResult","call","keysA","Object","keys","keysB","length","bHasOwnProperty","prototype","hasOwnProperty","bind","idx","key","valueA","valueB"],"mappings":";;SAAgBA,aACdC,MACAC,MACAC,SACAC;MAEIC,aAAa,GAAGF,OAAO,GACvBA,OAAO,CAACG,IAAR,CAAaF,cAAb,EAA6BH,IAA7B,EAAmCC,IAAnC,CADuB,GAEvB,KAAK,CAFT;;MAGIG,aAAa,KAAK,KAAK,CAA3B,EAA8B;WACrB,CAAC,CAACA,aAAT;;;MAGEJ,IAAI,KAAKC,IAAb,EAAmB;WACV,IAAP;;;MAGE,OAAOD,IAAP,KAAgB,QAAhB,IAA4B,CAACA,IAA7B,IAAqC,OAAOC,IAAP,KAAgB,QAArD,IAAiE,CAACA,IAAtE,EAA4E;WACnE,KAAP;;;MAGEK,KAAK,GAAGC,MAAM,CAACC,IAAP,CAAYR,IAAZ,CAAZ;MACIS,KAAK,GAAGF,MAAM,CAACC,IAAP,CAAYP,IAAZ,CAAZ;;MAEIK,KAAK,CAACI,MAAN,KAAiBD,KAAK,CAACC,MAA3B,EAAmC;WAC1B,KAAP;;;MAGEC,eAAe,GAAGJ,MAAM,CAACK,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCb,IAArC,CAAtB;;OAGK,IAAIc,GAAG,GAAG,CAAf,EAAkBA,GAAG,GAAGT,KAAK,CAACI,MAA9B,EAAsCK,GAAG,EAAzC,EAA6C;QACvCC,GAAG,GAAGV,KAAK,CAACS,GAAD,CAAf;;QAEI,CAACJ,eAAe,CAACK,GAAD,CAApB,EAA2B;aAClB,KAAP;;;QAGEC,MAAM,GAAIjB,IAAY,CAACgB,GAAD,CAA1B;QACIE,MAAM,GAAIjB,IAAY,CAACe,GAAD,CAA1B;IAEAZ,aAAa,GAAGF,OAAO,GACnBA,OAAO,CAACG,IAAR,CAAaF,cAAb,EAA6Bc,MAA7B,EAAqCC,MAArC,EAA6CF,GAA7C,CADmB,GAEnB,KAAK,CAFT;;QAKEZ,aAAa,KAAK,KAAlB,IACCA,aAAa,KAAK,KAAK,CAAvB,IAA4Ba,MAAM,KAAKC,MAF1C,EAGE;aACO,KAAP;;;;SAIG,IAAP;;;;;"}shallowequal/dist/shallowequal.cjs.production.min.js.map000064400000003742151701475600017564 0ustar00{"version":3,"file":"shallowequal.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["export function shallowEqual<T>(\n objA: T,\n objB: T,\n compare?: (a: T, b: T, key?: string) => boolean | void,\n compareContext?: any\n) {\n var compareResult = compare\n ? compare.call(compareContext, objA, objB)\n : void 0;\n if (compareResult !== void 0) {\n return !!compareResult;\n }\n\n if (objA === objB) {\n return true;\n }\n\n if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {\n return false;\n }\n\n var keysA = Object.keys(objA);\n var keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);\n\n // Test for A's keys different from B.\n for (var idx = 0; idx < keysA.length; idx++) {\n var key = keysA[idx];\n\n if (!bHasOwnProperty(key)) {\n return false;\n }\n\n var valueA = (objA as any)[key];\n var valueB = (objB as any)[key];\n\n compareResult = compare\n ? compare.call(compareContext, valueA, valueB, key)\n : void 0;\n\n if (\n compareResult === false ||\n (compareResult === void 0 && valueA !== valueB)\n ) {\n return false;\n }\n }\n\n return true;\n}\n"],"names":["objA","objB","compare","compareContext","compareResult","call","keysA","Object","keys","keysB","length","bHasOwnProperty","prototype","hasOwnProperty","bind","idx","key","valueA","valueB"],"mappings":"2CACEA,EACAC,EACAC,EACAC,OAEIC,EAAgBF,EAChBA,EAAQG,KAAKF,EAAgBH,EAAMC,QACnC,UACkB,IAAlBG,UACOA,KAGPJ,IAASC,SACJ,KAGW,iBAATD,IAAsBA,GAAwB,iBAATC,IAAsBA,SAC7D,MAGLK,EAAQC,OAAOC,KAAKR,GACpBS,EAAQF,OAAOC,KAAKP,MAEpBK,EAAMI,SAAWD,EAAMC,cAClB,UAGLC,EAAkBJ,OAAOK,UAAUC,eAAeC,KAAKb,GAGlDc,EAAM,EAAGA,EAAMT,EAAMI,OAAQK,IAAO,KACvCC,EAAMV,EAAMS,OAEXJ,EAAgBK,UACZ,MAGLC,EAAUjB,EAAagB,GACvBE,EAAUjB,EAAae,OAOP,KALpBZ,EAAgBF,EACZA,EAAQG,KAAKF,EAAgBc,EAAQC,EAAQF,QAC7C,SAIiB,IAAlBZ,GAA4Ba,IAAWC,SAEjC,SAIJ"}shallowequal/dist/test/shallowequal.spec.d.ts000064400000000014151701475600015414 0ustar00export {}; shallowequal/dist/shallowequal.cjs.production.min.js000064400000000771151701475600017007 0ustar00"use strict";exports.shallowEqual=function(r,t,e,o){var n=e?e.call(o,r,t):void 0;if(void 0!==n)return!!n;if(r===t)return!0;if("object"!=typeof r||!r||"object"!=typeof t||!t)return!1;var i=Object.keys(r),a=Object.keys(t);if(i.length!==a.length)return!1;for(var f=Object.prototype.hasOwnProperty.bind(t),l=0;l<i.length;l++){var u=i[l];if(!f(u))return!1;var c=r[u],v=t[u];if(!1===(n=e?e.call(o,c,v,u):void 0)||void 0===n&&c!==v)return!1}return!0}; //# sourceMappingURL=shallowequal.cjs.production.min.js.map shallowequal/dist/index.js000064400000000312151701475600011657 0ustar00 'use strict' if (process.env.NODE_ENV === 'production') { module.exports = require('./shallowequal.cjs.production.min.js') } else { module.exports = require('./shallowequal.cjs.development.js') } shallowequal/dist/shallowequal.esm.js000064400000002073151701475600014042 0ustar00function shallowEqual(objA, objB, compare, compareContext) { var compareResult = compare ? compare.call(compareContext, objA, objB) : void 0; if (compareResult !== void 0) { return !!compareResult; } if (objA === objB) { return true; } if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) { return false; } var keysA = Object.keys(objA); var keysB = Object.keys(objB); if (keysA.length !== keysB.length) { return false; } var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); // Test for A's keys different from B. for (var idx = 0; idx < keysA.length; idx++) { var key = keysA[idx]; if (!bHasOwnProperty(key)) { return false; } var valueA = objA[key]; var valueB = objB[key]; compareResult = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; if (compareResult === false || compareResult === void 0 && valueA !== valueB) { return false; } } return true; } export { shallowEqual }; //# sourceMappingURL=shallowequal.esm.js.map shallowequal/dist/shallowequal.cjs.development.js000064400000002142151701475600016353 0ustar00'use strict'; function shallowEqual(objA, objB, compare, compareContext) { var compareResult = compare ? compare.call(compareContext, objA, objB) : void 0; if (compareResult !== void 0) { return !!compareResult; } if (objA === objB) { return true; } if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) { return false; } var keysA = Object.keys(objA); var keysB = Object.keys(objB); if (keysA.length !== keysB.length) { return false; } var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); // Test for A's keys different from B. for (var idx = 0; idx < keysA.length; idx++) { var key = keysA[idx]; if (!bHasOwnProperty(key)) { return false; } var valueA = objA[key]; var valueB = objB[key]; compareResult = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; if (compareResult === false || compareResult === void 0 && valueA !== valueB) { return false; } } return true; } exports.shallowEqual = shallowEqual; //# sourceMappingURL=shallowequal.cjs.development.js.map shallowequal/dist/shallowequal.esm.js.map000064400000005045151701475600014620 0ustar00{"version":3,"file":"shallowequal.esm.js","sources":["../src/index.ts"],"sourcesContent":["export function shallowEqual<T>(\n objA: T,\n objB: T,\n compare?: (a: T, b: T, key?: string) => boolean | void,\n compareContext?: any\n) {\n var compareResult = compare\n ? compare.call(compareContext, objA, objB)\n : void 0;\n if (compareResult !== void 0) {\n return !!compareResult;\n }\n\n if (objA === objB) {\n return true;\n }\n\n if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {\n return false;\n }\n\n var keysA = Object.keys(objA);\n var keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);\n\n // Test for A's keys different from B.\n for (var idx = 0; idx < keysA.length; idx++) {\n var key = keysA[idx];\n\n if (!bHasOwnProperty(key)) {\n return false;\n }\n\n var valueA = (objA as any)[key];\n var valueB = (objB as any)[key];\n\n compareResult = compare\n ? compare.call(compareContext, valueA, valueB, key)\n : void 0;\n\n if (\n compareResult === false ||\n (compareResult === void 0 && valueA !== valueB)\n ) {\n return false;\n }\n }\n\n return true;\n}\n"],"names":["shallowEqual","objA","objB","compare","compareContext","compareResult","call","keysA","Object","keys","keysB","length","bHasOwnProperty","prototype","hasOwnProperty","bind","idx","key","valueA","valueB"],"mappings":"SAAgBA,aACdC,MACAC,MACAC,SACAC;MAEIC,aAAa,GAAGF,OAAO,GACvBA,OAAO,CAACG,IAAR,CAAaF,cAAb,EAA6BH,IAA7B,EAAmCC,IAAnC,CADuB,GAEvB,KAAK,CAFT;;MAGIG,aAAa,KAAK,KAAK,CAA3B,EAA8B;WACrB,CAAC,CAACA,aAAT;;;MAGEJ,IAAI,KAAKC,IAAb,EAAmB;WACV,IAAP;;;MAGE,OAAOD,IAAP,KAAgB,QAAhB,IAA4B,CAACA,IAA7B,IAAqC,OAAOC,IAAP,KAAgB,QAArD,IAAiE,CAACA,IAAtE,EAA4E;WACnE,KAAP;;;MAGEK,KAAK,GAAGC,MAAM,CAACC,IAAP,CAAYR,IAAZ,CAAZ;MACIS,KAAK,GAAGF,MAAM,CAACC,IAAP,CAAYP,IAAZ,CAAZ;;MAEIK,KAAK,CAACI,MAAN,KAAiBD,KAAK,CAACC,MAA3B,EAAmC;WAC1B,KAAP;;;MAGEC,eAAe,GAAGJ,MAAM,CAACK,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCb,IAArC,CAAtB;;OAGK,IAAIc,GAAG,GAAG,CAAf,EAAkBA,GAAG,GAAGT,KAAK,CAACI,MAA9B,EAAsCK,GAAG,EAAzC,EAA6C;QACvCC,GAAG,GAAGV,KAAK,CAACS,GAAD,CAAf;;QAEI,CAACJ,eAAe,CAACK,GAAD,CAApB,EAA2B;aAClB,KAAP;;;QAGEC,MAAM,GAAIjB,IAAY,CAACgB,GAAD,CAA1B;QACIE,MAAM,GAAIjB,IAAY,CAACe,GAAD,CAA1B;IAEAZ,aAAa,GAAGF,OAAO,GACnBA,OAAO,CAACG,IAAR,CAAaF,cAAb,EAA6Bc,MAA7B,EAAqCC,MAArC,EAA6CF,GAA7C,CADmB,GAEnB,KAAK,CAFT;;QAKEZ,aAAa,KAAK,KAAlB,IACCA,aAAa,KAAK,KAAK,CAAvB,IAA4Ba,MAAM,KAAKC,MAF1C,EAGE;aACO,KAAP;;;;SAIG,IAAP;;;;;"}shallowequal/dist/index.d.ts000064400000000223151701475600012114 0ustar00export declare function shallowEqual<T>(objA: T, objB: T, compare?: (a: T, b: T, key?: string) => boolean | void, compareContext?: any): boolean; shallowequal/README.md000064400000004172151701475600010536 0ustar00# shallowequal [](https://travis-ci.org/dashed/shallowequal) [](https://npmjs.com/shallowequal) [](https://www.npmjs.com/package/shallowequal) > `shallowequal` is like lodash's [`isEqual`](https://lodash.com/docs/3.10.1#isEqual) (v3.10.1) but for shallow (strict) equal. `shallowequal(value, other, [customizer], [thisArg])` Performs a **_shallow equality_** comparison between two values (i.e. `value` and `other`) to determine if they are equivalent. The equality check returns true if `value` and `other` are already strictly equal, OR when all the following are true: - `value` and `other` are both objects with the same keys - For each key, the value in `value` and `other` are **strictly equal** (`===`) If `customizer` (expected to be a function) is provided it is invoked to compare values. If `customizer` returns `undefined` (i.e. `void 0`), then comparisons are handled by the `shallowequal` function instead. The `customizer` is bound to `thisArg` and invoked with three arguments: `(value, other, key)`. **NOTE:** Docs are (shamelessly) adapted from [lodash's v3.x docs](https://lodash.com/docs/3.10.1#isEqual) ## Install ```sh $ yarn add shallowequal # npm v5+ $ npm install shallowequal # before npm v5 $ npm install --save shallowequal ``` ## Usage ```js const shallowequal = require("shallowequal"); const object = { user: "fred" }; const other = { user: "fred" }; object == other; // → false shallowequal(object, other); // → true ``` ## Credit Code for `shallowEqual` originated from https://github.com/gaearon/react-pure-render/ and has since been refactored to have the exact same API as `lodash.isEqualWith` (as of `v4.17.4`). ## Development - `node.js` and `npm`. See: https://github.com/creationix/nvm#installation - `yarn`. See: https://yarnpkg.com/en/docs/install - `npm` dependencies. Run: `yarn install` ### Chores - Lint: `yarn lint` - Test: `yarn test` - Pretty: `yarn pretty` - Prepare: `yarn prepare` ## License MIT. shallowequal/tsconfig.json000064400000001344151701475600011764 0ustar00{ "include": ["src", "types", "test"], "compilerOptions": { "target": "es5", "module": "esnext", "lib": ["dom", "esnext"], "importHelpers": true, "declaration": true, "sourceMap": true, "rootDir": "./", "strict": true, "noImplicitAny": true, "strictNullChecks": true, "strictFunctionTypes": true, "strictPropertyInitialization": true, "noImplicitThis": true, "alwaysStrict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "moduleResolution": "node", "baseUrl": "./", "paths": { "*": ["src/*", "node_modules/*"] }, "jsx": "react", "esModuleInterop": true } } shallowequal/.github/workflows/nodejs.yml000064400000000743151701475600014661 0ustar00name: Node CI on: [push, pull_request] jobs: build: runs-on: ubuntu-latest strategy: matrix: node-version: [8.x, 10.x, 12.x] steps: - uses: actions/checkout@v1 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - name: npm install, build, and test run: | yarn install yarn build yarn test env: CI: true asap/src/AsapQueue.ts000064400000015575151701475600010543 0ustar00/* eslint-disable no-restricted-globals, @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unused-vars, @typescript-eslint/no-non-null-assertion */ import type { Task } from './types.js' import { makeRequestCall, makeRequestCallFromTimer } from './makeRequestCall.js' export class AsapQueue { private queue: Task[] = [] // We queue errors to ensure they are thrown in right order (FIFO). // Array-as-queue is good enough here, since we are just dealing with exceptions. private pendingErrors: any[] = [] // Once a flush has been requested, no further calls to `requestFlush` are // necessary until the next `flush` completes. // @ts-ignore private flushing = false // `requestFlush` is an implementation-specific method that attempts to kick // off a `flush` event as quickly as possible. `flush` will attempt to exhaust // the event queue before yielding to the browser's own event loop. private requestFlush: () => void private requestErrorThrow: () => void // The position of the next task to execute in the task queue. This is // preserved between calls to `flush` so that it can be resumed if // a task throws an exception. private index = 0 // If a task schedules additional tasks recursively, the task queue can grow // unbounded. To prevent memory exhaustion, the task queue will periodically // truncate already-completed tasks. private capacity = 1024 public constructor() { // `requestFlush` requests that the high priority event queue be flushed as // soon as possible. // This is useful to prevent an error thrown in a task from stalling the event // queue if the exception handled by Node.js’s // `process.on("uncaughtException")` or by a domain. // `requestFlush` is implemented using a strategy based on data collected from // every available SauceLabs Selenium web driver worker at time of writing. // https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593 this.requestFlush = makeRequestCall(this.flush) this.requestErrorThrow = makeRequestCallFromTimer(() => { // Throw first error if (this.pendingErrors.length) { throw this.pendingErrors.shift() } }) } // Use the fastest means possible to execute a task in its own turn, with // priority over other events including IO, animation, reflow, and redraw // events in browsers. // // An exception thrown by a task will permanently interrupt the processing of // subsequent tasks. The higher level `asap` function ensures that if an // exception is thrown by a task, that the task queue will continue flushing as // soon as possible, but if you use `rawAsap` directly, you are responsible to // either ensure that no exceptions are thrown from your task, or to manually // call `rawAsap.requestFlush` if an exception is thrown. public enqueueTask(task: Task): void { const { queue: q, requestFlush } = this if (!q.length) { requestFlush() this.flushing = true } // Equivalent to push, but avoids a function call. q[q.length] = task } // The flush function processes all tasks that have been scheduled with // `rawAsap` unless and until one of those tasks throws an exception. // If a task throws an exception, `flush` ensures that its state will remain // consistent and will resume where it left off when called again. // However, `flush` does not make any arrangements to be called again if an // exception is thrown. private flush = () => { const { queue: q } = this while (this.index < q.length) { const currentIndex = this.index // Advance the index before calling the task. This ensures that we will // begin flushing on the next task the task throws an error. this.index++ q[currentIndex]!.call() // Prevent leaking memory for long chains of recursive calls to `asap`. // If we call `asap` within tasks scheduled by `asap`, the queue will // grow, but to avoid an O(n) walk for every task we execute, we don't // shift tasks off the queue after they have been executed. // Instead, we periodically shift 1024 tasks off the queue. if (this.index > this.capacity) { // Manually shift all values starting at the index back to the // beginning of the queue. for ( let scan = 0, newLength = q.length - this.index; scan < newLength; scan++ ) { q[scan] = q[scan + this.index]! } q.length -= this.index this.index = 0 } } q.length = 0 this.index = 0 this.flushing = false } // In a web browser, exceptions are not fatal. However, to avoid // slowing down the queue of pending tasks, we rethrow the error in a // lower priority turn. public registerPendingError = (err: any) => { this.pendingErrors.push(err) this.requestErrorThrow() } } // The message channel technique was discovered by Malte Ubl and was the // original foundation for this library. // http://www.nonblocking.io/2011/06/windownexttick.html // Safari 6.0.5 (at least) intermittently fails to create message ports on a // page's first load. Thankfully, this version of Safari supports // MutationObservers, so we don't need to fall back in that case. // function makeRequestCallFromMessageChannel(callback) { // var channel = new MessageChannel(); // channel.port1.onmessage = callback; // return function requestCall() { // channel.port2.postMessage(0); // }; // } // For reasons explained above, we are also unable to use `setImmediate` // under any circumstances. // Even if we were, there is another bug in Internet Explorer 10. // It is not sufficient to assign `setImmediate` to `requestFlush` because // `setImmediate` must be called *by name* and therefore must be wrapped in a // closure. // Never forget. // function makeRequestCallFromSetImmediate(callback) { // return function requestCall() { // setImmediate(callback); // }; // } // Safari 6.0 has a problem where timers will get lost while the user is // scrolling. This problem does not impact ASAP because Safari 6.0 supports // mutation observers, so that implementation is used instead. // However, if we ever elect to use timers in Safari, the prevalent work-around // is to add a scroll event listener that calls for a flush. // `setTimeout` does not call the passed callback if the delay is less than // approximately 7 in web workers in Firefox 8 through 18, and sometimes not // even then. // This is for `asap.js` only. // Its name will be periodically randomized to break any code that depends on // // its existence. // rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer // ASAP was originally a nextTick shim included in Q. This was factored out // into this ASAP package. It was later adapted to RSVP which made further // amendments. These decisions, particularly to marginalize MessageChannel and // to capture the MutationObserver implementation in a closure, were integrated // back into ASAP proper. // https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js asap/src/types.ts000064400000000110151701475600007771 0ustar00export interface Task { call(): void } export type TaskFn = () => void asap/src/TaskFactory.ts000064400000000653151701475610011074 0ustar00import type { Task } from './types.js' import { RawTask } from './RawTask.js' export class TaskFactory { private freeTasks: RawTask[] = [] public constructor(private onError: (err: any) => void) {} public create(task: () => void): Task { const tasks = this.freeTasks const t = tasks.length ? (tasks.pop() as RawTask) : new RawTask(this.onError, (t) => (tasks[tasks.length] = t)) t.task = task return t } } asap/src/RawTask.ts000064400000000756151701475610010222 0ustar00// We wrap tasks with recyclable task objects. A task object implements import type { TaskFn, Task } from 'types' // `call`, just like a function. export class RawTask implements Task { public task: TaskFn | null = null public constructor( private onError: (err: any) => void, private release: (t: RawTask) => void, ) {} public call() { try { this.task && this.task() } catch (error) { this.onError(error) } finally { this.task = null this.release(this) } } } asap/src/index.ts000064400000000165151701475610007747 0ustar00export * from './asap.js' export * from './types.js' export * from './AsapQueue.js' export * from './TaskFactory.js' asap/src/asap.ts000064400000001347151701475610007567 0ustar00import { AsapQueue } from './AsapQueue.js' import { TaskFactory } from './TaskFactory.js' import type { TaskFn } from './types.js' const asapQueue = new AsapQueue() const taskFactory = new TaskFactory(asapQueue.registerPendingError) /** * Calls a task as soon as possible after returning, in its own event, with priority * over other events like animation, reflow, and repaint. An error thrown from an * event will not interrupt, nor even substantially slow down the processing of * other events, but will be rather postponed to a lower priority event. * @param {{call}} task A callable object, typically a function that takes no * arguments. */ export function asap(task: TaskFn) { asapQueue.enqueueTask(taskFactory.create(task)) } asap/src/makeRequestCall.ts000064400000007075151701475610011731 0ustar00// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that // have WebKitMutationObserver but not un-prefixed MutationObserver. // Must use `global` or `self` instead of `window` to work in both frames and web // workers. `global` is a provision of Browserify, Mr, Mrs, or Mop. /* globals self */ const scope = typeof global !== 'undefined' ? global : self const BrowserMutationObserver = (scope as any).MutationObserver || (scope as any).WebKitMutationObserver export function makeRequestCallFromTimer(callback: () => void) { return function requestCall() { // We dispatch a timeout with a specified delay of 0 for engines that // can reliably accommodate that request. This will usually be snapped // to a 4 milisecond delay, but once we're flushing, there's no delay // between events. const timeoutHandle = setTimeout(handleTimer, 0) // However, since this timer gets frequently dropped in Firefox // workers, we enlist an interval handle that will try to fire // an event 20 times per second until it succeeds. const intervalHandle = setInterval(handleTimer, 50) function handleTimer() { // Whichever timer succeeds will cancel both timers and // execute the callback. clearTimeout(timeoutHandle) clearInterval(intervalHandle) callback() } } } // To request a high priority event, we induce a mutation observer by toggling // the text of a text node between "1" and "-1". export function makeRequestCallFromMutationObserver(callback: () => void) { let toggle = 1 const observer = new BrowserMutationObserver(callback) const node = document.createTextNode('') observer.observe(node, { characterData: true }) return function requestCall() { toggle = -toggle ;(node as any).data = toggle } } export const makeRequestCall = typeof BrowserMutationObserver === 'function' ? // MutationObservers are desirable because they have high priority and work // reliably everywhere they are implemented. // They are implemented in all modern browsers. // // - Android 4-4.3 // - Chrome 26-34 // - Firefox 14-29 // - Internet Explorer 11 // - iPad Safari 6-7.1 // - iPhone Safari 7-7.1 // - Safari 6-7 makeRequestCallFromMutationObserver : // MessageChannels are desirable because they give direct access to the HTML // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera // 11-12, and in web workers in many engines. // Although message channels yield to any queued rendering and IO tasks, they // would be better than imposing the 4ms delay of timers. // However, they do not work reliably in Internet Explorer or Safari. // Internet Explorer 10 is the only browser that has setImmediate but does // not have MutationObservers. // Although setImmediate yields to the browser's renderer, it would be // preferrable to falling back to setTimeout since it does not have // the minimum 4ms penalty. // Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and // Desktop to a lesser extent) that renders both setImmediate and // MessageChannel useless for the purposes of ASAP. // https://github.com/kriskowal/q/issues/396 // Timers are implemented universally. // We fall back to timers in workers in most engines, and in foreground // contexts in the following browsers. // However, note that even this simple case requires nuances to operate in a // broad spectrum of browsers. // // - Firefox 3-13 // - Internet Explorer 6-9 // - iPad Safari 4.3 // - Lynx 2.8.7 makeRequestCallFromTimer asap/package.json000064400000004017151701475610007767 0ustar00{ "_from": "@react-dnd/asap@^4.0.0", "_id": "@react-dnd/asap@4.0.1", "_inBundle": false, "_integrity": "sha512-kLy0PJDDwvwwTXxqTFNAAllPHD73AycE9ypWeln/IguoGBEbvFcPDbCV03G52bEcC5E+YgupBE0VzHGdC8SIXg==", "_location": "/@react-dnd/asap", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "@react-dnd/asap@^4.0.0", "name": "@react-dnd/asap", "escapedName": "@react-dnd%2fasap", "scope": "@react-dnd", "rawSpec": "^4.0.0", "saveSpec": null, "fetchSpec": "^4.0.0" }, "_requiredBy": [ "/dnd-core" ], "_resolved": "https://registry.npmjs.org/@react-dnd/asap/-/asap-4.0.1.tgz", "_shasum": "5291850a6b58ce6f2da25352a64f1b0674871aab", "_spec": "@react-dnd/asap@^4.0.0", "_where": "C:\\xampp\\htdocs\\emeraltd\\node_modules\\dnd-core", "bugs": { "url": "https://github.com/react-dnd/react-dnd/issues" }, "bundleDependencies": false, "deprecated": false, "description": "High-priority task queue for Node.js and browsers", "devDependencies": { "@swc/cli": "^0.1.57", "@swc/core": "^1.2.161", "@types/jest": "^24.9.1", "@types/node": "^17.0.23", "npm-run-all": "^4.1.5", "shx": "^0.3.4", "typescript": "^4.6.3" }, "exports": { "import": "./dist/esm/index.mjs", "require": "./dist/cjs/index.js", "types": "./dist/types/index.d.ts" }, "homepage": "https://github.com/react-dnd/react-dnd#readme", "keywords": [ "event", "task", "queue" ], "license": "MIT", "main": "dist/cjs/index.js", "name": "@react-dnd/asap", "repository": { "type": "git", "url": "git+https://github.com/react-dnd/react-dnd.git" }, "scripts": { "build": "run-s build_types build_esm build_cjs esm_hack", "build_cjs": "swc -C module.type=commonjs -d dist/cjs src/", "build_esm": "swc -C module.type=es6 -d dist/esm src/", "build_types": "tsc -b .", "clean": "shx rm -rf dist/", "esm_hack": "node ../../scripts/esmify.mjs" }, "types": "dist/types/index.d.ts", "version": "4.0.1" } asap/CHANGES.md000064400000005520151701475610007073 0ustar00## 2.0.6 Version 2.0.4 adds support for React Native by clarifying in package.json that the browser environment does not support Node.js domains. Why this is necessary, we leave as an exercise for the user. ## 2.0.3 Version 2.0.3 fixes a bug when adjusting the capacity of the task queue. ## 2.0.1-2.02 Version 2.0.1 fixes a bug in the way redirects were expressed that affected the function of Browserify, but which Mr would tolerate. ## 2.0.0 Version 2 of ASAP is a full rewrite with a few salient changes. First, the ASAP source is CommonJS only and designed with [Browserify][] and [Browserify-compatible][mr] module loaders in mind. [browserify]: https://github.com/substack/node-browserify [mr]: https://github.com/montagejs/mr The new version has been refactored in two dimensions. Support for Node.js and browsers have been separated, using Browserify redirects and ASAP has been divided into two modules. The "raw" layer depends on the tasks to catch thrown exceptions and unravel Node.js domains. The full implementation of ASAP is loadable as `require("asap")` in both Node.js and browsers. The raw layer that lacks exception handling overhead is loadable as `require("asap/raw")`. The interface is the same for both layers. Tasks are no longer required to be functions, but can rather be any object that implements `task.call()`. With this feature you can recycle task objects to avoid garbage collector churn and avoid closures in general. The implementation has been rigorously documented so that our successors can understand the scope of the problem that this module solves and all of its nuances, ensuring that the next generation of implementations know what details are essential. - [asap.js](https://github.com/kriskowal/asap/blob/master/asap.js) - [raw.js](https://github.com/kriskowal/asap/blob/master/raw.js) - [browser-asap.js](https://github.com/kriskowal/asap/blob/master/browser-asap.js) - [browser-raw.js](https://github.com/kriskowal/asap/blob/master/browser-raw.js) The new version has also been rigorously tested across a broad spectrum of browsers, in both the window and worker context. The following charts capture the browser test results for the most recent release. The first chart shows test results for ASAP running in the main window context. The second chart shows test results for ASAP running in a web worker context. Test results are inconclusive (grey) on browsers that do not support web workers. These data are captured automatically by [Continuous Integration][].   [continuous integration]: https://github.com/kriskowal/asap/blob/master/CONTRIBUTING.md asap/dist/types/makeRequestCall.d.ts000064400000000405151701475610013461 0ustar00export declare function makeRequestCallFromTimer(callback: () => void): () => void; export declare function makeRequestCallFromMutationObserver(callback: () => void): () => void; export declare const makeRequestCall: typeof makeRequestCallFromMutationObserver; asap/dist/types/asap.d.ts000064400000001000151701475610011313 0ustar00import type { TaskFn } from './types.js'; /** * Calls a task as soon as possible after returning, in its own event, with priority * over other events like animation, reflow, and repaint. An error thrown from an * event will not interrupt, nor even substantially slow down the processing of * other events, but will be rather postponed to a lower priority event. * @param {{call}} task A callable object, typically a function that takes no * arguments. */ export declare function asap(task: TaskFn): void; asap/dist/types/RawTask.d.ts000064400000000376151701475610011762 0ustar00import type { TaskFn, Task } from 'types'; export declare class RawTask implements Task { private onError; private release; task: TaskFn | null; constructor(onError: (err: any) => void, release: (t: RawTask) => void); call(): void; } asap/dist/types/AsapQueue.d.ts000064400000000550151701475610012271 0ustar00import type { Task } from './types.js'; export declare class AsapQueue { private queue; private pendingErrors; private flushing; private requestFlush; private requestErrorThrow; private index; private capacity; constructor(); enqueueTask(task: Task): void; private flush; registerPendingError: (err: any) => void; } asap/dist/types/TaskFactory.d.ts000064400000000313151701475610012627 0ustar00import type { Task } from './types.js'; export declare class TaskFactory { private onError; private freeTasks; constructor(onError: (err: any) => void); create(task: () => void): Task; } asap/dist/types/index.d.ts000064400000000171151701475610011506 0ustar00export * from './asap.js'; export * from './types.js'; export * from './AsapQueue.js'; export * from './TaskFactory.js'; asap/dist/types/types.d.ts000064400000000125151701475610011542 0ustar00export interface Task { call(): void; } export declare type TaskFn = () => void; asap/dist/cjs/AsapQueue.js.map000064400000024615151701475610012234 0ustar00{"version":3,"sources":["../../src/AsapQueue.ts"],"sourcesContent":["/* eslint-disable no-restricted-globals, @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unused-vars, @typescript-eslint/no-non-null-assertion */\nimport type { Task } from './types.js'\nimport { makeRequestCall, makeRequestCallFromTimer } from './makeRequestCall.js'\n\nexport class AsapQueue {\n\tprivate queue: Task[] = []\n\t// We queue errors to ensure they are thrown in right order (FIFO).\n\t// Array-as-queue is good enough here, since we are just dealing with exceptions.\n\tprivate pendingErrors: any[] = []\n\t// Once a flush has been requested, no further calls to `requestFlush` are\n\t// necessary until the next `flush` completes.\n\t// @ts-ignore\n\tprivate flushing = false\n\t// `requestFlush` is an implementation-specific method that attempts to kick\n\t// off a `flush` event as quickly as possible. `flush` will attempt to exhaust\n\t// the event queue before yielding to the browser's own event loop.\n\tprivate requestFlush: () => void\n\n\tprivate requestErrorThrow: () => void\n\t// The position of the next task to execute in the task queue. This is\n\t// preserved between calls to `flush` so that it can be resumed if\n\t// a task throws an exception.\n\tprivate index = 0\n\t// If a task schedules additional tasks recursively, the task queue can grow\n\t// unbounded. To prevent memory exhaustion, the task queue will periodically\n\t// truncate already-completed tasks.\n\tprivate capacity = 1024\n\n\tpublic constructor() {\n\t\t// `requestFlush` requests that the high priority event queue be flushed as\n\t\t// soon as possible.\n\t\t// This is useful to prevent an error thrown in a task from stalling the event\n\t\t// queue if the exception handled by Node.js’s\n\t\t// `process.on(\"uncaughtException\")` or by a domain.\n\n\t\t// `requestFlush` is implemented using a strategy based on data collected from\n\t\t// every available SauceLabs Selenium web driver worker at time of writing.\n\t\t// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593\n\t\tthis.requestFlush = makeRequestCall(this.flush)\n\t\tthis.requestErrorThrow = makeRequestCallFromTimer(() => {\n\t\t\t// Throw first error\n\t\t\tif (this.pendingErrors.length) {\n\t\t\t\tthrow this.pendingErrors.shift()\n\t\t\t}\n\t\t})\n\t}\n\n\t// Use the fastest means possible to execute a task in its own turn, with\n\t// priority over other events including IO, animation, reflow, and redraw\n\t// events in browsers.\n\t//\n\t// An exception thrown by a task will permanently interrupt the processing of\n\t// subsequent tasks. The higher level `asap` function ensures that if an\n\t// exception is thrown by a task, that the task queue will continue flushing as\n\t// soon as possible, but if you use `rawAsap` directly, you are responsible to\n\t// either ensure that no exceptions are thrown from your task, or to manually\n\t// call `rawAsap.requestFlush` if an exception is thrown.\n\tpublic enqueueTask(task: Task): void {\n\t\tconst { queue: q, requestFlush } = this\n\t\tif (!q.length) {\n\t\t\trequestFlush()\n\t\t\tthis.flushing = true\n\t\t}\n\t\t// Equivalent to push, but avoids a function call.\n\t\tq[q.length] = task\n\t}\n\n\t// The flush function processes all tasks that have been scheduled with\n\t// `rawAsap` unless and until one of those tasks throws an exception.\n\t// If a task throws an exception, `flush` ensures that its state will remain\n\t// consistent and will resume where it left off when called again.\n\t// However, `flush` does not make any arrangements to be called again if an\n\t// exception is thrown.\n\tprivate flush = () => {\n\t\tconst { queue: q } = this\n\t\twhile (this.index < q.length) {\n\t\t\tconst currentIndex = this.index\n\t\t\t// Advance the index before calling the task. This ensures that we will\n\t\t\t// begin flushing on the next task the task throws an error.\n\t\t\tthis.index++\n\t\t\tq[currentIndex]!.call()\n\t\t\t// Prevent leaking memory for long chains of recursive calls to `asap`.\n\t\t\t// If we call `asap` within tasks scheduled by `asap`, the queue will\n\t\t\t// grow, but to avoid an O(n) walk for every task we execute, we don't\n\t\t\t// shift tasks off the queue after they have been executed.\n\t\t\t// Instead, we periodically shift 1024 tasks off the queue.\n\t\t\tif (this.index > this.capacity) {\n\t\t\t\t// Manually shift all values starting at the index back to the\n\t\t\t\t// beginning of the queue.\n\t\t\t\tfor (\n\t\t\t\t\tlet scan = 0, newLength = q.length - this.index;\n\t\t\t\t\tscan < newLength;\n\t\t\t\t\tscan++\n\t\t\t\t) {\n\t\t\t\t\tq[scan] = q[scan + this.index]!\n\t\t\t\t}\n\t\t\t\tq.length -= this.index\n\t\t\t\tthis.index = 0\n\t\t\t}\n\t\t}\n\t\tq.length = 0\n\t\tthis.index = 0\n\t\tthis.flushing = false\n\t}\n\n\t// In a web browser, exceptions are not fatal. However, to avoid\n\t// slowing down the queue of pending tasks, we rethrow the error in a\n\t// lower priority turn.\n\tpublic registerPendingError = (err: any) => {\n\t\tthis.pendingErrors.push(err)\n\t\tthis.requestErrorThrow()\n\t}\n}\n\n// The message channel technique was discovered by Malte Ubl and was the\n// original foundation for this library.\n// http://www.nonblocking.io/2011/06/windownexttick.html\n\n// Safari 6.0.5 (at least) intermittently fails to create message ports on a\n// page's first load. Thankfully, this version of Safari supports\n// MutationObservers, so we don't need to fall back in that case.\n\n// function makeRequestCallFromMessageChannel(callback) {\n// var channel = new MessageChannel();\n// channel.port1.onmessage = callback;\n// return function requestCall() {\n// channel.port2.postMessage(0);\n// };\n// }\n\n// For reasons explained above, we are also unable to use `setImmediate`\n// under any circumstances.\n// Even if we were, there is another bug in Internet Explorer 10.\n// It is not sufficient to assign `setImmediate` to `requestFlush` because\n// `setImmediate` must be called *by name* and therefore must be wrapped in a\n// closure.\n// Never forget.\n\n// function makeRequestCallFromSetImmediate(callback) {\n// return function requestCall() {\n// setImmediate(callback);\n// };\n// }\n\n// Safari 6.0 has a problem where timers will get lost while the user is\n// scrolling. This problem does not impact ASAP because Safari 6.0 supports\n// mutation observers, so that implementation is used instead.\n// However, if we ever elect to use timers in Safari, the prevalent work-around\n// is to add a scroll event listener that calls for a flush.\n\n// `setTimeout` does not call the passed callback if the delay is less than\n// approximately 7 in web workers in Firefox 8 through 18, and sometimes not\n// even then.\n\n// This is for `asap.js` only.\n// Its name will be periodically randomized to break any code that depends on\n// // its existence.\n// rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer\n\n// ASAP was originally a nextTick shim included in Q. This was factored out\n// into this ASAP package. It was later adapted to RSVP which made further\n// amendments. These decisions, particularly to marginalize MessageChannel and\n// to capture the MutationObserver implementation in a closure, were integrated\n// back into ASAP proper.\n// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js\n"],"names":["AsapQueue","enqueueTask","task","queue","q","requestFlush","length","flushing","pendingErrors","index","capacity","flush","currentIndex","call","scan","newLength","registerPendingError","err","push","requestErrorThrow","makeRequestCall","makeRequestCallFromTimer","shift"],"mappings":"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"}asap/dist/cjs/asap.js.map000064400000002376151701475610011267 0ustar00{"version":3,"sources":["../../src/asap.ts"],"sourcesContent":["import { AsapQueue } from './AsapQueue.js'\nimport { TaskFactory } from './TaskFactory.js'\nimport type { TaskFn } from './types.js'\n\nconst asapQueue = new AsapQueue()\nconst taskFactory = new TaskFactory(asapQueue.registerPendingError)\n\n/**\n * Calls a task as soon as possible after returning, in its own event, with priority\n * over other events like animation, reflow, and repaint. An error thrown from an\n * event will not interrupt, nor even substantially slow down the processing of\n * other events, but will be rather postponed to a lower priority event.\n * @param {{call}} task A callable object, typically a function that takes no\n * arguments.\n */\nexport function asap(task: TaskFn) {\n\tasapQueue.enqueueTask(taskFactory.create(task))\n}\n"],"names":["asap","asapQueue","AsapQueue","taskFactory","TaskFactory","registerPendingError","task","enqueueTask","create"],"mappings":"AAAA;;;;QAegBA,IAAI,GAAJA,IAAI;AAfM,IAAA,YAAgB,WAAhB,gBAAgB,CAAA;AACd,IAAA,cAAkB,WAAlB,kBAAkB,CAAA;AAG9C,MAAMC,SAAS,GAAG,IAAIC,YAAS,UAAA,EAAE;AACjC,MAAMC,WAAW,GAAG,IAAIC,cAAW,YAAA,CAACH,SAAS,CAACI,oBAAoB,CAAC;AAU5D,SAASL,IAAI,CAACM,IAAY,EAAE;IAClCL,SAAS,CAACM,WAAW,CAACJ,WAAW,CAACK,MAAM,CAACF,IAAI,CAAC,CAAC;CAC/C"}asap/dist/cjs/types.js.map000064400000000256151701475610011502 0ustar00{"version":3,"sources":["../../src/types.ts"],"sourcesContent":["export interface Task {\n\tcall(): void\n}\nexport type TaskFn = () => void\n"],"names":[],"mappings":"AAAA"}asap/dist/cjs/types.js000064400000000163151701475610010723 0ustar00"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); //# sourceMappingURL=types.js.mapasap/dist/cjs/makeRequestCall.js000064400000007107151701475610012646 0ustar00"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.makeRequestCallFromTimer = makeRequestCallFromTimer; exports.makeRequestCallFromMutationObserver = makeRequestCallFromMutationObserver; exports.makeRequestCall = void 0; // Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that // have WebKitMutationObserver but not un-prefixed MutationObserver. // Must use `global` or `self` instead of `window` to work in both frames and web // workers. `global` is a provision of Browserify, Mr, Mrs, or Mop. /* globals self */ const scope = typeof global !== 'undefined' ? global : self; const BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver; function makeRequestCallFromTimer(callback) { return function requestCall() { // We dispatch a timeout with a specified delay of 0 for engines that // can reliably accommodate that request. This will usually be snapped // to a 4 milisecond delay, but once we're flushing, there's no delay // between events. const timeoutHandle = setTimeout(handleTimer, 0); // However, since this timer gets frequently dropped in Firefox // workers, we enlist an interval handle that will try to fire // an event 20 times per second until it succeeds. const intervalHandle = setInterval(handleTimer, 50); function handleTimer() { // Whichever timer succeeds will cancel both timers and // execute the callback. clearTimeout(timeoutHandle); clearInterval(intervalHandle); callback(); } }; } function makeRequestCallFromMutationObserver(callback) { let toggle = 1; const observer = new BrowserMutationObserver(callback); const node = document.createTextNode(''); observer.observe(node, { characterData: true }); return function requestCall() { toggle = -toggle; node.data = toggle; }; } const makeRequestCall = typeof BrowserMutationObserver === 'function' ? // reliably everywhere they are implemented. // They are implemented in all modern browsers. // // - Android 4-4.3 // - Chrome 26-34 // - Firefox 14-29 // - Internet Explorer 11 // - iPad Safari 6-7.1 // - iPhone Safari 7-7.1 // - Safari 6-7 makeRequestCallFromMutationObserver : // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera // 11-12, and in web workers in many engines. // Although message channels yield to any queued rendering and IO tasks, they // would be better than imposing the 4ms delay of timers. // However, they do not work reliably in Internet Explorer or Safari. // Internet Explorer 10 is the only browser that has setImmediate but does // not have MutationObservers. // Although setImmediate yields to the browser's renderer, it would be // preferrable to falling back to setTimeout since it does not have // the minimum 4ms penalty. // Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and // Desktop to a lesser extent) that renders both setImmediate and // MessageChannel useless for the purposes of ASAP. // https://github.com/kriskowal/q/issues/396 // Timers are implemented universally. // We fall back to timers in workers in most engines, and in foreground // contexts in the following browsers. // However, note that even this simple case requires nuances to operate in a // broad spectrum of browsers. // // - Firefox 3-13 // - Internet Explorer 6-9 // - iPad Safari 4.3 // - Lynx 2.8.7 makeRequestCallFromTimer; exports.makeRequestCall = makeRequestCall; //# sourceMappingURL=makeRequestCall.js.mapasap/dist/cjs/TaskFactory.js000064400000001040151701475610012004 0ustar00"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _rawTaskJs = require("./RawTask.js"); class TaskFactory { create(task) { const tasks = this.freeTasks; const t1 = tasks.length ? tasks.pop() : new _rawTaskJs.RawTask(this.onError, (t)=>tasks[tasks.length] = t ); t1.task = task; return t1; } constructor(onError){ this.onError = onError; this.freeTasks = []; } } exports.TaskFactory = TaskFactory; //# sourceMappingURL=TaskFactory.js.mapasap/dist/cjs/makeRequestCall.js.map000064400000013433151701475610013421 0ustar00{"version":3,"sources":["../../src/makeRequestCall.ts"],"sourcesContent":["// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that\n// have WebKitMutationObserver but not un-prefixed MutationObserver.\n// Must use `global` or `self` instead of `window` to work in both frames and web\n// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.\n\n/* globals self */\nconst scope = typeof global !== 'undefined' ? global : self\nconst BrowserMutationObserver =\n\t(scope as any).MutationObserver || (scope as any).WebKitMutationObserver\n\nexport function makeRequestCallFromTimer(callback: () => void) {\n\treturn function requestCall() {\n\t\t// We dispatch a timeout with a specified delay of 0 for engines that\n\t\t// can reliably accommodate that request. This will usually be snapped\n\t\t// to a 4 milisecond delay, but once we're flushing, there's no delay\n\t\t// between events.\n\t\tconst timeoutHandle = setTimeout(handleTimer, 0)\n\t\t// However, since this timer gets frequently dropped in Firefox\n\t\t// workers, we enlist an interval handle that will try to fire\n\t\t// an event 20 times per second until it succeeds.\n\t\tconst intervalHandle = setInterval(handleTimer, 50)\n\n\t\tfunction handleTimer() {\n\t\t\t// Whichever timer succeeds will cancel both timers and\n\t\t\t// execute the callback.\n\t\t\tclearTimeout(timeoutHandle)\n\t\t\tclearInterval(intervalHandle)\n\t\t\tcallback()\n\t\t}\n\t}\n}\n\n// To request a high priority event, we induce a mutation observer by toggling\n// the text of a text node between \"1\" and \"-1\".\nexport function makeRequestCallFromMutationObserver(callback: () => void) {\n\tlet toggle = 1\n\tconst observer = new BrowserMutationObserver(callback)\n\tconst node = document.createTextNode('')\n\tobserver.observe(node, { characterData: true })\n\treturn function requestCall() {\n\t\ttoggle = -toggle\n\t\t;(node as any).data = toggle\n\t}\n}\n\nexport const makeRequestCall =\n\ttypeof BrowserMutationObserver === 'function'\n\t\t? // MutationObservers are desirable because they have high priority and work\n\t\t // reliably everywhere they are implemented.\n\t\t // They are implemented in all modern browsers.\n\t\t //\n\t\t // - Android 4-4.3\n\t\t // - Chrome 26-34\n\t\t // - Firefox 14-29\n\t\t // - Internet Explorer 11\n\t\t // - iPad Safari 6-7.1\n\t\t // - iPhone Safari 7-7.1\n\t\t // - Safari 6-7\n\t\t makeRequestCallFromMutationObserver\n\t\t: // MessageChannels are desirable because they give direct access to the HTML\n\t\t // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera\n\t\t // 11-12, and in web workers in many engines.\n\t\t // Although message channels yield to any queued rendering and IO tasks, they\n\t\t // would be better than imposing the 4ms delay of timers.\n\t\t // However, they do not work reliably in Internet Explorer or Safari.\n\n\t\t // Internet Explorer 10 is the only browser that has setImmediate but does\n\t\t // not have MutationObservers.\n\t\t // Although setImmediate yields to the browser's renderer, it would be\n\t\t // preferrable to falling back to setTimeout since it does not have\n\t\t // the minimum 4ms penalty.\n\t\t // Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and\n\t\t // Desktop to a lesser extent) that renders both setImmediate and\n\t\t // MessageChannel useless for the purposes of ASAP.\n\t\t // https://github.com/kriskowal/q/issues/396\n\n\t\t // Timers are implemented universally.\n\t\t // We fall back to timers in workers in most engines, and in foreground\n\t\t // contexts in the following browsers.\n\t\t // However, note that even this simple case requires nuances to operate in a\n\t\t // broad spectrum of browsers.\n\t\t //\n\t\t // - Firefox 3-13\n\t\t // - Internet Explorer 6-9\n\t\t // - iPad Safari 4.3\n\t\t // - Lynx 2.8.7\n\t\t makeRequestCallFromTimer\n"],"names":["makeRequestCallFromTimer","makeRequestCallFromMutationObserver","scope","global","self","BrowserMutationObserver","MutationObserver","WebKitMutationObserver","callback","requestCall","timeoutHandle","setTimeout","handleTimer","intervalHandle","setInterval","clearTimeout","clearInterval","toggle","observer","node","document","createTextNode","observe","characterData","data","makeRequestCall"],"mappings":"AAMA;;;;QAIgBA,wBAAwB,GAAxBA,wBAAwB;QAwBxBC,mCAAmC,GAAnCA,mCAAmC;;AAlCnD,4EAA4E;AAC5E,oEAAoE;AACpE,iFAAiF;AACjF,mEAAmE;AAEnE,kBAAkB,CAClB,MAAMC,KAAK,GAAG,OAAOC,MAAM,KAAK,WAAW,GAAGA,MAAM,GAAGC,IAAI;AAC3D,MAAMC,uBAAuB,GAC5B,AAACH,KAAK,CAASI,gBAAgB,IAAI,AAACJ,KAAK,CAASK,sBAAsB;AAElE,SAASP,wBAAwB,CAACQ,QAAoB,EAAE;IAC9D,OAAO,SAASC,WAAW,GAAG;QAC7B,qEAAqE;QACrE,sEAAsE;QACtE,qEAAqE;QACrE,kBAAkB;QAClB,MAAMC,aAAa,GAAGC,UAAU,CAACC,WAAW,EAAE,CAAC,CAAC;QAChD,+DAA+D;QAC/D,8DAA8D;QAC9D,kDAAkD;QAClD,MAAMC,cAAc,GAAGC,WAAW,CAACF,WAAW,EAAE,EAAE,CAAC;QAEnD,SAASA,WAAW,GAAG;YACtB,uDAAuD;YACvD,wBAAwB;YACxBG,YAAY,CAACL,aAAa,CAAC;YAC3BM,aAAa,CAACH,cAAc,CAAC;YAC7BL,QAAQ,EAAE;SACV;KACD,CAAA;CACD;AAIM,SAASP,mCAAmC,CAACO,QAAoB,EAAE;IACzE,IAAIS,MAAM,GAAG,CAAC;IACd,MAAMC,QAAQ,GAAG,IAAIb,uBAAuB,CAACG,QAAQ,CAAC;IACtD,MAAMW,IAAI,GAAGC,QAAQ,CAACC,cAAc,CAAC,EAAE,CAAC;IACxCH,QAAQ,CAACI,OAAO,CAACH,IAAI,EAAE;QAAEI,aAAa,EAAE,IAAI;KAAE,CAAC;IAC/C,OAAO,SAASd,WAAW,GAAG;QAC7BQ,MAAM,GAAG,CAACA,MAAM,CACf;QAAA,AAACE,IAAI,CAASK,IAAI,GAAGP,MAAM;KAC5B,CAAA;CACD;AAEM,MAAMQ,eAAe,GAC3B,OAAOpB,uBAAuB,KAAK,UAAU,GAE1C,4CAA4C;AAC5C,+CAA+C;AAC/C,EAAE;AACF,kBAAkB;AAClB,iBAAiB;AACjB,kBAAkB;AAClB,yBAAyB;AACzB,sBAAsB;AACtB,wBAAwB;AACxB,eAAe;AACfJ,mCAAmC,GAEnC,+EAA+E;AAC/E,6CAA6C;AAC7C,6EAA6E;AAC7E,yDAAyD;AACzD,qEAAqE;AAErE,0EAA0E;AAC1E,8BAA8B;AAC9B,sEAAsE;AACtE,mEAAmE;AACnE,2BAA2B;AAC3B,8EAA8E;AAC9E,iEAAiE;AACjE,mDAAmD;AACnD,4CAA4C;AAE5C,sCAAsC;AACtC,uEAAuE;AACvE,sCAAsC;AACtC,4EAA4E;AAC5E,8BAA8B;AAC9B,EAAE;AACF,iBAAiB;AACjB,0BAA0B;AAC1B,oBAAoB;AACpB,eAAe;AACfD,wBAAwB;QAzCfyB,eAAe,GAAfA,eAAe"}asap/dist/cjs/index.js000064400000005246151701475610010675 0ustar00"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _exportNames = {}; var _asapJs = _interopRequireWildcard(require("./asap.js")); Object.keys(_asapJs).forEach(function(key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _asapJs[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function() { return _asapJs[key]; } }); }); var _typesJs = _interopRequireWildcard(require("./types.js")); Object.keys(_typesJs).forEach(function(key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _typesJs[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function() { return _typesJs[key]; } }); }); var _asapQueueJs = _interopRequireWildcard(require("./AsapQueue.js")); Object.keys(_asapQueueJs).forEach(function(key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _asapQueueJs[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function() { return _asapQueueJs[key]; } }); }); var _taskFactoryJs = _interopRequireWildcard(require("./TaskFactory.js")); Object.keys(_taskFactoryJs).forEach(function(key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _taskFactoryJs[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function() { return _taskFactoryJs[key]; } }); }); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for(var key in obj){ if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } //# sourceMappingURL=index.js.mapasap/dist/cjs/asap.js000064400000000670151701475610010506 0ustar00"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.asap = asap; var _asapQueueJs = require("./AsapQueue.js"); var _taskFactoryJs = require("./TaskFactory.js"); const asapQueue = new _asapQueueJs.AsapQueue(); const taskFactory = new _taskFactoryJs.TaskFactory(asapQueue.registerPendingError); function asap(task) { asapQueue.enqueueTask(taskFactory.create(task)); } //# sourceMappingURL=asap.js.mapasap/dist/cjs/RawTask.js.map000064400000002105151701475610011705 0ustar00{"version":3,"sources":["../../src/RawTask.ts"],"sourcesContent":["// We wrap tasks with recyclable task objects. A task object implements\n\nimport type { TaskFn, Task } from 'types'\n\n// `call`, just like a function.\nexport class RawTask implements Task {\n\tpublic task: TaskFn | null = null\n\n\tpublic constructor(\n\t\tprivate onError: (err: any) => void,\n\t\tprivate release: (t: RawTask) => void,\n\t) {}\n\n\tpublic call() {\n\t\ttry {\n\t\t\tthis.task && this.task()\n\t\t} catch (error) {\n\t\t\tthis.onError(error)\n\t\t} finally {\n\t\t\tthis.task = null\n\t\t\tthis.release(this)\n\t\t}\n\t}\n}\n"],"names":["RawTask","call","task","error","onError","release"],"mappings":"AAEA;;;;AAGO,MAAMA,OAAO;IAQnB,AAAOC,IAAI,GAAG;QACb,IAAI;YACH,IAAI,CAACC,IAAI,IAAI,IAAI,CAACA,IAAI,EAAE;SACxB,CAAC,OAAOC,KAAK,EAAE;YACf,IAAI,CAACC,OAAO,CAACD,KAAK,CAAC;SACnB,QAAS;YACT,IAAI,CAACD,IAAI,GAAG,IAAI;YAChB,IAAI,CAACG,OAAO,CAAC,IAAI,CAAC;SAClB;KACD;IAdD,YACSD,OAA2B,EAC3BC,OAA6B,CACpC;aAFOD,OAA2B,GAA3BA,OAA2B;aAC3BC,OAA6B,GAA7BA,OAA6B;aAJ/BH,IAAI,GAAkB,IAAI;KAK7B;CAYJ;QAlBYF,OAAO,GAAPA,OAAO"}asap/dist/cjs/TaskFactory.js.map000064400000002145151701475610012567 0ustar00{"version":3,"sources":["../../src/TaskFactory.ts"],"sourcesContent":["import type { Task } from './types.js'\nimport { RawTask } from './RawTask.js'\n\nexport class TaskFactory {\n\tprivate freeTasks: RawTask[] = []\n\n\tpublic constructor(private onError: (err: any) => void) {}\n\n\tpublic create(task: () => void): Task {\n\t\tconst tasks = this.freeTasks\n\t\tconst t = tasks.length\n\t\t\t? (tasks.pop() as RawTask)\n\t\t\t: new RawTask(this.onError, (t) => (tasks[tasks.length] = t))\n\t\tt.task = task\n\t\treturn t\n\t}\n}\n"],"names":["TaskFactory","create","task","tasks","freeTasks","t","length","pop","RawTask","onError"],"mappings":"AAAA;;;;AACwB,IAAA,UAAc,WAAd,cAAc,CAAA;AAE/B,MAAMA,WAAW;IAKvB,AAAOC,MAAM,CAACC,IAAgB,EAAQ;QACrC,MAAMC,KAAK,GAAG,IAAI,CAACC,SAAS;QAC5B,MAAMC,EAAC,GAAGF,KAAK,CAACG,MAAM,GAClBH,KAAK,CAACI,GAAG,EAAE,GACZ,IAAIC,UAAO,QAAA,CAAC,IAAI,CAACC,OAAO,EAAE,CAACJ,CAAC,GAAMF,KAAK,CAACA,KAAK,CAACG,MAAM,CAAC,GAAGD,CAAC;QAAC,CAAC;QAC9DA,EAAC,CAACH,IAAI,GAAGA,IAAI;QACb,OAAOG,EAAC,CAAA;KACR;IATD,YAA2BI,OAA2B,CAAE;aAA7BA,OAA2B,GAA3BA,OAA2B;aAF9CL,SAAS,GAAc,EAAE;KAEyB;CAU1D;QAbYJ,WAAW,GAAXA,WAAW"}asap/dist/cjs/RawTask.js000064400000001002151701475610011124 0ustar00"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class RawTask { call() { try { this.task && this.task(); } catch (error) { this.onError(error); } finally{ this.task = null; this.release(this); } } constructor(onError, release){ this.onError = onError; this.release = release; this.task = null; } } exports.RawTask = RawTask; //# sourceMappingURL=RawTask.js.mapasap/dist/cjs/index.js.map000064400000000753151701475610011447 0ustar00{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './asap.js'\nexport * from './types.js'\nexport * from './AsapQueue.js'\nexport * from './TaskFactory.js'\n"],"names":[],"mappings":"AAAA;;;;;8CAAc,WAAW;AAAzB,YAAA,OAAyB;;;2CAAzB,OAAyB;;;;mBAAzB,OAAyB;;;EAAA;+CACX,YAAY;AAA1B,YAAA,QAA0B;;;2CAA1B,QAA0B;;;;mBAA1B,QAA0B;;;EAAA;mDACZ,gBAAgB;AAA9B,YAAA,YAA8B;;;2CAA9B,YAA8B;;;;mBAA9B,YAA8B;;;EAAA;qDAChB,kBAAkB;AAAhC,YAAA,cAAgC;;;2CAAhC,cAAgC;;;;mBAAhC,cAAgC;;;EAAA"}asap/dist/cjs/AsapQueue.js000064400000016367151701475610011465 0ustar00"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _makeRequestCallJs = require("./makeRequestCall.js"); class AsapQueue { // Use the fastest means possible to execute a task in its own turn, with // priority over other events including IO, animation, reflow, and redraw // events in browsers. // // An exception thrown by a task will permanently interrupt the processing of // subsequent tasks. The higher level `asap` function ensures that if an // exception is thrown by a task, that the task queue will continue flushing as // soon as possible, but if you use `rawAsap` directly, you are responsible to // either ensure that no exceptions are thrown from your task, or to manually // call `rawAsap.requestFlush` if an exception is thrown. enqueueTask(task) { const { queue: q , requestFlush } = this; if (!q.length) { requestFlush(); this.flushing = true; } // Equivalent to push, but avoids a function call. q[q.length] = task; } constructor(){ this.queue = []; // We queue errors to ensure they are thrown in right order (FIFO). // Array-as-queue is good enough here, since we are just dealing with exceptions. this.pendingErrors = []; // Once a flush has been requested, no further calls to `requestFlush` are // necessary until the next `flush` completes. // @ts-ignore this.flushing = false; // The position of the next task to execute in the task queue. This is // preserved between calls to `flush` so that it can be resumed if // a task throws an exception. this.index = 0; // If a task schedules additional tasks recursively, the task queue can grow // unbounded. To prevent memory exhaustion, the task queue will periodically // truncate already-completed tasks. this.capacity = 1024; // The flush function processes all tasks that have been scheduled with // `rawAsap` unless and until one of those tasks throws an exception. // If a task throws an exception, `flush` ensures that its state will remain // consistent and will resume where it left off when called again. // However, `flush` does not make any arrangements to be called again if an // exception is thrown. this.flush = ()=>{ const { queue: q } = this; while(this.index < q.length){ const currentIndex = this.index; // Advance the index before calling the task. This ensures that we will // begin flushing on the next task the task throws an error. this.index++; q[currentIndex].call(); // Prevent leaking memory for long chains of recursive calls to `asap`. // If we call `asap` within tasks scheduled by `asap`, the queue will // grow, but to avoid an O(n) walk for every task we execute, we don't // shift tasks off the queue after they have been executed. // Instead, we periodically shift 1024 tasks off the queue. if (this.index > this.capacity) { // Manually shift all values starting at the index back to the // beginning of the queue. for(let scan = 0, newLength = q.length - this.index; scan < newLength; scan++){ q[scan] = q[scan + this.index]; } q.length -= this.index; this.index = 0; } } q.length = 0; this.index = 0; this.flushing = false; }; // In a web browser, exceptions are not fatal. However, to avoid // slowing down the queue of pending tasks, we rethrow the error in a // lower priority turn. this.registerPendingError = (err)=>{ this.pendingErrors.push(err); this.requestErrorThrow(); }; // `requestFlush` requests that the high priority event queue be flushed as // soon as possible. // This is useful to prevent an error thrown in a task from stalling the event // queue if the exception handled by Node.js’s // `process.on("uncaughtException")` or by a domain. // `requestFlush` is implemented using a strategy based on data collected from // every available SauceLabs Selenium web driver worker at time of writing. // https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593 this.requestFlush = (0, _makeRequestCallJs).makeRequestCall(this.flush); this.requestErrorThrow = (0, _makeRequestCallJs).makeRequestCallFromTimer(()=>{ // Throw first error if (this.pendingErrors.length) { throw this.pendingErrors.shift(); } }); } } // The message channel technique was discovered by Malte Ubl and was the // original foundation for this library. // http://www.nonblocking.io/2011/06/windownexttick.html // Safari 6.0.5 (at least) intermittently fails to create message ports on a // page's first load. Thankfully, this version of Safari supports // MutationObservers, so we don't need to fall back in that case. // function makeRequestCallFromMessageChannel(callback) { // var channel = new MessageChannel(); // channel.port1.onmessage = callback; // return function requestCall() { // channel.port2.postMessage(0); // }; // } // For reasons explained above, we are also unable to use `setImmediate` // under any circumstances. // Even if we were, there is another bug in Internet Explorer 10. // It is not sufficient to assign `setImmediate` to `requestFlush` because // `setImmediate` must be called *by name* and therefore must be wrapped in a // closure. // Never forget. // function makeRequestCallFromSetImmediate(callback) { // return function requestCall() { // setImmediate(callback); // }; // } // Safari 6.0 has a problem where timers will get lost while the user is // scrolling. This problem does not impact ASAP because Safari 6.0 supports // mutation observers, so that implementation is used instead. // However, if we ever elect to use timers in Safari, the prevalent work-around // is to add a scroll event listener that calls for a flush. // `setTimeout` does not call the passed callback if the delay is less than // approximately 7 in web workers in Firefox 8 through 18, and sometimes not // even then. // This is for `asap.js` only. // Its name will be periodically randomized to break any code that depends on // // its existence. // rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer // ASAP was originally a nextTick shim included in Q. This was factored out // into this ASAP package. It was later adapted to RSVP which made further // amendments. These decisions, particularly to marginalize MessageChannel and // to capture the MutationObserver implementation in a closure, were integrated // back into ASAP proper. // https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js exports.AsapQueue = AsapQueue; //# sourceMappingURL=AsapQueue.js.mapasap/dist/esm/index.mjs.map000064400000000454151701475610011627 0ustar00{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './asap.js'\nexport * from './types.js'\nexport * from './AsapQueue.js'\nexport * from './TaskFactory.js'\n"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA"}asap/dist/esm/TaskFactory.mjs.map000064400000002107151701475610012747 0ustar00{"version":3,"sources":["../../src/TaskFactory.ts"],"sourcesContent":["import type { Task } from './types.js'\nimport { RawTask } from './RawTask.js'\n\nexport class TaskFactory {\n\tprivate freeTasks: RawTask[] = []\n\n\tpublic constructor(private onError: (err: any) => void) {}\n\n\tpublic create(task: () => void): Task {\n\t\tconst tasks = this.freeTasks\n\t\tconst t = tasks.length\n\t\t\t? (tasks.pop() as RawTask)\n\t\t\t: new RawTask(this.onError, (t) => (tasks[tasks.length] = t))\n\t\tt.task = task\n\t\treturn t\n\t}\n}\n"],"names":["RawTask","TaskFactory","create","task","tasks","freeTasks","t","length","pop","onError"],"mappings":"AACA,SAASA,OAAO,QAAQ,cAAc,CAAA;AAEtC,OAAO,MAAMC,WAAW;IAKvB,AAAOC,MAAM,CAACC,IAAgB,EAAQ;QACrC,MAAMC,KAAK,GAAG,IAAI,CAACC,SAAS;QAC5B,MAAMC,EAAC,GAAGF,KAAK,CAACG,MAAM,GAClBH,KAAK,CAACI,GAAG,EAAE,GACZ,IAAIR,OAAO,CAAC,IAAI,CAACS,OAAO,EAAE,CAACH,CAAC,GAAMF,KAAK,CAACA,KAAK,CAACG,MAAM,CAAC,GAAGD,CAAC;QAAC,CAAC;QAC9DA,EAAC,CAACH,IAAI,GAAGA,IAAI;QACb,OAAOG,EAAC,CAAA;KACR;IATD,YAA2BG,OAA2B,CAAE;aAA7BA,OAA2B,GAA3BA,OAA2B;aAF9CJ,SAAS,GAAc,EAAE;KAEyB;CAU1D"}asap/dist/esm/types.mjs000064400000000057151701475610011107 0ustar00export { }; //# sourceMappingURL=types.mjs.mapasap/dist/esm/makeRequestCall.mjs.map000064400000013355151701475610013606 0ustar00{"version":3,"sources":["../../src/makeRequestCall.ts"],"sourcesContent":["// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that\n// have WebKitMutationObserver but not un-prefixed MutationObserver.\n// Must use `global` or `self` instead of `window` to work in both frames and web\n// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.\n\n/* globals self */\nconst scope = typeof global !== 'undefined' ? global : self\nconst BrowserMutationObserver =\n\t(scope as any).MutationObserver || (scope as any).WebKitMutationObserver\n\nexport function makeRequestCallFromTimer(callback: () => void) {\n\treturn function requestCall() {\n\t\t// We dispatch a timeout with a specified delay of 0 for engines that\n\t\t// can reliably accommodate that request. This will usually be snapped\n\t\t// to a 4 milisecond delay, but once we're flushing, there's no delay\n\t\t// between events.\n\t\tconst timeoutHandle = setTimeout(handleTimer, 0)\n\t\t// However, since this timer gets frequently dropped in Firefox\n\t\t// workers, we enlist an interval handle that will try to fire\n\t\t// an event 20 times per second until it succeeds.\n\t\tconst intervalHandle = setInterval(handleTimer, 50)\n\n\t\tfunction handleTimer() {\n\t\t\t// Whichever timer succeeds will cancel both timers and\n\t\t\t// execute the callback.\n\t\t\tclearTimeout(timeoutHandle)\n\t\t\tclearInterval(intervalHandle)\n\t\t\tcallback()\n\t\t}\n\t}\n}\n\n// To request a high priority event, we induce a mutation observer by toggling\n// the text of a text node between \"1\" and \"-1\".\nexport function makeRequestCallFromMutationObserver(callback: () => void) {\n\tlet toggle = 1\n\tconst observer = new BrowserMutationObserver(callback)\n\tconst node = document.createTextNode('')\n\tobserver.observe(node, { characterData: true })\n\treturn function requestCall() {\n\t\ttoggle = -toggle\n\t\t;(node as any).data = toggle\n\t}\n}\n\nexport const makeRequestCall =\n\ttypeof BrowserMutationObserver === 'function'\n\t\t? // MutationObservers are desirable because they have high priority and work\n\t\t // reliably everywhere they are implemented.\n\t\t // They are implemented in all modern browsers.\n\t\t //\n\t\t // - Android 4-4.3\n\t\t // - Chrome 26-34\n\t\t // - Firefox 14-29\n\t\t // - Internet Explorer 11\n\t\t // - iPad Safari 6-7.1\n\t\t // - iPhone Safari 7-7.1\n\t\t // - Safari 6-7\n\t\t makeRequestCallFromMutationObserver\n\t\t: // MessageChannels are desirable because they give direct access to the HTML\n\t\t // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera\n\t\t // 11-12, and in web workers in many engines.\n\t\t // Although message channels yield to any queued rendering and IO tasks, they\n\t\t // would be better than imposing the 4ms delay of timers.\n\t\t // However, they do not work reliably in Internet Explorer or Safari.\n\n\t\t // Internet Explorer 10 is the only browser that has setImmediate but does\n\t\t // not have MutationObservers.\n\t\t // Although setImmediate yields to the browser's renderer, it would be\n\t\t // preferrable to falling back to setTimeout since it does not have\n\t\t // the minimum 4ms penalty.\n\t\t // Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and\n\t\t // Desktop to a lesser extent) that renders both setImmediate and\n\t\t // MessageChannel useless for the purposes of ASAP.\n\t\t // https://github.com/kriskowal/q/issues/396\n\n\t\t // Timers are implemented universally.\n\t\t // We fall back to timers in workers in most engines, and in foreground\n\t\t // contexts in the following browsers.\n\t\t // However, note that even this simple case requires nuances to operate in a\n\t\t // broad spectrum of browsers.\n\t\t //\n\t\t // - Firefox 3-13\n\t\t // - Internet Explorer 6-9\n\t\t // - iPad Safari 4.3\n\t\t // - Lynx 2.8.7\n\t\t makeRequestCallFromTimer\n"],"names":["scope","global","self","BrowserMutationObserver","MutationObserver","WebKitMutationObserver","makeRequestCallFromTimer","callback","requestCall","timeoutHandle","setTimeout","handleTimer","intervalHandle","setInterval","clearTimeout","clearInterval","makeRequestCallFromMutationObserver","toggle","observer","node","document","createTextNode","observe","characterData","data","makeRequestCall"],"mappings":"AAAA,4EAA4E;AAC5E,oEAAoE;AACpE,iFAAiF;AACjF,mEAAmE;AAEnE,kBAAkB,CAClB,MAAMA,KAAK,GAAG,OAAOC,MAAM,KAAK,WAAW,GAAGA,MAAM,GAAGC,IAAI;AAC3D,MAAMC,uBAAuB,GAC5B,AAACH,KAAK,CAASI,gBAAgB,IAAI,AAACJ,KAAK,CAASK,sBAAsB;AAEzE,OAAO,SAASC,wBAAwB,CAACC,QAAoB,EAAE;IAC9D,OAAO,SAASC,WAAW,GAAG;QAC7B,qEAAqE;QACrE,sEAAsE;QACtE,qEAAqE;QACrE,kBAAkB;QAClB,MAAMC,aAAa,GAAGC,UAAU,CAACC,WAAW,EAAE,CAAC,CAAC;QAChD,+DAA+D;QAC/D,8DAA8D;QAC9D,kDAAkD;QAClD,MAAMC,cAAc,GAAGC,WAAW,CAACF,WAAW,EAAE,EAAE,CAAC;QAEnD,SAASA,WAAW,GAAG;YACtB,uDAAuD;YACvD,wBAAwB;YACxBG,YAAY,CAACL,aAAa,CAAC;YAC3BM,aAAa,CAACH,cAAc,CAAC;YAC7BL,QAAQ,EAAE;SACV;KACD,CAAA;CACD;AAED,8EAA8E;AAC9E,gDAAgD;AAChD,OAAO,SAASS,mCAAmC,CAACT,QAAoB,EAAE;IACzE,IAAIU,MAAM,GAAG,CAAC;IACd,MAAMC,QAAQ,GAAG,IAAIf,uBAAuB,CAACI,QAAQ,CAAC;IACtD,MAAMY,IAAI,GAAGC,QAAQ,CAACC,cAAc,CAAC,EAAE,CAAC;IACxCH,QAAQ,CAACI,OAAO,CAACH,IAAI,EAAE;QAAEI,aAAa,EAAE,IAAI;KAAE,CAAC;IAC/C,OAAO,SAASf,WAAW,GAAG;QAC7BS,MAAM,GAAG,CAACA,MAAM,CACf;QAAA,AAACE,IAAI,CAASK,IAAI,GAAGP,MAAM;KAC5B,CAAA;CACD;AAED,OAAO,MAAMQ,eAAe,GAC3B,OAAOtB,uBAAuB,KAAK,UAAU,GAE1C,4CAA4C;AAC5C,+CAA+C;AAC/C,EAAE;AACF,kBAAkB;AAClB,iBAAiB;AACjB,kBAAkB;AAClB,yBAAyB;AACzB,sBAAsB;AACtB,wBAAwB;AACxB,eAAe;AACfa,mCAAmC,GAEnC,+EAA+E;AAC/E,6CAA6C;AAC7C,6EAA6E;AAC7E,yDAAyD;AACzD,qEAAqE;AAErE,0EAA0E;AAC1E,8BAA8B;AAC9B,sEAAsE;AACtE,mEAAmE;AACnE,2BAA2B;AAC3B,8EAA8E;AAC9E,iEAAiE;AACjE,mDAAmD;AACnD,4CAA4C;AAE5C,sCAAsC;AACtC,uEAAuE;AACvE,sCAAsC;AACtC,4EAA4E;AAC5E,8BAA8B;AAC9B,EAAE;AACF,iBAAiB;AACjB,0BAA0B;AAC1B,oBAAoB;AACpB,eAAe;AACfV,wBAAwB,CAAA"}asap/dist/esm/asap.mjs.map000064400000002351151701475610011442 0ustar00{"version":3,"sources":["../../src/asap.ts"],"sourcesContent":["import { AsapQueue } from './AsapQueue.js'\nimport { TaskFactory } from './TaskFactory.js'\nimport type { TaskFn } from './types.js'\n\nconst asapQueue = new AsapQueue()\nconst taskFactory = new TaskFactory(asapQueue.registerPendingError)\n\n/**\n * Calls a task as soon as possible after returning, in its own event, with priority\n * over other events like animation, reflow, and repaint. An error thrown from an\n * event will not interrupt, nor even substantially slow down the processing of\n * other events, but will be rather postponed to a lower priority event.\n * @param {{call}} task A callable object, typically a function that takes no\n * arguments.\n */\nexport function asap(task: TaskFn) {\n\tasapQueue.enqueueTask(taskFactory.create(task))\n}\n"],"names":["AsapQueue","TaskFactory","asapQueue","taskFactory","registerPendingError","asap","task","enqueueTask","create"],"mappings":"AAAA,SAASA,SAAS,QAAQ,gBAAgB,CAAA;AAC1C,SAASC,WAAW,QAAQ,kBAAkB,CAAA;AAG9C,MAAMC,SAAS,GAAG,IAAIF,SAAS,EAAE;AACjC,MAAMG,WAAW,GAAG,IAAIF,WAAW,CAACC,SAAS,CAACE,oBAAoB,CAAC;AAEnE;;;;;;;GAOG,CACH,OAAO,SAASC,IAAI,CAACC,IAAY,EAAE;IAClCJ,SAAS,CAACK,WAAW,CAACJ,WAAW,CAACK,MAAM,CAACF,IAAI,CAAC,CAAC;CAC/C"}asap/dist/esm/AsapQueue.mjs000064400000016170151701475610011637 0ustar00import { makeRequestCall, makeRequestCallFromTimer } from './makeRequestCall.mjs'; export class AsapQueue { // Use the fastest means possible to execute a task in its own turn, with // priority over other events including IO, animation, reflow, and redraw // events in browsers. // // An exception thrown by a task will permanently interrupt the processing of // subsequent tasks. The higher level `asap` function ensures that if an // exception is thrown by a task, that the task queue will continue flushing as // soon as possible, but if you use `rawAsap` directly, you are responsible to // either ensure that no exceptions are thrown from your task, or to manually // call `rawAsap.requestFlush` if an exception is thrown. enqueueTask(task) { const { queue: q , requestFlush } = this; if (!q.length) { requestFlush(); this.flushing = true; } // Equivalent to push, but avoids a function call. q[q.length] = task; } constructor(){ this.queue = []; // We queue errors to ensure they are thrown in right order (FIFO). // Array-as-queue is good enough here, since we are just dealing with exceptions. this.pendingErrors = []; // Once a flush has been requested, no further calls to `requestFlush` are // necessary until the next `flush` completes. // @ts-ignore this.flushing = false; // The position of the next task to execute in the task queue. This is // preserved between calls to `flush` so that it can be resumed if // a task throws an exception. this.index = 0; // If a task schedules additional tasks recursively, the task queue can grow // unbounded. To prevent memory exhaustion, the task queue will periodically // truncate already-completed tasks. this.capacity = 1024; // The flush function processes all tasks that have been scheduled with // `rawAsap` unless and until one of those tasks throws an exception. // If a task throws an exception, `flush` ensures that its state will remain // consistent and will resume where it left off when called again. // However, `flush` does not make any arrangements to be called again if an // exception is thrown. this.flush = ()=>{ const { queue: q } = this; while(this.index < q.length){ const currentIndex = this.index; // Advance the index before calling the task. This ensures that we will // begin flushing on the next task the task throws an error. this.index++; q[currentIndex].call(); // Prevent leaking memory for long chains of recursive calls to `asap`. // If we call `asap` within tasks scheduled by `asap`, the queue will // grow, but to avoid an O(n) walk for every task we execute, we don't // shift tasks off the queue after they have been executed. // Instead, we periodically shift 1024 tasks off the queue. if (this.index > this.capacity) { // Manually shift all values starting at the index back to the // beginning of the queue. for(let scan = 0, newLength = q.length - this.index; scan < newLength; scan++){ q[scan] = q[scan + this.index]; } q.length -= this.index; this.index = 0; } } q.length = 0; this.index = 0; this.flushing = false; }; // In a web browser, exceptions are not fatal. However, to avoid // slowing down the queue of pending tasks, we rethrow the error in a // lower priority turn. this.registerPendingError = (err)=>{ this.pendingErrors.push(err); this.requestErrorThrow(); }; // `requestFlush` requests that the high priority event queue be flushed as // soon as possible. // This is useful to prevent an error thrown in a task from stalling the event // queue if the exception handled by Node.js’s // `process.on("uncaughtException")` or by a domain. // `requestFlush` is implemented using a strategy based on data collected from // every available SauceLabs Selenium web driver worker at time of writing. // https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593 this.requestFlush = makeRequestCall(this.flush); this.requestErrorThrow = makeRequestCallFromTimer(()=>{ // Throw first error if (this.pendingErrors.length) { throw this.pendingErrors.shift(); } }); } } // The message channel technique was discovered by Malte Ubl and was the // original foundation for this library. // http://www.nonblocking.io/2011/06/windownexttick.html // Safari 6.0.5 (at least) intermittently fails to create message ports on a // page's first load. Thankfully, this version of Safari supports // MutationObservers, so we don't need to fall back in that case. // function makeRequestCallFromMessageChannel(callback) { // var channel = new MessageChannel(); // channel.port1.onmessage = callback; // return function requestCall() { // channel.port2.postMessage(0); // }; // } // For reasons explained above, we are also unable to use `setImmediate` // under any circumstances. // Even if we were, there is another bug in Internet Explorer 10. // It is not sufficient to assign `setImmediate` to `requestFlush` because // `setImmediate` must be called *by name* and therefore must be wrapped in a // closure. // Never forget. // function makeRequestCallFromSetImmediate(callback) { // return function requestCall() { // setImmediate(callback); // }; // } // Safari 6.0 has a problem where timers will get lost while the user is // scrolling. This problem does not impact ASAP because Safari 6.0 supports // mutation observers, so that implementation is used instead. // However, if we ever elect to use timers in Safari, the prevalent work-around // is to add a scroll event listener that calls for a flush. // `setTimeout` does not call the passed callback if the delay is less than // approximately 7 in web workers in Firefox 8 through 18, and sometimes not // even then. // This is for `asap.js` only. // Its name will be periodically randomized to break any code that depends on // // its existence. // rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer // ASAP was originally a nextTick shim included in Q. This was factored out // into this ASAP package. It was later adapted to RSVP which made further // amendments. These decisions, particularly to marginalize MessageChannel and // to capture the MutationObserver implementation in a closure, were integrated // back into ASAP proper. // https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js //# sourceMappingURL=AsapQueue.mjs.mapasap/dist/esm/index.mjs000064400000000240151701475610011044 0ustar00export * from './asap.mjs'; export * from './types.mjs'; export * from './AsapQueue.mjs'; export * from './TaskFactory.mjs'; //# sourceMappingURL=index.mjs.mapasap/dist/esm/RawTask.mjs000064400000000677151701475610011327 0ustar00// `call`, just like a function. export class RawTask { call() { try { this.task && this.task(); } catch (error) { this.onError(error); } finally{ this.task = null; this.release(this); } } constructor(onError, release){ this.onError = onError; this.release = release; this.task = null; } } //# sourceMappingURL=RawTask.mjs.mapasap/dist/esm/makeRequestCall.mjs000064400000006657151701475610013041 0ustar00// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that // have WebKitMutationObserver but not un-prefixed MutationObserver. // Must use `global` or `self` instead of `window` to work in both frames and web // workers. `global` is a provision of Browserify, Mr, Mrs, or Mop. /* globals self */ const scope = typeof global !== 'undefined' ? global : self; const BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver; export function makeRequestCallFromTimer(callback) { return function requestCall() { // We dispatch a timeout with a specified delay of 0 for engines that // can reliably accommodate that request. This will usually be snapped // to a 4 milisecond delay, but once we're flushing, there's no delay // between events. const timeoutHandle = setTimeout(handleTimer, 0); // However, since this timer gets frequently dropped in Firefox // workers, we enlist an interval handle that will try to fire // an event 20 times per second until it succeeds. const intervalHandle = setInterval(handleTimer, 50); function handleTimer() { // Whichever timer succeeds will cancel both timers and // execute the callback. clearTimeout(timeoutHandle); clearInterval(intervalHandle); callback(); } }; } // To request a high priority event, we induce a mutation observer by toggling // the text of a text node between "1" and "-1". export function makeRequestCallFromMutationObserver(callback) { let toggle = 1; const observer = new BrowserMutationObserver(callback); const node = document.createTextNode(''); observer.observe(node, { characterData: true }); return function requestCall() { toggle = -toggle; node.data = toggle; }; } export const makeRequestCall = typeof BrowserMutationObserver === 'function' ? // reliably everywhere they are implemented. // They are implemented in all modern browsers. // // - Android 4-4.3 // - Chrome 26-34 // - Firefox 14-29 // - Internet Explorer 11 // - iPad Safari 6-7.1 // - iPhone Safari 7-7.1 // - Safari 6-7 makeRequestCallFromMutationObserver : // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera // 11-12, and in web workers in many engines. // Although message channels yield to any queued rendering and IO tasks, they // would be better than imposing the 4ms delay of timers. // However, they do not work reliably in Internet Explorer or Safari. // Internet Explorer 10 is the only browser that has setImmediate but does // not have MutationObservers. // Although setImmediate yields to the browser's renderer, it would be // preferrable to falling back to setTimeout since it does not have // the minimum 4ms penalty. // Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and // Desktop to a lesser extent) that renders both setImmediate and // MessageChannel useless for the purposes of ASAP. // https://github.com/kriskowal/q/issues/396 // Timers are implemented universally. // We fall back to timers in workers in most engines, and in foreground // contexts in the following browsers. // However, note that even this simple case requires nuances to operate in a // broad spectrum of browsers. // // - Firefox 3-13 // - Internet Explorer 6-9 // - iPad Safari 4.3 // - Lynx 2.8.7 makeRequestCallFromTimer; //# sourceMappingURL=makeRequestCall.mjs.mapasap/dist/esm/TaskFactory.mjs000064400000000650151701475610012174 0ustar00import { RawTask } from './RawTask.mjs'; export class TaskFactory { create(task) { const tasks = this.freeTasks; const t1 = tasks.length ? tasks.pop() : new RawTask(this.onError, (t)=>tasks[tasks.length] = t ); t1.task = task; return t1; } constructor(onError){ this.onError = onError; this.freeTasks = []; } } //# sourceMappingURL=TaskFactory.mjs.mapasap/dist/esm/RawTask.mjs.map000064400000002070151701475610012070 0ustar00{"version":3,"sources":["../../src/RawTask.ts"],"sourcesContent":["// We wrap tasks with recyclable task objects. A task object implements\n\nimport type { TaskFn, Task } from 'types'\n\n// `call`, just like a function.\nexport class RawTask implements Task {\n\tpublic task: TaskFn | null = null\n\n\tpublic constructor(\n\t\tprivate onError: (err: any) => void,\n\t\tprivate release: (t: RawTask) => void,\n\t) {}\n\n\tpublic call() {\n\t\ttry {\n\t\t\tthis.task && this.task()\n\t\t} catch (error) {\n\t\t\tthis.onError(error)\n\t\t} finally {\n\t\t\tthis.task = null\n\t\t\tthis.release(this)\n\t\t}\n\t}\n}\n"],"names":["RawTask","call","task","error","onError","release"],"mappings":"AAIA,gCAAgC;AAChC,OAAO,MAAMA,OAAO;IAQnB,AAAOC,IAAI,GAAG;QACb,IAAI;YACH,IAAI,CAACC,IAAI,IAAI,IAAI,CAACA,IAAI,EAAE;SACxB,CAAC,OAAOC,KAAK,EAAE;YACf,IAAI,CAACC,OAAO,CAACD,KAAK,CAAC;SACnB,QAAS;YACT,IAAI,CAACD,IAAI,GAAG,IAAI;YAChB,IAAI,CAACG,OAAO,CAAC,IAAI,CAAC;SAClB;KACD;IAdD,YACSD,OAA2B,EAC3BC,OAA6B,CACpC;aAFOD,OAA2B,GAA3BA,OAA2B;aAC3BC,OAA6B,GAA7BA,OAA6B;aAJ/BH,IAAI,GAAkB,IAAI;KAK7B;CAYJ"}asap/dist/esm/AsapQueue.mjs.map000064400000024501151701475610012410 0ustar00{"version":3,"sources":["../../src/AsapQueue.ts"],"sourcesContent":["/* eslint-disable no-restricted-globals, @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unused-vars, @typescript-eslint/no-non-null-assertion */\nimport type { Task } from './types.js'\nimport { makeRequestCall, makeRequestCallFromTimer } from './makeRequestCall.js'\n\nexport class AsapQueue {\n\tprivate queue: Task[] = []\n\t// We queue errors to ensure they are thrown in right order (FIFO).\n\t// Array-as-queue is good enough here, since we are just dealing with exceptions.\n\tprivate pendingErrors: any[] = []\n\t// Once a flush has been requested, no further calls to `requestFlush` are\n\t// necessary until the next `flush` completes.\n\t// @ts-ignore\n\tprivate flushing = false\n\t// `requestFlush` is an implementation-specific method that attempts to kick\n\t// off a `flush` event as quickly as possible. `flush` will attempt to exhaust\n\t// the event queue before yielding to the browser's own event loop.\n\tprivate requestFlush: () => void\n\n\tprivate requestErrorThrow: () => void\n\t// The position of the next task to execute in the task queue. This is\n\t// preserved between calls to `flush` so that it can be resumed if\n\t// a task throws an exception.\n\tprivate index = 0\n\t// If a task schedules additional tasks recursively, the task queue can grow\n\t// unbounded. To prevent memory exhaustion, the task queue will periodically\n\t// truncate already-completed tasks.\n\tprivate capacity = 1024\n\n\tpublic constructor() {\n\t\t// `requestFlush` requests that the high priority event queue be flushed as\n\t\t// soon as possible.\n\t\t// This is useful to prevent an error thrown in a task from stalling the event\n\t\t// queue if the exception handled by Node.js’s\n\t\t// `process.on(\"uncaughtException\")` or by a domain.\n\n\t\t// `requestFlush` is implemented using a strategy based on data collected from\n\t\t// every available SauceLabs Selenium web driver worker at time of writing.\n\t\t// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593\n\t\tthis.requestFlush = makeRequestCall(this.flush)\n\t\tthis.requestErrorThrow = makeRequestCallFromTimer(() => {\n\t\t\t// Throw first error\n\t\t\tif (this.pendingErrors.length) {\n\t\t\t\tthrow this.pendingErrors.shift()\n\t\t\t}\n\t\t})\n\t}\n\n\t// Use the fastest means possible to execute a task in its own turn, with\n\t// priority over other events including IO, animation, reflow, and redraw\n\t// events in browsers.\n\t//\n\t// An exception thrown by a task will permanently interrupt the processing of\n\t// subsequent tasks. The higher level `asap` function ensures that if an\n\t// exception is thrown by a task, that the task queue will continue flushing as\n\t// soon as possible, but if you use `rawAsap` directly, you are responsible to\n\t// either ensure that no exceptions are thrown from your task, or to manually\n\t// call `rawAsap.requestFlush` if an exception is thrown.\n\tpublic enqueueTask(task: Task): void {\n\t\tconst { queue: q, requestFlush } = this\n\t\tif (!q.length) {\n\t\t\trequestFlush()\n\t\t\tthis.flushing = true\n\t\t}\n\t\t// Equivalent to push, but avoids a function call.\n\t\tq[q.length] = task\n\t}\n\n\t// The flush function processes all tasks that have been scheduled with\n\t// `rawAsap` unless and until one of those tasks throws an exception.\n\t// If a task throws an exception, `flush` ensures that its state will remain\n\t// consistent and will resume where it left off when called again.\n\t// However, `flush` does not make any arrangements to be called again if an\n\t// exception is thrown.\n\tprivate flush = () => {\n\t\tconst { queue: q } = this\n\t\twhile (this.index < q.length) {\n\t\t\tconst currentIndex = this.index\n\t\t\t// Advance the index before calling the task. This ensures that we will\n\t\t\t// begin flushing on the next task the task throws an error.\n\t\t\tthis.index++\n\t\t\tq[currentIndex]!.call()\n\t\t\t// Prevent leaking memory for long chains of recursive calls to `asap`.\n\t\t\t// If we call `asap` within tasks scheduled by `asap`, the queue will\n\t\t\t// grow, but to avoid an O(n) walk for every task we execute, we don't\n\t\t\t// shift tasks off the queue after they have been executed.\n\t\t\t// Instead, we periodically shift 1024 tasks off the queue.\n\t\t\tif (this.index > this.capacity) {\n\t\t\t\t// Manually shift all values starting at the index back to the\n\t\t\t\t// beginning of the queue.\n\t\t\t\tfor (\n\t\t\t\t\tlet scan = 0, newLength = q.length - this.index;\n\t\t\t\t\tscan < newLength;\n\t\t\t\t\tscan++\n\t\t\t\t) {\n\t\t\t\t\tq[scan] = q[scan + this.index]!\n\t\t\t\t}\n\t\t\t\tq.length -= this.index\n\t\t\t\tthis.index = 0\n\t\t\t}\n\t\t}\n\t\tq.length = 0\n\t\tthis.index = 0\n\t\tthis.flushing = false\n\t}\n\n\t// In a web browser, exceptions are not fatal. However, to avoid\n\t// slowing down the queue of pending tasks, we rethrow the error in a\n\t// lower priority turn.\n\tpublic registerPendingError = (err: any) => {\n\t\tthis.pendingErrors.push(err)\n\t\tthis.requestErrorThrow()\n\t}\n}\n\n// The message channel technique was discovered by Malte Ubl and was the\n// original foundation for this library.\n// http://www.nonblocking.io/2011/06/windownexttick.html\n\n// Safari 6.0.5 (at least) intermittently fails to create message ports on a\n// page's first load. Thankfully, this version of Safari supports\n// MutationObservers, so we don't need to fall back in that case.\n\n// function makeRequestCallFromMessageChannel(callback) {\n// var channel = new MessageChannel();\n// channel.port1.onmessage = callback;\n// return function requestCall() {\n// channel.port2.postMessage(0);\n// };\n// }\n\n// For reasons explained above, we are also unable to use `setImmediate`\n// under any circumstances.\n// Even if we were, there is another bug in Internet Explorer 10.\n// It is not sufficient to assign `setImmediate` to `requestFlush` because\n// `setImmediate` must be called *by name* and therefore must be wrapped in a\n// closure.\n// Never forget.\n\n// function makeRequestCallFromSetImmediate(callback) {\n// return function requestCall() {\n// setImmediate(callback);\n// };\n// }\n\n// Safari 6.0 has a problem where timers will get lost while the user is\n// scrolling. This problem does not impact ASAP because Safari 6.0 supports\n// mutation observers, so that implementation is used instead.\n// However, if we ever elect to use timers in Safari, the prevalent work-around\n// is to add a scroll event listener that calls for a flush.\n\n// `setTimeout` does not call the passed callback if the delay is less than\n// approximately 7 in web workers in Firefox 8 through 18, and sometimes not\n// even then.\n\n// This is for `asap.js` only.\n// Its name will be periodically randomized to break any code that depends on\n// // its existence.\n// rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer\n\n// ASAP was originally a nextTick shim included in Q. This was factored out\n// into this ASAP package. It was later adapted to RSVP which made further\n// amendments. These decisions, particularly to marginalize MessageChannel and\n// to capture the MutationObserver implementation in a closure, were integrated\n// back into ASAP proper.\n// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js\n"],"names":["makeRequestCall","makeRequestCallFromTimer","AsapQueue","enqueueTask","task","queue","q","requestFlush","length","flushing","pendingErrors","index","capacity","flush","currentIndex","call","scan","newLength","registerPendingError","err","push","requestErrorThrow","shift"],"mappings":"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"}asap/dist/esm/types.mjs.map000064400000000264151701475610011663 0ustar00{"version":3,"sources":["../../src/types.ts"],"sourcesContent":["export interface Task {\n\tcall(): void\n}\nexport type TaskFn = () => void\n"],"names":[],"mappings":"AAAA,WAG+B"}asap/dist/esm/asap.mjs000064400000001340151701475610010663 0ustar00import { AsapQueue } from './AsapQueue.mjs'; import { TaskFactory } from './TaskFactory.mjs'; const asapQueue = new AsapQueue(); const taskFactory = new TaskFactory(asapQueue.registerPendingError); /** * Calls a task as soon as possible after returning, in its own event, with priority * over other events like animation, reflow, and repaint. An error thrown from an * event will not interrupt, nor even substantially slow down the processing of * other events, but will be rather postponed to a lower priority event. * @param {{call}} task A callable object, typically a function that takes no * arguments. */ export function asap(task) { asapQueue.enqueueTask(taskFactory.create(task)); } //# sourceMappingURL=asap.mjs.mapasap/README.md000064400000023504151701475610006762 0ustar00# ASAP [](https://travis-ci.org/kriskowal/asap) Promise and asynchronous observer libraries, as well as hand-rolled callback programs and libraries, often need a mechanism to postpone the running of a callback until the next available event. (See [Designing API’s for Asynchrony][zalgo].) The `asap` function runs a task **as soon as possible** but not before it returns, waiting only for the completion of the current event and previously scheduled tasks. ```javascript asap(function () { // ... }) ``` [zalgo]: http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony This CommonJS package provides an `asap` module that exports a function that ruts a task function _as soon as possible_. ASAP strives to schedule events to occur before yielding for IO, reflow, or redrawing. Each event receives an independent stack, with only platform code in parent frames and the events run in the order they are scheduled. ASAP provides a fast event queue that will run tasks until it is empty before yielding to the JavaScript engine's underlying event-loop. When a task gets added to a previously empty event queue, ASAP schedules a flush event, preferring for that event to occur before the JavaScript engine has an opportunity to perform IO tasks or rendering, thus making the first task and subsequent tasks semantically indistinguishable. ASAP uses a variety of techniques to preserve this invariant on different versions of browsers and Node.js. By design, ASAP prevents input events from being handled until the task queue is empty. If the process is busy enough, this may cause incoming connection requests to be dropped, and may cause existing connections to inform the sender to reduce the transmission rate or stall. ASAP allows this on the theory that, if there is enough work to do, there is no sense in looking for trouble. As a consequence, ASAP can interfere with smooth animation. If your task should be tied to the rendering loop, consider using `requestAnimationFrame` instead. A long sequence of tasks can also effect the long running script dialog. If this is a problem, you may be able to use ASAP’s cousin `setImmediate` to break long processes into shorter intervals and periodically allow the browser to breathe. `setImmediate` will yield for IO, reflow, and repaint events. It also returns a handler and can be canceled. For a `setImmediate` shim, consider [YuzuJS setImmediate][setimmediate]. [setimmediate]: https://github.com/YuzuJS/setImmediate Take care. ASAP can sustain infinite recursive calls without warning. It will not halt from a stack overflow, and it will not consume unbounded memory. This is behaviorally equivalent to an infinite loop. As with infinite loops, you can monitor a Node.js process for this behavior with a heart-beat signal. As with infinite loops, a very small amount of caution goes a long way to avoiding problems. ```javascript function loop() { asap(loop) } loop() ``` In browsers, if a task throws an exception, it will not interrupt the flushing of high-priority tasks. The exception will be postponed to a later, low-priority event to avoid slow-downs. In Node.js, if a task throws an exception, ASAP will resume flushing only if—and only after—the error is handled by `domain.on("error")` or `process.on("uncaughtException")`. ## Raw ASAP Checking for exceptions comes at a cost. The package also provides an `asap/raw` module that exports the underlying implementation which is faster but stalls if a task throws an exception. This internal version of the ASAP function does not check for errors. If a task does throw an error, it will stall the event queue unless you manually call `rawAsap.requestFlush()` before throwing the error, or any time after. In Node.js, `asap/raw` also runs all tasks outside any domain. If you need a task to be bound to your domain, you will have to do it manually. ```js if (process.domain) { task = process.domain.bind(task) } rawAsap(task) ``` ## Tasks A task may be any object that implements `call()`. A function will suffice, but closures tend not to be reusable and can cause garbage collector churn. Both `asap` and `rawAsap` accept task objects to give you the option of recycling task objects or using higher callable object abstractions. See the `asap` source for an illustration. ## Compatibility ASAP is tested on Node.js v0.10 and in a broad spectrum of web browsers. The following charts capture the browser test results for the most recent release. The first chart shows test results for ASAP running in the main window context. The second chart shows test results for ASAP running in a web worker context. Test results are inconclusive (grey) on browsers that do not support web workers. These data are captured automatically by [Continuous Integration][]. [continuous integration]: https://github.com/kriskowal/asap/blob/master/CONTRIBUTING.md   ## Caveats When a task is added to an empty event queue, it is not always possible to guarantee that the task queue will begin flushing immediately after the current event. However, once the task queue begins flushing, it will not yield until the queue is empty, even if the queue grows while running tasks. The following browsers allow the use of [DOM mutation observers][] to access the HTML [microtask queue][], and thus begin flushing ASAP's task queue immediately at the end of the current event loop turn, before any rendering or IO: [microtask queue]: http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#microtask-queue [dom mutation observers]: http://dom.spec.whatwg.org/#mutation-observers - Android 4–4.3 - Chrome 26–34 - Firefox 14–29 - Internet Explorer 11 - iPad Safari 6–7.1 - iPhone Safari 7–7.1 - Safari 6–7 In the absense of mutation observers, there are a few browsers, and situations like web workers in some of the above browsers, where [message channels][] would be a useful way to avoid falling back to timers. Message channels give direct access to the HTML [task queue][], so the ASAP task queue would flush after any already queued rendering and IO tasks, but without having the minimum delay imposed by timers. However, among these browsers, Internet Explorer 10 and Safari do not reliably dispatch messages, so they are not worth the trouble to implement. [message channels]: http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html#message-channels [task queue]: http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#concept-task - Internet Explorer 10 - Safair 5.0-1 - Opera 11-12 In the absense of mutation observers, these browsers and the following browsers all fall back to using `setTimeout` and `setInterval` to ensure that a `flush` occurs. The implementation uses both and cancels whatever handler loses the race, since `setTimeout` tends to occasionally skip tasks in unisolated circumstances. Timers generally delay the flushing of ASAP's task queue for four milliseconds. - Firefox 3–13 - Internet Explorer 6–10 - iPad Safari 4.3 - Lynx 2.8.7 ## Heritage ASAP has been factored out of the [Q][] asynchronous promise library. It originally had a naïve implementation in terms of `setTimeout`, but [Malte Ubl][nonblocking] provided an insight that `postMessage` might be useful for creating a high-priority, no-delay event dispatch hack. Since then, Internet Explorer proposed and implemented `setImmediate`. Robert Katić began contributing to Q by measuring the performance of the internal implementation of `asap`, paying particular attention to error recovery. Domenic, Robert, and Kris Kowal collectively settled on the current strategy of unrolling the high-priority event queue internally regardless of what strategy we used to dispatch the potentially lower-priority flush event. Domenic went on to make ASAP cooperate with Node.js domains. [q]: https://github.com/kriskowal/q [nonblocking]: http://www.nonblocking.io/2011/06/windownexttick.html For further reading, Nicholas Zakas provided a thorough article on [The Case for setImmediate][ncz]. [ncz]: http://www.nczonline.net/blog/2013/07/09/the-case-for-setimmediate/ Ember’s RSVP promise implementation later [adopted][rsvp asap] the name ASAP but further developed the implentation. Particularly, The `MessagePort` implementation was abandoned due to interaction [problems with Mobile Internet Explorer][ie problems] in favor of an implementation backed on the newer and more reliable DOM `MutationObserver` interface. These changes were back-ported into this library. [ie problems]: https://github.com/cujojs/when/issues/197 [rsvp asap]: https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js In addition, ASAP factored into `asap` and `asap/raw`, such that `asap` remained exception-safe, but `asap/raw` provided a tight kernel that could be used for tasks that guaranteed that they would not throw exceptions. This core is useful for promise implementations that capture thrown errors in rejected promises and do not need a second safety net. At the same time, the exception handling in `asap` was factored into separate implementations for Node.js and browsers, using the the [Browserify][browser config] `browser` property in `package.json` to instruct browser module loaders and bundlers, including [Browserify][], [Mr][], and [Mop][], to use the browser-only implementation. [browser config]: https://gist.github.com/defunctzombie/4339901 [browserify]: https://github.com/substack/node-browserify [mr]: https://github.com/montagejs/mr [mop]: https://github.com/montagejs/mop ## License Copyright 2009-2014 by Contributors MIT License (enclosed) asap/LICENSE.md000064400000002071151701475610007103 0ustar00Copyright 2009–2014 Contributors. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. asap/.swcrc000064400000000312151701475610006615 0ustar00{ "sourceMaps": true, "jsc": { "target": "es2017", "parser": { "syntax": "typescript", "tsx": true }, "transform": { "react": { "runtime": "automatic", "useBuiltins": true } } } } asap/tsconfig.json000064400000000323151701475610010204 0ustar00{ "extends": "../../tsconfig.base.json", "compilerOptions": { "baseUrl": "./src", "emitDeclarationOnly": true, "outDir": "dist/types", "types": ["node", "jest"] }, "include": ["./src"] }
/home/emeraadmin/www/node_modules/summernote/plugin/../../debug/../../src/../4d695/@react-dnd.tar