| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,215 +8,103 @@ import fs$1 from 'node:fs'; | |||
| 8 | 8 | import os from 'node:os'; | |
| 9 | 9 | import tty from 'node:tty'; | |
| 10 | 10 | ||
| 11 | - const VOID = -1; | ||
| 12 | - const PRIMITIVE = 0; | ||
| 13 | - const ARRAY = 1; | ||
| 14 | - const OBJECT = 2; | ||
| 15 | - const DATE = 3; | ||
| 16 | - const REGEXP = 4; | ||
| 17 | - const MAP = 5; | ||
| 18 | - const SET = 6; | ||
| 19 | - const ERROR = 7; | ||
| 20 | - const BIGINT = 8; | ||
| 21 | - | ||
| 22 | - const env$1 = typeof self === 'object' ? self : globalThis; | ||
| 23 | - const deserializer = ($, _) => { | ||
| 24 | - const as = (out, index) => { | ||
| 25 | - $.set(index, out); | ||
| 26 | - return out; | ||
| 27 | - }; | ||
| 28 | - const unpair = index => { | ||
| 29 | - if ($.has(index)) | ||
| 30 | - return $.get(index); | ||
| 31 | - const [type, value] = _[index]; | ||
| 32 | - switch (type) { | ||
| 33 | - case PRIMITIVE: | ||
| 34 | - case VOID: | ||
| 35 | - return as(value, index); | ||
| 36 | - case ARRAY: { | ||
| 37 | - const arr = as([], index); | ||
| 38 | - for (const index of value) | ||
| 39 | - arr.push(unpair(index)); | ||
| 40 | - return arr; | ||
| 41 | - } | ||
| 42 | - case OBJECT: { | ||
| 43 | - const object = as({}, index); | ||
| 44 | - for (const [key, index] of value) | ||
| 45 | - object[unpair(key)] = unpair(index); | ||
| 46 | - return object; | ||
| 47 | - } | ||
| 48 | - case DATE: | ||
| 49 | - return as(new Date(value), index); | ||
| 50 | - case REGEXP: { | ||
| 51 | - const {source, flags} = value; | ||
| 52 | - return as(new RegExp(source, flags), index); | ||
| 53 | - } | ||
| 54 | - case MAP: { | ||
| 55 | - const map = as(new Map, index); | ||
| 56 | - for (const [key, index] of value) | ||
| 57 | - map.set(unpair(key), unpair(index)); | ||
| 58 | - return map; | ||
| 59 | - } | ||
| 60 | - case SET: { | ||
| 61 | - const set = as(new Set, index); | ||
| 62 | - for (const index of value) | ||
| 63 | - set.add(unpair(index)); | ||
| 64 | - return set; | ||
| 65 | - } | ||
| 66 | - case ERROR: { | ||
| 67 | - const {name, message} = value; | ||
| 68 | - return as(new env$1[name](message), index); | ||
| 69 | - } | ||
| 70 | - case BIGINT: | ||
| 71 | - return as(BigInt(value), index); | ||
| 72 | - case 'BigInt': | ||
| 73 | - return as(Object(BigInt(value)), index); | ||
| 74 | - } | ||
| 75 | - return as(new env$1[type](value), index); | ||
| 76 | - }; | ||
| 77 | - return unpair; | ||
| 78 | - }; | ||
| 79 | - const deserialize = serialized => deserializer(new Map, serialized)(0); | ||
| 80 | - | ||
| 81 | - const EMPTY = ''; | ||
| 82 | - const {toString: toString$1} = {}; | ||
| 83 | - const {keys} = Object; | ||
| 84 | - const typeOf = value => { | ||
| 85 | - const type = typeof value; | ||
| 86 | - if (type !== 'object' || !value) | ||
| 87 | - return [PRIMITIVE, type]; | ||
| 88 | - const asString = toString$1.call(value).slice(8, -1); | ||
| 89 | - switch (asString) { | ||
| 90 | - case 'Array': | ||
| 91 | - return [ARRAY, EMPTY]; | ||
| 92 | - case 'Object': | ||
| 93 | - return [OBJECT, EMPTY]; | ||
| 94 | - case 'Date': | ||
| 95 | - return [DATE, EMPTY]; | ||
| 96 | - case 'RegExp': | ||
| 97 | - return [REGEXP, EMPTY]; | ||
| 98 | - case 'Map': | ||
| 99 | - return [MAP, EMPTY]; | ||
| 100 | - case 'Set': | ||
| 101 | - return [SET, EMPTY]; | ||
| 102 | - } | ||
| 103 | - if (asString.includes('Array')) | ||
| 104 | - return [ARRAY, asString]; | ||
| 105 | - if (asString.includes('Error')) | ||
| 106 | - return [ERROR, asString]; | ||
| 107 | - return [OBJECT, asString]; | ||
| 108 | - }; | ||
| 109 | - const shouldSkip = ([TYPE, type]) => ( | ||
| 110 | - TYPE === PRIMITIVE && | ||
| 111 | - (type === 'function' || type === 'symbol') | ||
| 112 | - ); | ||
| 113 | - const serializer = (strict, json, $, _) => { | ||
| 114 | - const as = (out, value) => { | ||
| 115 | - const index = _.push(out) - 1; | ||
| 116 | - $.set(value, index); | ||
| 117 | - return index; | ||
| 118 | - }; | ||
| 119 | - const pair = value => { | ||
| 120 | - if ($.has(value)) | ||
| 121 | - return $.get(value); | ||
| 122 | - let [TYPE, type] = typeOf(value); | ||
| 123 | - switch (TYPE) { | ||
| 124 | - case PRIMITIVE: { | ||
| 125 | - let entry = value; | ||
| 126 | - switch (type) { | ||
| 127 | - case 'bigint': | ||
| 128 | - TYPE = BIGINT; | ||
| 129 | - entry = value.toString(); | ||
| 130 | - break; | ||
| 131 | - case 'function': | ||
| 132 | - case 'symbol': | ||
| 133 | - if (strict) | ||
| 134 | - throw new TypeError('unable to serialize ' + type); | ||
| 135 | - entry = null; | ||
| 136 | - break; | ||
| 137 | - case 'undefined': | ||
| 138 | - return as([VOID], value); | ||
| 139 | - } | ||
| 140 | - return as([TYPE, entry], value); | ||
| 141 | - } | ||
| 142 | - case ARRAY: { | ||
| 143 | - if (type) | ||
| 144 | - return as([type, [...value]], value); | ||
| 145 | - const arr = []; | ||
| 146 | - const index = as([TYPE, arr], value); | ||
| 147 | - for (const entry of value) | ||
| 148 | - arr.push(pair(entry)); | ||
| 149 | - return index; | ||
| 150 | - } | ||
| 151 | - case OBJECT: { | ||
| 152 | - if (type) { | ||
| 153 | - switch (type) { | ||
| 154 | - case 'BigInt': | ||
| 155 | - return as([type, value.toString()], value); | ||
| 156 | - case 'Boolean': | ||
| 157 | - case 'Number': | ||
| 158 | - case 'String': | ||
| 159 | - return as([type, value.valueOf()], value); | ||
| 160 | - } | ||
| 161 | - } | ||
| 162 | - if (json && ('toJSON' in value)) | ||
| 163 | - return pair(value.toJSON()); | ||
| 164 | - const entries = []; | ||
| 165 | - const index = as([TYPE, entries], value); | ||
| 166 | - for (const key of keys(value)) { | ||
| 167 | - if (strict || !shouldSkip(typeOf(value[key]))) | ||
| 168 | - entries.push([pair(key), pair(value[key])]); | ||
| 169 | - } | ||
| 170 | - return index; | ||
| 171 | - } | ||
| 172 | - case DATE: | ||
| 173 | - return as([TYPE, value.toISOString()], value); | ||
| 174 | - case REGEXP: { | ||
| 175 | - const {source, flags} = value; | ||
| 176 | - return as([TYPE, {source, flags}], value); | ||
| 177 | - } | ||
| 178 | - case MAP: { | ||
| 179 | - const entries = []; | ||
| 180 | - const index = as([TYPE, entries], value); | ||
| 181 | - for (const [key, entry] of value) { | ||
| 182 | - if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry)))) | ||
| 183 | - entries.push([pair(key), pair(entry)]); | ||
| 184 | - } | ||
| 185 | - return index; | ||
| 186 | - } | ||
| 187 | - case SET: { | ||
| 188 | - const entries = []; | ||
| 189 | - const index = as([TYPE, entries], value); | ||
| 190 | - for (const entry of value) { | ||
| 191 | - if (strict || !shouldSkip(typeOf(entry))) | ||
| 192 | - entries.push(pair(entry)); | ||
| 193 | - } | ||
| 194 | - return index; | ||
| 195 | - } | ||
| 196 | - } | ||
| 197 | - const {message} = value; | ||
| 198 | - return as([TYPE, {name: type, message}], value); | ||
| 199 | - }; | ||
| 200 | - return pair; | ||
| 201 | - }; | ||
| 202 | - const serialize$1 = (value, {json, lossy} = {}) => { | ||
| 203 | - const _ = []; | ||
| 204 | - return serializer(!(json || lossy), !!json, new Map, _)(value), _; | ||
| 205 | - }; | ||
| 206 | - | ||
| 207 | - var structuredClone$1 = typeof structuredClone === "function" ? | ||
| 208 | - (any, options) => ( | ||
| 209 | - options && ('json' in options || 'lossy' in options) ? | ||
| 210 | - deserialize(serialize$1(any, options)) : structuredClone(any) | ||
| 211 | - ) : | ||
| 212 | - (any, options) => deserialize(serialize$1(any, options)); | ||
| 213 | - | ||
| 214 | 11 | function bail(error) { | |
| 215 | 12 | if (error) { | |
| 216 | 13 | throw error | |
| 217 | 14 | } | |
| 218 | 15 | } | |
| 219 | 16 | ||
| 17 | + var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
| 18 | + | ||
| 19 | + function getDefaultExportFromCjs (x) { | ||
| 20 | + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + var hasOwn = Object.prototype.hasOwnProperty; | ||
| 24 | + var toStr = Object.prototype.toString; | ||
| 25 | + var defineProperty = Object.defineProperty; | ||
| 26 | + var gOPD = Object.getOwnPropertyDescriptor; | ||
| 27 | + var isArray = function isArray(arr) { | ||
| 28 | + if (typeof Array.isArray === 'function') { | ||
| 29 | + return Array.isArray(arr); | ||
| 30 | + } | ||
| 31 | + return toStr.call(arr) === '[object Array]'; | ||
| 32 | + }; | ||
| 33 | + var isPlainObject$1 = function isPlainObject(obj) { | ||
| 34 | + if (!obj || toStr.call(obj) !== '[object Object]') { | ||
| 35 | + return false; | ||
| 36 | + } | ||
| 37 | + var hasOwnConstructor = hasOwn.call(obj, 'constructor'); | ||
| 38 | + var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); | ||
| 39 | + if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { | ||
| 40 | + return false; | ||
| 41 | + } | ||
| 42 | + var key; | ||
| 43 | + for (key in obj) { } | ||
| 44 | + return typeof key === 'undefined' || hasOwn.call(obj, key); | ||
| 45 | + }; | ||
| 46 | + var setProperty = function setProperty(target, options) { | ||
| 47 | + if (defineProperty && options.name === '__proto__') { | ||
| 48 | + defineProperty(target, options.name, { | ||
| 49 | + enumerable: true, | ||
| 50 | + configurable: true, | ||
| 51 | + value: options.newValue, | ||
| 52 | + writable: true | ||
| 53 | + }); | ||
| 54 | + } else { | ||
| 55 | + target[options.name] = options.newValue; | ||
| 56 | + } | ||
| 57 | + }; | ||
| 58 | + var getProperty = function getProperty(obj, name) { | ||
| 59 | + if (name === '__proto__') { | ||
| 60 | + if (!hasOwn.call(obj, name)) { | ||
| 61 | + return void 0; | ||
| 62 | + } else if (gOPD) { | ||
| 63 | + return gOPD(obj, name).value; | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + return obj[name]; | ||
| 67 | + }; | ||
| 68 | + var extend$1 = function extend() { | ||
| 69 | + var options, name, src, copy, copyIsArray, clone; | ||
| 70 | + var target = arguments[0]; | ||
| 71 | + var i = 1; | ||
| 72 | + var length = arguments.length; | ||
| 73 | + var deep = false; | ||
| 74 | + if (typeof target === 'boolean') { | ||
| 75 | + deep = target; | ||
| 76 | + target = arguments[1] || {}; | ||
| 77 | + i = 2; | ||
| 78 | + } | ||
| 79 | + if (target == null || (typeof target !== 'object' && typeof target !== 'function')) { | ||
| 80 | + target = {}; | ||
| 81 | + } | ||
| 82 | + for (; i < length; ++i) { | ||
| 83 | + options = arguments[i]; | ||
| 84 | + if (options != null) { | ||
| 85 | + for (name in options) { | ||
| 86 | + src = getProperty(target, name); | ||
| 87 | + copy = getProperty(options, name); | ||
| 88 | + if (target !== copy) { | ||
| 89 | + if (deep && copy && (isPlainObject$1(copy) || (copyIsArray = isArray(copy)))) { | ||
| 90 | + if (copyIsArray) { | ||
| 91 | + copyIsArray = false; | ||
| 92 | + clone = src && isArray(src) ? src : []; | ||
| 93 | + } else { | ||
| 94 | + clone = src && isPlainObject$1(src) ? src : {}; | ||
| 95 | + } | ||
| 96 | + setProperty(target, { name: name, newValue: extend(deep, clone, copy) }); | ||
| 97 | + } else if (typeof copy !== 'undefined') { | ||
| 98 | + setProperty(target, { name: name, newValue: copy }); | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + return target; | ||
| 105 | + }; | ||
| 106 | + var extend$2 = getDefaultExportFromCjs(extend$1); | ||
| 107 | + | ||
| 220 | 108 | function isPlainObject(value) { | |
| 221 | 109 | if (typeof value !== 'object' || value === null) { | |
| 222 | 110 | return false; | |
@@ -646,7 +534,7 @@ class Processor extends CallableInstance { | |||
| 646 | 534 | const attacher = this.attachers[index]; | |
| 647 | 535 | destination.use(...attacher); | |
| 648 | 536 | } | |
| 649 | - destination.data(structuredClone$1(this.namespace)); | ||
| 537 | + destination.data(extend$2(true, {}, this.namespace)); | ||
| 650 | 538 | return destination | |
| 651 | 539 | } | |
| 652 | 540 | data(key, value) { | |
@@ -834,10 +722,7 @@ class Processor extends CallableInstance { | |||
| 834 | 722 | } | |
| 835 | 723 | addList(result.plugins); | |
| 836 | 724 | if (result.settings) { | |
| 837 | - namespace.settings = { | ||
| 838 | - ...namespace.settings, | ||
| 839 | - ...structuredClone$1(result.settings) | ||
| 840 | - }; | ||
| 725 | + namespace.settings = extend$2(true, namespace.settings, result.settings); | ||
| 841 | 726 | } | |
| 842 | 727 | } | |
| 843 | 728 | function addList(plugins) { | |
@@ -867,7 +752,7 @@ class Processor extends CallableInstance { | |||
| 867 | 752 | let [primary, ...rest] = parameters; | |
| 868 | 753 | const currentPrimary = attachers[entryIndex][1]; | |
| 869 | 754 | if (isPlainObject(currentPrimary) && isPlainObject(primary)) { | |
| 870 | - primary = structuredClone$1({...currentPrimary, ...primary}); | ||
| 755 | + primary = extend$2(true, currentPrimary, primary); | ||
| 871 | 756 | } | |
| 872 | 757 | attachers[entryIndex] = [plugin, primary, ...rest]; | |
| 873 | 758 | } | |
@@ -12546,12 +12431,6 @@ const remarkLintFinalNewline = lintRule( | |||
| 12546 | 12431 | ); | |
| 12547 | 12432 | var remarkLintFinalNewline$1 = remarkLintFinalNewline; | |
| 12548 | 12433 | ||
| 12549 | - var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
| 12550 | - | ||
| 12551 | - function getDefaultExportFromCjs (x) { | ||
| 12552 | - return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; | ||
| 12553 | - } | ||
| 12554 | - | ||
| 12555 | 12434 | function commonjsRequire(path) { | |
| 12556 | 12435 | throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); | |
| 12557 | 12436 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments