Init
This commit is contained in:
63
node_modules/@prefresh/utils/CHANGELOG.md
generated
vendored
Normal file
63
node_modules/@prefresh/utils/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
# @prefresh/utils
|
||||
|
||||
## 1.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [`e641c69`](https://github.com/preactjs/prefresh/commit/e641c69c610c3adeeb5dcb9e912d030a6fbb5229) [#499](https://github.com/preactjs/prefresh/pull/499) Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Publish automatically with npm provenance enabled
|
||||
|
||||
## 1.1.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`eb9aa93`](https://github.com/preactjs/prefresh/commit/eb9aa932fc2a01fed3ecb662e195422986529419) [#425](https://github.com/preactjs/prefresh/pull/425) Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Fix import paths for newer node versions
|
||||
|
||||
## 1.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`5d23ebc`](https://github.com/preactjs/prefresh/commit/5d23ebc771fd2da7e86e5b3a9479f97692c47e9d) [#240](https://github.com/preactjs/prefresh/pull/240) Thanks [@sidujjain](https://github.com/sidujjain)! - Fix exception in isComponent when exportValue is undefined
|
||||
|
||||
## 1.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [`39bcf44`](https://github.com/preactjs/prefresh/commit/39bcf44604c377ca493db9ebce1d75071107704b) [#238](https://github.com/preactjs/prefresh/pull/238) Thanks [@sidujjain](https://github.com/sidujjain)! - Add prototype-check to `@prefresh/utils` isComponent check and utilize this in nollup & webpack
|
||||
|
||||
## 1.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- [`25c683c`](https://github.com/preactjs/prefresh/commit/25c683cf47484ee1612ff0fcd677f788b00d8860) [#191](https://github.com/preactjs/prefresh/pull/191) Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Trim the utils down to only used methods
|
||||
|
||||
## 0.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`9e34c74`](https://github.com/preactjs/prefresh/commit/9e34c7408a5307f270681f2c7029180908a5538a) [#143](https://github.com/preactjs/prefresh/pull/143) Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Cleanup utils and core code
|
||||
|
||||
## 0.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [`32b7a6e`](https://github.com/preactjs/prefresh/commit/32b7a6e86036efd7363ae599317f3d3770a0a1bb) [#131](https://github.com/preactjs/prefresh/pull/131) Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Handle non-exported components correctly
|
||||
|
||||
## 0.2.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`23bdb37`](https://github.com/preactjs/prefresh/commit/23bdb376c9d20d986f669599c19a98bf991f290e) [#115](https://github.com/preactjs/prefresh/pull/115) Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Add .npmignore removing example
|
||||
|
||||
## 0.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [`520acd7`](https://github.com/preactjs/prefresh/commit/520acd75ea2a1414ccf8a614049f7b159f448a90) [#69](https://github.com/preactjs/prefresh/pull/69) Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Add export maps for Node 13/14
|
||||
|
||||
## 0.1.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`846eec0`](https://github.com/preactjs/prefresh/commit/846eec0a77ba8f9b8e1ea36bfc0dd6a6ad7ba94c) [#44](https://github.com/preactjs/prefresh/pull/44) Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Add esm + CJS exports
|
||||
|
||||
- Add ESM export
|
22
node_modules/@prefresh/utils/LICENSE
generated
vendored
Normal file
22
node_modules/@prefresh/utils/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2020-2021 Jovi De Croock
|
||||
Copyright (c) 2021-Present Preact Team
|
||||
|
||||
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.
|
3
node_modules/@prefresh/utils/README.md
generated
vendored
Normal file
3
node_modules/@prefresh/utils/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Prefresh-utils
|
||||
|
||||
[](https://www.npmjs.com/package/@prefresh/utils)
|
46
node_modules/@prefresh/utils/dist/src/index.js
generated
vendored
Normal file
46
node_modules/@prefresh/utils/dist/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
const compareSignatures = (prev, next) => {
|
||||
const prevSignature = self.__PREFRESH__.getSignature(prev) || {};
|
||||
const nextSignature = self.__PREFRESH__.getSignature(next) || {};
|
||||
|
||||
if (
|
||||
prevSignature.key !== nextSignature.key ||
|
||||
self.__PREFRESH__.computeKey(prevSignature) !==
|
||||
self.__PREFRESH__.computeKey(nextSignature) ||
|
||||
nextSignature.forceReset
|
||||
) {
|
||||
self.__PREFRESH__.replaceComponent(prev, next, true);
|
||||
} else {
|
||||
self.__PREFRESH__.replaceComponent(prev, next, false);
|
||||
}
|
||||
};
|
||||
|
||||
const flush = () => {
|
||||
const pending = [...self.__PREFRESH__.getPendingUpdates()];
|
||||
self.__PREFRESH__.flush();
|
||||
|
||||
if (pending.length > 0) {
|
||||
pending.forEach(([prev, next]) => {
|
||||
compareSignatures(prev, next);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const isComponent = exportValue => {
|
||||
if (typeof exportValue === 'function') {
|
||||
if (
|
||||
exportValue.prototype != null &&
|
||||
exportValue.prototype.isReactComponent
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const name = exportValue.name || exportValue.displayName;
|
||||
return (
|
||||
typeof name === 'string' && name[0] && name[0] == name[0].toUpperCase()
|
||||
);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
exports.flush=flush;
|
||||
exports.isComponent=isComponent;
|
33
node_modules/@prefresh/utils/package.json
generated
vendored
Normal file
33
node_modules/@prefresh/utils/package.json
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "@prefresh/utils",
|
||||
"version": "1.2.0",
|
||||
"module": "src/index.js",
|
||||
"main": "dist/src/index.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./src/index.js",
|
||||
"require": "./dist/src/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/preactjs/prefresh.git",
|
||||
"directory": "packages/utils"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/preactjs/prefresh/issues"
|
||||
},
|
||||
"homepage": "https://github.com/preactjs/prefresh#readme",
|
||||
"devDependencies": {
|
||||
"cjyes": "0.3.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"provenance": true
|
||||
},
|
||||
"scripts": {
|
||||
"build": "cjyes src/index.js",
|
||||
"lint": "eslint src"
|
||||
}
|
||||
}
|
43
node_modules/@prefresh/utils/src/index.js
generated
vendored
Normal file
43
node_modules/@prefresh/utils/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
const compareSignatures = (prev, next) => {
|
||||
const prevSignature = self.__PREFRESH__.getSignature(prev) || {};
|
||||
const nextSignature = self.__PREFRESH__.getSignature(next) || {};
|
||||
|
||||
if (
|
||||
prevSignature.key !== nextSignature.key ||
|
||||
self.__PREFRESH__.computeKey(prevSignature) !==
|
||||
self.__PREFRESH__.computeKey(nextSignature) ||
|
||||
nextSignature.forceReset
|
||||
) {
|
||||
self.__PREFRESH__.replaceComponent(prev, next, true);
|
||||
} else {
|
||||
self.__PREFRESH__.replaceComponent(prev, next, false);
|
||||
}
|
||||
};
|
||||
|
||||
export const flush = () => {
|
||||
const pending = [...self.__PREFRESH__.getPendingUpdates()];
|
||||
self.__PREFRESH__.flush();
|
||||
|
||||
if (pending.length > 0) {
|
||||
pending.forEach(([prev, next]) => {
|
||||
compareSignatures(prev, next);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export const isComponent = exportValue => {
|
||||
if (typeof exportValue === 'function') {
|
||||
if (
|
||||
exportValue.prototype != null &&
|
||||
exportValue.prototype.isReactComponent
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const name = exportValue.name || exportValue.displayName;
|
||||
return (
|
||||
typeof name === 'string' && name[0] && name[0] == name[0].toUpperCase()
|
||||
);
|
||||
}
|
||||
return false;
|
||||
};
|
Reference in New Issue
Block a user