@rollup/pluginutils
Advanced tools
Comparing version 4.1.2 to 4.2.0
# @rollup/pluginutils ChangeLog | ||
## v4.2.0 | ||
_2022-03-07_ | ||
### Features | ||
- feat: support bigint and symbol in dataToEsm (#1047) | ||
## v4.1.2 | ||
@@ -4,0 +12,0 @@ |
@@ -332,3 +332,3 @@ 'use strict'; | ||
const pattern = getMatcherString(id, resolutionBase); | ||
const fn = pm__default['default'](pattern, { dot: true }); | ||
const fn = pm__default["default"](pattern, { dot: true }); | ||
const result = fn(what); | ||
@@ -398,20 +398,28 @@ return result; | ||
function serialize(obj, indent, baseIndent) { | ||
if (obj === Infinity) | ||
return 'Infinity'; | ||
if (obj === -Infinity) | ||
return '-Infinity'; | ||
if (obj === 0 && 1 / obj === -Infinity) | ||
return '-0'; | ||
if (obj instanceof Date) | ||
return `new Date(${obj.getTime()})`; | ||
if (obj instanceof RegExp) | ||
return obj.toString(); | ||
if (obj !== obj) | ||
return 'NaN'; // eslint-disable-line no-self-compare | ||
if (Array.isArray(obj)) | ||
return serializeArray(obj, indent, baseIndent); | ||
if (obj === null) | ||
return 'null'; | ||
if (typeof obj === 'object') | ||
if (typeof obj === 'object' && obj !== null) { | ||
if (Array.isArray(obj)) | ||
return serializeArray(obj, indent, baseIndent); | ||
if (obj instanceof Date) | ||
return `new Date(${obj.getTime()})`; | ||
if (obj instanceof RegExp) | ||
return obj.toString(); | ||
return serializeObject(obj, indent, baseIndent); | ||
} | ||
if (typeof obj === 'number') { | ||
if (obj === Infinity) | ||
return 'Infinity'; | ||
if (obj === -Infinity) | ||
return '-Infinity'; | ||
if (obj === 0) | ||
return 1 / obj === Infinity ? '0' : '-0'; | ||
if (obj !== obj) | ||
return 'NaN'; // eslint-disable-line no-self-compare | ||
} | ||
if (typeof obj === 'symbol') { | ||
const key = Symbol.keyFor(obj); | ||
if (key !== undefined) | ||
return `Symbol.for(${stringify(key)})`; | ||
} | ||
if (typeof obj === 'bigint') | ||
return `${obj}n`; | ||
return stringify(obj); | ||
@@ -466,5 +474,5 @@ } | ||
exports.dataToEsm = dataToEsm; | ||
exports.default = index; | ||
exports["default"] = index; | ||
exports.extractAssignedNames = extractAssignedNames; | ||
exports.makeLegalIdentifier = makeLegalIdentifier; | ||
exports.normalizePath = normalizePath; |
@@ -389,20 +389,28 @@ import { extname, win32, posix, isAbsolute, resolve } from 'path'; | ||
function serialize(obj, indent, baseIndent) { | ||
if (obj === Infinity) | ||
return 'Infinity'; | ||
if (obj === -Infinity) | ||
return '-Infinity'; | ||
if (obj === 0 && 1 / obj === -Infinity) | ||
return '-0'; | ||
if (obj instanceof Date) | ||
return `new Date(${obj.getTime()})`; | ||
if (obj instanceof RegExp) | ||
return obj.toString(); | ||
if (obj !== obj) | ||
return 'NaN'; // eslint-disable-line no-self-compare | ||
if (Array.isArray(obj)) | ||
return serializeArray(obj, indent, baseIndent); | ||
if (obj === null) | ||
return 'null'; | ||
if (typeof obj === 'object') | ||
if (typeof obj === 'object' && obj !== null) { | ||
if (Array.isArray(obj)) | ||
return serializeArray(obj, indent, baseIndent); | ||
if (obj instanceof Date) | ||
return `new Date(${obj.getTime()})`; | ||
if (obj instanceof RegExp) | ||
return obj.toString(); | ||
return serializeObject(obj, indent, baseIndent); | ||
} | ||
if (typeof obj === 'number') { | ||
if (obj === Infinity) | ||
return 'Infinity'; | ||
if (obj === -Infinity) | ||
return '-Infinity'; | ||
if (obj === 0) | ||
return 1 / obj === Infinity ? '0' : '-0'; | ||
if (obj !== obj) | ||
return 'NaN'; // eslint-disable-line no-self-compare | ||
} | ||
if (typeof obj === 'symbol') { | ||
const key = Symbol.keyFor(obj); | ||
if (key !== undefined) | ||
return `Symbol.for(${stringify(key)})`; | ||
} | ||
if (typeof obj === 'bigint') | ||
return `${obj}n`; | ||
return stringify(obj); | ||
@@ -453,3 +461,2 @@ } | ||
export default index; | ||
export { addExtension, attachScopes, createFilter, dataToEsm, extractAssignedNames, makeLegalIdentifier, normalizePath }; | ||
export { addExtension, attachScopes, createFilter, dataToEsm, index as default, extractAssignedNames, makeLegalIdentifier, normalizePath }; |
{ | ||
"name": "@rollup/pluginutils", | ||
"version": "4.1.2", | ||
"version": "4.2.0", | ||
"publishConfig": { | ||
@@ -65,3 +65,3 @@ "access": "public" | ||
"acorn": "^8.0.4", | ||
"rollup": "^2.23.0", | ||
"rollup": "^2.67.3", | ||
"typescript": "^4.1.2" | ||
@@ -68,0 +68,0 @@ }, |
50679
944