tungsten 0.4.12 → 0.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.build-complete +1 -1
- package/dist/AnyComponent.d.ts.map +1 -1
- package/dist/Components.d.ts +40 -0
- package/dist/Components.d.ts.map +1 -1
- package/dist/Components.js +66 -77
- package/dist/DomPointer.js +1 -1
- package/dist/DomRegion.js +2 -2
- package/dist/Framework.js +1 -1
- package/dist/FrameworkConfig.d.ts.map +1 -1
- package/dist/Instance/Instance.js +1 -1
- package/dist/RenderedContentNode.d.ts.map +1 -1
- package/dist/RenderedContentNode.js +2 -1
- package/dist/Sass.d.ts.map +1 -1
- package/dist/Sass.js +1 -0
- package/dist/Servers/DevServer.d.ts.map +1 -1
- package/dist/Servers/DevServer.js +4 -3
- package/dist/Servers/ProdServer.js +1 -1
- package/dist/Servers/StaticSiteServer.js +1 -1
- package/dist/Servers/loadEnvsDev.d.ts +1 -1
- package/dist/Servers/loadEnvsDev.d.ts.map +1 -1
- package/dist/Servers/loadEnvsDev.js +4 -2
- package/dist/Servers/routing.d.ts.map +1 -1
- package/dist/Servers/routing.js +1 -1
- package/dist/Store/Store.js +1 -1
- package/dist/Store/TypeSafeStore.js +1 -1
- package/dist/Store/makeStore.js +1 -1
- package/dist/Store/registerStore.js +1 -1
- package/dist/TElement.js +1 -1
- package/dist/TungstenApp.js +6 -2
- package/dist/_client/cjsHelpers.d.ts.map +1 -1
- package/dist/_client/cjsHelpers.js +4 -2
- package/dist/_client/client.js +0 -14
- package/dist/_client/hmr.d.ts +2 -0
- package/dist/_client/hmr.d.ts.map +1 -0
- package/dist/_client/hmr.js +65 -0
- package/dist/_client/liveReload.d.ts +2 -0
- package/dist/_client/liveReload.d.ts.map +1 -0
- package/dist/_client/liveReload.js +6 -0
- package/dist/_client/liveReloadSource.d.ts +3 -0
- package/dist/_client/liveReloadSource.d.ts.map +1 -0
- package/dist/_client/liveReloadSource.js +25 -0
- package/dist/api/getExport.d.ts.map +1 -1
- package/dist/api/getExport.js +1 -0
- package/dist/babelPlugins/BabelTransformBindDirect.js +2 -0
- package/dist/babelPlugins/BabelTransformBindVar.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformComponentState.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformComponentStyles.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformComponentStyles.js +5 -4
- package/dist/babelPlugins/BabelTransformCssImports.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformCssImports.js +2 -2
- package/dist/babelPlugins/BabelTransformDependencyImportsOld.js +1 -1
- package/dist/babelPlugins/BabelTransformDeproxyState.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformPackageImports.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformPackageImports.js +10 -5
- package/dist/babelPlugins/BabelTransformRemoveBlocks.d.ts.map +1 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsCjs.d.ts.map +1 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsCjs.js +2 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsEsm.d.ts.map +1 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsEsm.js +2 -1
- package/dist/babelPlugins/transformPackageImports/getWebLocationOfPackageFile.js +1 -1
- package/dist/bin/args.js +1 -1
- package/dist/bin/commands/build.js +1 -1
- package/dist/bin/commands/compileSimplePackage.js +1 -0
- package/dist/bin/index.d.ts.map +1 -1
- package/dist/bin/index.js +11 -3
- package/dist/bin/vendorHook.d.ts +3 -0
- package/dist/bin/vendorHook.d.ts.map +1 -0
- package/dist/bin/vendorHook.js +34 -0
- package/dist/browserStorage.js +4 -2
- package/dist/build/babel.user.common.config.d.ts +2 -0
- package/dist/build/babel.user.common.config.d.ts.map +1 -1
- package/dist/build/babel.user.common.config.js +10 -4
- package/dist/build/bundle.d.ts.map +1 -1
- package/dist/build/bundle.js +10 -1
- package/dist/build/compileJavascript.d.ts.map +1 -1
- package/dist/build/compileJavascript.js +40 -27
- package/dist/build/compileStyles.js +4 -4
- package/dist/build/copyAssets.js +3 -3
- package/dist/build/copyPublicFiles.js +3 -3
- package/dist/build/createClientFiles.d.ts.map +1 -1
- package/dist/build/createClientFiles.js +4 -8
- package/dist/build/frameworkStylesheets.js +1 -1
- package/dist/build/getAllSxyClientModules.d.ts.map +1 -1
- package/dist/build/getAllSxyClientModules.js +4 -28
- package/dist/build/getSxyClientPackageAliases.d.ts.map +1 -1
- package/dist/build/getSxyClientPackageAliases.js +3 -1
- package/dist/build/makeBabelUserDevConfig.d.ts.map +1 -1
- package/dist/build/makeBabelUserProdConfig.d.ts.map +1 -1
- package/dist/build/rollupExtractComponentStylesheets.js +1 -1
- package/dist/build/sassImportParser.js +2 -2
- package/dist/build/tallyBabel.d.ts +3 -0
- package/dist/build/tallyBabel.d.ts.map +1 -0
- package/dist/build/tallyBabel.js +11 -0
- package/dist/clone.js +4 -4
- package/dist/compat/context.d.ts.map +1 -1
- package/dist/compat/types.d.ts.map +1 -1
- package/dist/componentProxyHandlers.d.ts +20 -13
- package/dist/componentProxyHandlers.d.ts.map +1 -1
- package/dist/componentProxyHandlers.js +134 -94
- package/dist/components/Stylesheet.d.ts +1 -2
- package/dist/components/Stylesheet.d.ts.map +1 -1
- package/dist/components/Stylesheet.js +1 -1
- package/dist/components/bindable/BindableCheckbox.d.ts.map +1 -1
- package/dist/components/bindable/BindableInput.d.ts.map +1 -1
- package/dist/components/bindable/BindableInputTypedLegacy.d.ts.map +1 -1
- package/dist/components/bindable/BindableRadio.d.ts.map +1 -1
- package/dist/components/bindable/BindableTextarea.d.ts.map +1 -1
- package/dist/components/library/RichTextEditor/RichTextEditor.js +2 -2
- package/dist/components/library/RichTextEditor/contentTree.js +1 -1
- package/dist/concat.d.ts.map +1 -1
- package/dist/concat.js +2 -2
- package/dist/copy.d.ts.map +1 -1
- package/dist/createRoutes.d.ts +1 -1
- package/dist/createRoutes.d.ts.map +1 -1
- package/dist/env/Env.js +2 -2
- package/dist/env/getEnvSchemas.d.ts +2 -2
- package/dist/env/getEnvSchemas.d.ts.map +1 -1
- package/dist/env/getEnvSchemas.js +7 -5
- package/dist/env/windowGlobalEnvStatement.d.ts.map +1 -1
- package/dist/findProjectDir.d.ts.map +1 -1
- package/dist/findProjectDir.js +18 -4
- package/dist/findUserConfig.js +2 -2
- package/dist/foreach.js +1 -0
- package/dist/frameworkConfigSchema.js +2 -2
- package/dist/getComponent.d.ts.map +1 -1
- package/dist/getComponentDev.d.ts.map +1 -1
- package/dist/getRoutes.d.ts.map +1 -1
- package/dist/getRoutes.js +13 -22
- package/dist/getRoutesDevs.d.ts.map +1 -1
- package/dist/getStackTrace.js +1 -1
- package/dist/glob.d.ts +5 -0
- package/dist/glob.d.ts.map +1 -0
- package/dist/glob.js +103 -0
- package/dist/helpers/getFetchCompatibleHeaders.js +2 -2
- package/dist/hmr/applyHmrModule.js +5 -5
- package/dist/hmr/componentIdentity.js +1 -1
- package/dist/hmr/instanceRegistry.js +2 -2
- package/dist/hooks/useReducer.d.ts.map +1 -1
- package/dist/hooks/useState.d.ts.map +1 -1
- package/dist/hooks/useState.js +2 -8
- package/dist/hydrate/hydrate.d.ts +1 -1
- package/dist/hydrate/hydrate.d.ts.map +1 -1
- package/dist/hydrate/hydrate.js +29 -25
- package/dist/hydrate/reconcileHydratedAttributes.js +2 -2
- package/dist/indexInner.d.ts +1 -1
- package/dist/indexInner.d.ts.map +1 -1
- package/dist/indexInner.js +1 -0
- package/dist/makeFinalConfig.d.ts.map +1 -1
- package/dist/makeFinalConfig.js +2 -2
- package/dist/markOptionSelected.js +1 -1
- package/dist/mergeConfigs.d.ts.map +1 -1
- package/dist/mergeConfigs.js +11 -2
- package/dist/mutatingFunctions.d.ts +2 -1
- package/dist/mutatingFunctions.d.ts.map +1 -1
- package/dist/mutatingFunctions.js +10 -4
- package/dist/postcssPlugins/TransformCssNames.js +2 -2
- package/dist/rawHtml/parseHtml.js +1 -1
- package/dist/render/componentNodeToRenderingTree.d.ts.map +1 -1
- package/dist/render/componentNodeToRenderingTree.js +6 -17
- package/dist/render/contentToHtml.d.ts.map +1 -1
- package/dist/render/contentToHtml.js +1 -1
- package/dist/render/getFunctionBodyAsString.d.ts.map +1 -1
- package/dist/render/getFunctionBodyAsString.js +2 -5
- package/dist/render/processHead.d.ts.map +1 -1
- package/dist/render/processHead.js +5 -34
- package/dist/render/processProps.js +2 -2
- package/dist/render/renderingTreeToHtml.d.ts.map +1 -1
- package/dist/render/rootToHtml.d.ts.map +1 -1
- package/dist/routing/Route.js +1 -1
- package/dist/routing/RouteDataFunction.type.d.ts.map +1 -1
- package/dist/routing/RoutesWithSafeParams.js +1 -1
- package/dist/routing/WebRedirect.d.ts.map +1 -1
- package/dist/routing/compareRequestToRegex.js +2 -2
- package/dist/routing/getPathPriority.js +1 -1
- package/dist/serverRpc.d.ts.map +1 -1
- package/dist/signals/tracking.d.ts +33 -0
- package/dist/signals/tracking.d.ts.map +1 -0
- package/dist/signals/tracking.js +87 -0
- package/dist/slash.d.ts +2 -0
- package/dist/slash.d.ts.map +1 -0
- package/dist/slash.js +5 -0
- package/dist/spawnShellCommand.js +1 -1
- package/dist/staticGen/staticGen.d.ts.map +1 -1
- package/dist/staticGen/staticGen.js +9 -7
- package/dist/staticGen/staticGenFunctions.js +1 -1
- package/dist/style/jssToCss.d.ts.map +1 -1
- package/dist/style/jssToCss.js +11 -9
- package/dist/style/unusedStyles.d.ts.map +1 -1
- package/dist/testing/host.js +11 -11
- package/dist/testing/hydrateTestApp.d.ts.map +1 -1
- package/dist/testing/hydrateTestApp.js +9 -9
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/installTestStyleProcessors.js +1 -1
- package/dist/testing/loadEnv.d.ts +4 -1
- package/dist/testing/loadEnv.d.ts.map +1 -1
- package/dist/testing/loadEnv.js +2 -2
- package/dist/testing/temp/componentPackageMock.js +3 -3
- package/dist/timeProfiler.d.ts +4 -0
- package/dist/timeProfiler.d.ts.map +1 -1
- package/dist/timeProfiler.js +16 -0
- package/dist/todo.js +2 -1
- package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
- package/dist/update/integrateUpdateVdom.js +17 -14
- package/dist/update/integrateUpdateVdomPrebuild.js +5 -5
- package/dist/warnOnFrameworkChange.js +1 -1
- package/dist/watch.js +2 -2
- package/package.json +14 -33
- package/types/modules.d.ts +0 -1
- package/vendor/babel-core.js +26 -0
- package/vendor/babel-parser.js +9 -0
- package/vendor/babel-plugin-syntax-import-assertions.js +50 -0
- package/vendor/babel-preset-react.js +872 -0
- package/vendor/babel-preset-typescript.js +26 -0
- package/vendor/babel-types.js +9 -0
- package/vendor/chalk-extensions.js +1994 -0
- package/vendor/chalk.js +647 -0
- package/vendor/chokidar.js +6889 -0
- package/vendor/chunk-1TN2rK3j.js +1218 -0
- package/vendor/chunk-1UuLTU0U.js +34 -0
- package/vendor/chunk-B_NeooyV.js +86 -0
- package/vendor/chunk-C12hSZn7.js +88 -0
- package/vendor/chunk-C3YkUGz5.js +19 -0
- package/vendor/chunk-C3fcZDjl.js +41964 -0
- package/vendor/chunk-C9FSKeSx.js +14603 -0
- package/vendor/chunk-CPArXGxa.js +14623 -0
- package/vendor/cjs-module-lexer.js +6 -0
- package/vendor/dotenv.js +412 -0
- package/vendor/express.js +40577 -0
- package/vendor/import-meta-resolve.js +2201 -0
- package/vendor/manifest.json +29 -0
- package/vendor/postcss.js +8546 -0
- package/vendor/serialize-javascript.js +293 -0
- package/vendor/sxy-lib-arrays.js +113 -0
- package/vendor/sxy-lib-object-copy.js +1781 -0
- package/vendor/sxy-lib-objects.js +156 -0
- package/vendor/sxy-lib-promises.js +47 -0
- package/vendor/sxy-package-investigator.js +202 -0
- package/vendor/valibot.js +7664 -0
- package/dist/Servers/hono/DevServerHono.d.ts +0 -2
- package/dist/Servers/hono/DevServerHono.d.ts.map +0 -1
- package/dist/Servers/hono/DevServerHono.js +0 -423
- package/dist/Servers/hono/ProdServerHono.d.ts +0 -2
- package/dist/Servers/hono/ProdServerHono.d.ts.map +0 -1
- package/dist/Servers/hono/ProdServerHono.js +0 -220
- package/dist/Servers/hono/TungstenServerHono.d.ts +0 -6
- package/dist/Servers/hono/TungstenServerHono.d.ts.map +0 -1
- package/dist/Servers/hono/TungstenServerHono.js +0 -36
- package/dist/api/ApiEndpointHono.d.ts +0 -3
- package/dist/api/ApiEndpointHono.d.ts.map +0 -1
- package/dist/api/ApiEndpointHono.js +0 -1
- package/dist/api/ApiRouteHono.d.ts +0 -7
- package/dist/api/ApiRouteHono.d.ts.map +0 -1
- package/dist/api/ApiRouteHono.js +0 -1
- package/dist/api/ApiRoutesHono.d.ts +0 -5
- package/dist/api/ApiRoutesHono.d.ts.map +0 -1
- package/dist/api/ApiRoutesHono.js +0 -1
- package/dist/api/getApiRoutesHono.d.ts +0 -6
- package/dist/api/getApiRoutesHono.d.ts.map +0 -1
- package/dist/api/getApiRoutesHono.js +0 -14
- package/dist/build/compilePackages.d.ts +0 -2
- package/dist/build/compilePackages.d.ts.map +0 -1
- package/dist/build/compilePackages.js +0 -89
- package/dist/build/findRequiredUserModule.d.ts +0 -2
- package/dist/build/findRequiredUserModule.d.ts.map +0 -1
- package/dist/build/findRequiredUserModule.js +0 -36
- package/dist/build/processPackage.d.ts +0 -4
- package/dist/build/processPackage.d.ts.map +0 -1
- package/dist/build/processPackage.js +0 -91
- package/dist/build/tallyBabelPlugins.d.ts +0 -3
- package/dist/build/tallyBabelPlugins.d.ts.map +0 -1
- package/dist/build/tallyBabelPlugins.js +0 -63
- package/dist/testing/loadEnvSetup.d.ts +0 -2
- package/dist/testing/loadEnvSetup.d.ts.map +0 -1
- package/dist/testing/loadEnvSetup.js +0 -7
- package/sxy-loader.config.js +0 -7
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { createRequire as __tungstenCreateRequire } from 'node:module';
|
|
2
|
+
const require = __tungstenCreateRequire(import.meta.url);
|
|
3
|
+
import require$$0 from 'crypto';
|
|
4
|
+
|
|
5
|
+
var randombytes;
|
|
6
|
+
var hasRequiredRandombytes;
|
|
7
|
+
|
|
8
|
+
function requireRandombytes () {
|
|
9
|
+
if (hasRequiredRandombytes) return randombytes;
|
|
10
|
+
hasRequiredRandombytes = 1;
|
|
11
|
+
randombytes = require$$0.randomBytes;
|
|
12
|
+
return randombytes;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
Copyright (c) 2014, Yahoo! Inc. All rights reserved.
|
|
17
|
+
Copyrights licensed under the New BSD License.
|
|
18
|
+
See the accompanying LICENSE file for terms.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
var serializeJavascript;
|
|
22
|
+
var hasRequiredSerializeJavascript;
|
|
23
|
+
|
|
24
|
+
function requireSerializeJavascript () {
|
|
25
|
+
if (hasRequiredSerializeJavascript) return serializeJavascript;
|
|
26
|
+
hasRequiredSerializeJavascript = 1;
|
|
27
|
+
|
|
28
|
+
var randomBytes = requireRandombytes();
|
|
29
|
+
|
|
30
|
+
// Generate an internal UID to make the regexp pattern harder to guess.
|
|
31
|
+
var UID_LENGTH = 16;
|
|
32
|
+
var UID = generateUID();
|
|
33
|
+
var PLACE_HOLDER_REGEXP = new RegExp('(\\\\)?"@__(F|R|D|M|S|A|U|I|B|L)-' + UID + '-(\\d+)__@"', 'g');
|
|
34
|
+
|
|
35
|
+
var IS_NATIVE_CODE_REGEXP = /\{\s*\[native code\]\s*\}/g;
|
|
36
|
+
var IS_PURE_FUNCTION = /function.*?\(/;
|
|
37
|
+
var IS_ARROW_FUNCTION = /.*?=>.*?/;
|
|
38
|
+
var UNSAFE_CHARS_REGEXP = /[<>\/\u2028\u2029]/g;
|
|
39
|
+
|
|
40
|
+
var RESERVED_SYMBOLS = ['*', 'async'];
|
|
41
|
+
|
|
42
|
+
// Mapping of unsafe HTML and invalid JavaScript line terminator chars to their
|
|
43
|
+
// Unicode char counterparts which are safe to use in JavaScript strings.
|
|
44
|
+
var ESCAPED_CHARS = {
|
|
45
|
+
'<' : '\\u003C',
|
|
46
|
+
'>' : '\\u003E',
|
|
47
|
+
'/' : '\\u002F',
|
|
48
|
+
'\u2028': '\\u2028',
|
|
49
|
+
'\u2029': '\\u2029'
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
function escapeUnsafeChars(unsafeChar) {
|
|
53
|
+
return ESCAPED_CHARS[unsafeChar];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function generateUID() {
|
|
57
|
+
var bytes = randomBytes(UID_LENGTH);
|
|
58
|
+
var result = '';
|
|
59
|
+
for(var i=0; i<UID_LENGTH; ++i) {
|
|
60
|
+
result += bytes[i].toString(16);
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function deleteFunctions(obj){
|
|
66
|
+
var functionKeys = [];
|
|
67
|
+
for (var key in obj) {
|
|
68
|
+
if (typeof obj[key] === "function") {
|
|
69
|
+
functionKeys.push(key);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
for (var i = 0; i < functionKeys.length; i++) {
|
|
73
|
+
delete obj[functionKeys[i]];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
serializeJavascript = function serialize(obj, options) {
|
|
78
|
+
options || (options = {});
|
|
79
|
+
|
|
80
|
+
// Backwards-compatibility for `space` as the second argument.
|
|
81
|
+
if (typeof options === 'number' || typeof options === 'string') {
|
|
82
|
+
options = {space: options};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
var functions = [];
|
|
86
|
+
var regexps = [];
|
|
87
|
+
var dates = [];
|
|
88
|
+
var maps = [];
|
|
89
|
+
var sets = [];
|
|
90
|
+
var arrays = [];
|
|
91
|
+
var undefs = [];
|
|
92
|
+
var infinities= [];
|
|
93
|
+
var bigInts = [];
|
|
94
|
+
var urls = [];
|
|
95
|
+
|
|
96
|
+
// Returns placeholders for functions and regexps (identified by index)
|
|
97
|
+
// which are later replaced by their string representation.
|
|
98
|
+
function replacer(key, value) {
|
|
99
|
+
|
|
100
|
+
// For nested function
|
|
101
|
+
if(options.ignoreFunction){
|
|
102
|
+
deleteFunctions(value);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (!value && value !== undefined && value !== BigInt(0)) {
|
|
106
|
+
return value;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// If the value is an object w/ a toJSON method, toJSON is called before
|
|
110
|
+
// the replacer runs, so we use this[key] to get the non-toJSONed value.
|
|
111
|
+
var origValue = this[key];
|
|
112
|
+
var type = typeof origValue;
|
|
113
|
+
|
|
114
|
+
if (type === 'object') {
|
|
115
|
+
if(origValue instanceof RegExp) {
|
|
116
|
+
return '@__R-' + UID + '-' + (regexps.push(origValue) - 1) + '__@';
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if(origValue instanceof Date) {
|
|
120
|
+
return '@__D-' + UID + '-' + (dates.push(origValue) - 1) + '__@';
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if(origValue instanceof Map) {
|
|
124
|
+
return '@__M-' + UID + '-' + (maps.push(origValue) - 1) + '__@';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if(origValue instanceof Set) {
|
|
128
|
+
return '@__S-' + UID + '-' + (sets.push(origValue) - 1) + '__@';
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if(origValue instanceof Array) {
|
|
132
|
+
var isSparse = origValue.filter(function(){return true}).length !== origValue.length;
|
|
133
|
+
if (isSparse) {
|
|
134
|
+
return '@__A-' + UID + '-' + (arrays.push(origValue) - 1) + '__@';
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if(origValue instanceof URL) {
|
|
139
|
+
return '@__L-' + UID + '-' + (urls.push(origValue) - 1) + '__@';
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (type === 'function') {
|
|
144
|
+
return '@__F-' + UID + '-' + (functions.push(origValue) - 1) + '__@';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (type === 'undefined') {
|
|
148
|
+
return '@__U-' + UID + '-' + (undefs.push(origValue) - 1) + '__@';
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (type === 'number' && !isNaN(origValue) && !isFinite(origValue)) {
|
|
152
|
+
return '@__I-' + UID + '-' + (infinities.push(origValue) - 1) + '__@';
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (type === 'bigint') {
|
|
156
|
+
return '@__B-' + UID + '-' + (bigInts.push(origValue) - 1) + '__@';
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return value;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function serializeFunc(fn) {
|
|
163
|
+
var serializedFn = fn.toString();
|
|
164
|
+
if (IS_NATIVE_CODE_REGEXP.test(serializedFn)) {
|
|
165
|
+
throw new TypeError('Serializing native function: ' + fn.name);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// pure functions, example: {key: function() {}}
|
|
169
|
+
if(IS_PURE_FUNCTION.test(serializedFn)) {
|
|
170
|
+
return serializedFn;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// arrow functions, example: arg1 => arg1+5
|
|
174
|
+
if(IS_ARROW_FUNCTION.test(serializedFn)) {
|
|
175
|
+
return serializedFn;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
var argsStartsAt = serializedFn.indexOf('(');
|
|
179
|
+
var def = serializedFn.substr(0, argsStartsAt)
|
|
180
|
+
.trim()
|
|
181
|
+
.split(' ')
|
|
182
|
+
.filter(function(val) { return val.length > 0 });
|
|
183
|
+
|
|
184
|
+
var nonReservedSymbols = def.filter(function(val) {
|
|
185
|
+
return RESERVED_SYMBOLS.indexOf(val) === -1
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// enhanced literal objects, example: {key() {}}
|
|
189
|
+
if(nonReservedSymbols.length > 0) {
|
|
190
|
+
return (def.indexOf('async') > -1 ? 'async ' : '') + 'function'
|
|
191
|
+
+ (def.join('').indexOf('*') > -1 ? '*' : '')
|
|
192
|
+
+ serializedFn.substr(argsStartsAt);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// arrow functions
|
|
196
|
+
return serializedFn;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Check if the parameter is function
|
|
200
|
+
if (options.ignoreFunction && typeof obj === "function") {
|
|
201
|
+
obj = undefined;
|
|
202
|
+
}
|
|
203
|
+
// Protects against `JSON.stringify()` returning `undefined`, by serializing
|
|
204
|
+
// to the literal string: "undefined".
|
|
205
|
+
if (obj === undefined) {
|
|
206
|
+
return String(obj);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
var str;
|
|
210
|
+
|
|
211
|
+
// Creates a JSON string representation of the value.
|
|
212
|
+
// NOTE: Node 0.12 goes into slow mode with extra JSON.stringify() args.
|
|
213
|
+
if (options.isJSON && !options.space) {
|
|
214
|
+
str = JSON.stringify(obj);
|
|
215
|
+
} else {
|
|
216
|
+
str = JSON.stringify(obj, options.isJSON ? null : replacer, options.space);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Protects against `JSON.stringify()` returning `undefined`, by serializing
|
|
220
|
+
// to the literal string: "undefined".
|
|
221
|
+
if (typeof str !== 'string') {
|
|
222
|
+
return String(str);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Replace unsafe HTML and invalid JavaScript line terminator chars with
|
|
226
|
+
// their safe Unicode char counterpart. This _must_ happen before the
|
|
227
|
+
// regexps and functions are serialized and added back to the string.
|
|
228
|
+
if (options.unsafe !== true) {
|
|
229
|
+
str = str.replace(UNSAFE_CHARS_REGEXP, escapeUnsafeChars);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (functions.length === 0 && regexps.length === 0 && dates.length === 0 && maps.length === 0 && sets.length === 0 && arrays.length === 0 && undefs.length === 0 && infinities.length === 0 && bigInts.length === 0 && urls.length === 0) {
|
|
233
|
+
return str;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Replaces all occurrences of function, regexp, date, map and set placeholders in the
|
|
237
|
+
// JSON string with their string representations. If the original value can
|
|
238
|
+
// not be found, then `undefined` is used.
|
|
239
|
+
return str.replace(PLACE_HOLDER_REGEXP, function (match, backSlash, type, valueIndex) {
|
|
240
|
+
// The placeholder may not be preceded by a backslash. This is to prevent
|
|
241
|
+
// replacing things like `"a\"@__R-<UID>-0__@"` and thus outputting
|
|
242
|
+
// invalid JS.
|
|
243
|
+
if (backSlash) {
|
|
244
|
+
return match;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (type === 'D') {
|
|
248
|
+
return "new Date(\"" + dates[valueIndex].toISOString() + "\")";
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (type === 'R') {
|
|
252
|
+
return "new RegExp(" + serialize(regexps[valueIndex].source) + ", \"" + regexps[valueIndex].flags + "\")";
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (type === 'M') {
|
|
256
|
+
return "new Map(" + serialize(Array.from(maps[valueIndex].entries()), options) + ")";
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (type === 'S') {
|
|
260
|
+
return "new Set(" + serialize(Array.from(sets[valueIndex].values()), options) + ")";
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (type === 'A') {
|
|
264
|
+
return "Array.prototype.slice.call(" + serialize(Object.assign({ length: arrays[valueIndex].length }, arrays[valueIndex]), options) + ")";
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
if (type === 'U') {
|
|
268
|
+
return 'undefined'
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if (type === 'I') {
|
|
272
|
+
return infinities[valueIndex];
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
if (type === 'B') {
|
|
276
|
+
return "BigInt(\"" + bigInts[valueIndex] + "\")";
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (type === 'L') {
|
|
280
|
+
return "new URL(" + serialize(urls[valueIndex].toString(), options) + ")";
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
var fn = functions[valueIndex];
|
|
284
|
+
|
|
285
|
+
return serializeFunc(fn);
|
|
286
|
+
});
|
|
287
|
+
};
|
|
288
|
+
return serializeJavascript;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
var serializeJavascriptExports = requireSerializeJavascript();
|
|
292
|
+
|
|
293
|
+
export { serializeJavascriptExports as default };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { createRequire as __tungstenCreateRequire } from 'node:module';
|
|
2
|
+
const require = __tungstenCreateRequire(import.meta.url);
|
|
3
|
+
var arrays = {};
|
|
4
|
+
|
|
5
|
+
var hasRequiredArrays;
|
|
6
|
+
|
|
7
|
+
function requireArrays () {
|
|
8
|
+
if (hasRequiredArrays) return arrays;
|
|
9
|
+
hasRequiredArrays = 1;
|
|
10
|
+
//const { packageName } = require('./config.js')
|
|
11
|
+
Object.defineProperty(arrays, "__esModule", { value: true });
|
|
12
|
+
arrays.mapSomeToObject = arrays.mapToObject = arrays.dedupeSlow = arrays.uniqueSlow = arrays.process = arrays.add = arrays.removeAndReturn = arrays.remove = void 0;
|
|
13
|
+
////////////////////////////////////////
|
|
14
|
+
// .remove
|
|
15
|
+
////////////////////////////////////////
|
|
16
|
+
function remove(array, ...removeValues) {
|
|
17
|
+
for (const removeValue of removeValues) {
|
|
18
|
+
let i = 0;
|
|
19
|
+
let length = array.length;
|
|
20
|
+
for (; i < length; i++) {
|
|
21
|
+
if (array[i] === removeValue) {
|
|
22
|
+
array.splice(i, 1);
|
|
23
|
+
length--;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
arrays.remove = remove;
|
|
29
|
+
//////////////////////////////////////
|
|
30
|
+
// .removeAndReturn
|
|
31
|
+
//////////////////////////////////////
|
|
32
|
+
function removeAndReturn(array, removeValue) {
|
|
33
|
+
return array.filter(value => value !== removeValue);
|
|
34
|
+
}
|
|
35
|
+
arrays.removeAndReturn = removeAndReturn;
|
|
36
|
+
////////////////////////////////////////
|
|
37
|
+
// .add
|
|
38
|
+
////////////////////////////////////////
|
|
39
|
+
function add(array, ...values) {
|
|
40
|
+
array.push(...values);
|
|
41
|
+
}
|
|
42
|
+
arrays.add = add;
|
|
43
|
+
function process(array, func) {
|
|
44
|
+
for (const k in array) {
|
|
45
|
+
array[k] = func(array[k], k, array);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
arrays.process = process;
|
|
49
|
+
////////////////////////////////////////
|
|
50
|
+
// .uniqueSlow
|
|
51
|
+
////////////////////////////////////////
|
|
52
|
+
function uniqueSlow(array) {
|
|
53
|
+
for (let i = 0; i < array.length; i++) {
|
|
54
|
+
for (let j = i + 1; j < array.length; j++) {
|
|
55
|
+
if (array[i] === array[j])
|
|
56
|
+
array.splice(j--, 1);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return array;
|
|
60
|
+
}
|
|
61
|
+
arrays.uniqueSlow = uniqueSlow;
|
|
62
|
+
////////////////////////////////////////
|
|
63
|
+
// .dedupeSlow
|
|
64
|
+
////////////////////////////////////////
|
|
65
|
+
function dedupeSlow(array) { return uniqueSlow(array); }
|
|
66
|
+
arrays.dedupeSlow = dedupeSlow;
|
|
67
|
+
////////////////////////////////////////
|
|
68
|
+
// .mapToObject
|
|
69
|
+
////////////////////////////////////////
|
|
70
|
+
// export type MapToObjectFunction<A extends readonly unknown[], K extends string | number | symbol, V>
|
|
71
|
+
// = (value: A[number], index: number, array: A) => [key: K, value: V]
|
|
72
|
+
function mapToObject(array, func) {
|
|
73
|
+
const returnObj = {};
|
|
74
|
+
for (let i = 0; i < array.length; i++) {
|
|
75
|
+
const objData = func(array[i], i, array);
|
|
76
|
+
const [key, value] = objData;
|
|
77
|
+
returnObj[key] = value;
|
|
78
|
+
}
|
|
79
|
+
return returnObj;
|
|
80
|
+
}
|
|
81
|
+
arrays.mapToObject = mapToObject;
|
|
82
|
+
////////////////////////////////////////
|
|
83
|
+
// .mapSomeToObject
|
|
84
|
+
////////////////////////////////////////
|
|
85
|
+
// export type MapSomeToObjectFunction<A extends readonly unknown[], K extends string | symbol, V>
|
|
86
|
+
// = (value: A[number], index: number, array: A) => [key: K, value: V] | null | undefined | false
|
|
87
|
+
function mapSomeToObject(array, func) {
|
|
88
|
+
const returnObj = {};
|
|
89
|
+
for (let i = 0; i < array.length; i++) {
|
|
90
|
+
const objData = func(array[i], i, array);
|
|
91
|
+
if (objData) {
|
|
92
|
+
const [key, value] = objData;
|
|
93
|
+
returnObj[key] = value;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return returnObj;
|
|
97
|
+
}
|
|
98
|
+
arrays.mapSomeToObject = mapSomeToObject;
|
|
99
|
+
// const a = mapToObject(['a', 'b', 'c'], (v) => [v, v])
|
|
100
|
+
// function f<K extends string>() {
|
|
101
|
+
// const o: Record<K, boolean> = {}
|
|
102
|
+
// }
|
|
103
|
+
// const o1: Record<string, boolean> = {}
|
|
104
|
+
// const o2: Record<'foo', boolean | undefined> = {}
|
|
105
|
+
// const o3: { [Key in 'foo']?: boolean } = {}
|
|
106
|
+
return arrays;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
var arraysExports = requireArrays();
|
|
110
|
+
|
|
111
|
+
const __v0 = arraysExports["__esModule"];const __v1 = arraysExports["add"];const __v2 = arraysExports["dedupeSlow"];const __v3 = arraysExports["mapSomeToObject"];const __v4 = arraysExports["mapToObject"];const __v5 = arraysExports["process"];const __v6 = arraysExports["remove"];const __v7 = arraysExports["removeAndReturn"];const __v8 = arraysExports["uniqueSlow"];
|
|
112
|
+
|
|
113
|
+
export { __v0 as __esModule, __v1 as add, __v2 as dedupeSlow, arraysExports as default, __v3 as mapSomeToObject, __v4 as mapToObject, __v5 as process, __v6 as remove, __v7 as removeAndReturn, __v8 as uniqueSlow };
|