penambahan web socket
This commit is contained in:
49
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/ast-helpers.js
generated
vendored
Normal file
49
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/ast-helpers.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isIdentifierRead = isIdentifierRead;
|
||||
exports.isVarLoop = isVarLoop;
|
||||
exports.isLoop = isLoop;
|
||||
function isIdentifierRead(node, parent) {
|
||||
switch (parent.type) {
|
||||
case 'ObjectPattern':
|
||||
case 'ArrayPattern':
|
||||
// Note: default values not currently supported
|
||||
return false;
|
||||
// disregard `bar` in `bar = thing()`
|
||||
case 'AssignmentExpression':
|
||||
return parent.right === node;
|
||||
case 'MemberExpression':
|
||||
return parent.computed || node === parent.object;
|
||||
// disregard the `bar` in `{ bar: foo }`
|
||||
case 'Property':
|
||||
return node === parent.value;
|
||||
// disregard the `bar` in `class Foo { bar () {...} }`
|
||||
case 'MethodDefinition':
|
||||
return false;
|
||||
// disregard the `bar` in var bar = asdf
|
||||
case 'VariableDeclarator':
|
||||
return parent.id !== node;
|
||||
// disregard the `bar` in `export { foo as bar }`
|
||||
case 'ExportSpecifier':
|
||||
return false;
|
||||
// disregard the `bar` in `function (bar) {}`
|
||||
case 'FunctionExpression':
|
||||
case 'FunctionDeclaration':
|
||||
case 'ArrowFunctionExpression':
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
function isVarLoop(node) {
|
||||
return (node.type === 'ForStatement' ||
|
||||
node.type === 'ForInStatement' ||
|
||||
node.type === 'ForOfStatement');
|
||||
}
|
||||
function isLoop(node) {
|
||||
return (node.type === 'ForStatement' ||
|
||||
node.type === 'ForInStatement' ||
|
||||
node.type === 'ForOfStatement' ||
|
||||
node.type === 'WhileStatement' ||
|
||||
node.type === 'DoWhileStatement');
|
||||
}
|
||||
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/ast-helpers.js.map
generated
vendored
Normal file
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/ast-helpers.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ast-helpers.js","sourceRoot":"","sources":["../../src/utils/ast-helpers.ts"],"names":[],"mappings":";;AAEA,4CA+BC;AAED,8BAMC;AAED,wBAQC;AAjDD,SAAgB,gBAAgB,CAAC,IAAU,EAAE,MAAY;IACvD,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,eAAe,CAAC;QACrB,KAAK,cAAc;YACjB,+CAA+C;YAC/C,OAAO,KAAK,CAAC;QACf,qCAAqC;QACrC,KAAK,sBAAsB;YACzB,OAAO,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC;QAC/B,KAAK,kBAAkB;YACrB,OAAO,MAAM,CAAC,QAAQ,IAAI,IAAI,KAAK,MAAM,CAAC,MAAM,CAAC;QACnD,wCAAwC;QACxC,KAAK,UAAU;YACb,OAAO,IAAI,KAAK,MAAM,CAAC,KAAK,CAAC;QAC/B,sDAAsD;QACtD,KAAK,kBAAkB;YACrB,OAAO,KAAK,CAAC;QACf,wCAAwC;QACxC,KAAK,oBAAoB;YACvB,OAAO,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC;QAC5B,iDAAiD;QACjD,KAAK,iBAAiB;YACpB,OAAO,KAAK,CAAC;QACf,6CAA6C;QAC7C,KAAK,oBAAoB,CAAC;QAC1B,KAAK,qBAAqB,CAAC;QAC3B,KAAK,yBAAyB;YAC5B,OAAO,KAAK,CAAC;QACf;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC;AAED,SAAgB,SAAS,CAAC,IAAU;IAClC,OAAO,CACL,IAAI,CAAC,IAAI,KAAK,cAAc;QAC5B,IAAI,CAAC,IAAI,KAAK,gBAAgB;QAC9B,IAAI,CAAC,IAAI,KAAK,gBAAgB,CAC/B,CAAC;AACJ,CAAC;AAED,SAAgB,MAAM,CAAC,IAAU;IAC/B,OAAO,CACL,IAAI,CAAC,IAAI,KAAK,cAAc;QAC5B,IAAI,CAAC,IAAI,KAAK,gBAAgB;QAC9B,IAAI,CAAC,IAAI,KAAK,gBAAgB;QAC9B,IAAI,CAAC,IAAI,KAAK,gBAAgB;QAC9B,IAAI,CAAC,IAAI,KAAK,kBAAkB,CACjC,CAAC;AACJ,CAAC"}
|
||||
88
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/binary-locators.js
generated
vendored
Normal file
88
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/binary-locators.js
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.pregyp = void 0;
|
||||
exports.nbind = nbind;
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const graceful_fs_1 = __importDefault(require("graceful-fs"));
|
||||
// pregyp
|
||||
const versioning = require('@mapbox/node-pre-gyp/lib/util/versioning.js');
|
||||
const napi = require('@mapbox/node-pre-gyp/lib/util/napi.js');
|
||||
const pregypFind = (package_json_path, opts) => {
|
||||
const package_json = JSON.parse(graceful_fs_1.default.readFileSync(package_json_path).toString());
|
||||
versioning.validate_config(package_json, opts);
|
||||
var napi_build_version;
|
||||
if (napi.get_napi_build_versions(package_json, opts)) {
|
||||
napi_build_version = napi.get_best_napi_build_version(package_json, opts);
|
||||
}
|
||||
opts = opts || {};
|
||||
if (!opts.module_root)
|
||||
opts.module_root = path_1.default.dirname(package_json_path);
|
||||
var meta = versioning.evaluate(package_json, opts, napi_build_version);
|
||||
return meta.module;
|
||||
};
|
||||
exports.pregyp = { default: { find: pregypFind }, find: pregypFind };
|
||||
// nbind
|
||||
// Adapted from nbind.js
|
||||
function makeModulePathList(root, name) {
|
||||
return [
|
||||
[root, name],
|
||||
[root, 'build', name],
|
||||
[root, 'build', 'Debug', name],
|
||||
[root, 'build', 'Release', name],
|
||||
[root, 'out', 'Debug', name],
|
||||
[root, 'Debug', name],
|
||||
[root, 'out', 'Release', name],
|
||||
[root, 'Release', name],
|
||||
[root, 'build', 'default', name],
|
||||
[
|
||||
root,
|
||||
process.env['NODE_BINDINGS_COMPILED_DIR'] || 'compiled',
|
||||
process.versions.node,
|
||||
process.platform,
|
||||
process.arch,
|
||||
name,
|
||||
],
|
||||
];
|
||||
}
|
||||
function findCompiledModule(basePath, specList) {
|
||||
var resolvedList = [];
|
||||
var ext = path_1.default.extname(basePath);
|
||||
for (var _i = 0, specList_1 = specList; _i < specList_1.length; _i++) {
|
||||
var spec = specList_1[_i];
|
||||
if (ext == spec.ext) {
|
||||
try {
|
||||
spec.path = eval('require.resolve(basePath)');
|
||||
return spec;
|
||||
}
|
||||
catch (err) {
|
||||
resolvedList.push(basePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var _a = 0, specList_2 = specList; _a < specList_2.length; _a++) {
|
||||
var spec = specList_2[_a];
|
||||
for (var _b = 0, _c = makeModulePathList(basePath, spec.name); _b < _c.length; _b++) {
|
||||
var pathParts = _c[_b];
|
||||
var resolvedPath = path_1.default.resolve.apply(path_1.default, pathParts);
|
||||
try {
|
||||
spec.path = eval('require.resolve(resolvedPath)');
|
||||
}
|
||||
catch (err) {
|
||||
resolvedList.push(resolvedPath);
|
||||
continue;
|
||||
}
|
||||
return spec;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function nbind(basePath = process.cwd()) {
|
||||
const found = findCompiledModule(basePath, [
|
||||
{ ext: '.node', name: 'nbind.node', type: 'node' },
|
||||
{ ext: '.js', name: 'nbind.js', type: 'emcc' },
|
||||
]);
|
||||
return found;
|
||||
}
|
||||
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/binary-locators.js.map
generated
vendored
Normal file
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/binary-locators.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"binary-locators.js","sourceRoot":"","sources":["../../src/utils/binary-locators.ts"],"names":[],"mappings":";;;;;;AAiFA,sBAMC;AAvFD,gDAAwB;AACxB,8DAA6B;AAE7B,SAAS;AACT,MAAM,UAAU,GAAG,OAAO,CAAC,6CAA6C,CAAC,CAAC;AAC1E,MAAM,IAAI,GAAG,OAAO,CAAC,uCAAuC,CAAC,CAAC;AAC9D,MAAM,UAAU,GAAG,CAAC,iBAAyB,EAAE,IAAS,EAAE,EAAE;IAC1D,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAC7B,qBAAE,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE,CAC9C,CAAC;IACF,UAAU,CAAC,eAAe,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAC/C,IAAI,kBAAkB,CAAC;IACvB,IAAI,IAAI,CAAC,uBAAuB,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,CAAC;QACrD,kBAAkB,GAAG,IAAI,CAAC,2BAA2B,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAC5E,CAAC;IACD,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;IAClB,IAAI,CAAC,IAAI,CAAC,WAAW;QAAE,IAAI,CAAC,WAAW,GAAG,cAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC1E,IAAI,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC;IACvE,OAAO,IAAI,CAAC,MAAM,CAAC;AACrB,CAAC,CAAC;AACW,QAAA,MAAM,GAAG,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAE1E,QAAQ;AACR,wBAAwB;AACxB,SAAS,kBAAkB,CAAC,IAAY,EAAE,IAAY;IACpD,OAAO;QACL,CAAC,IAAI,EAAE,IAAI,CAAC;QACZ,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC;QACrB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC;QAC9B,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC;QAChC,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC;QAC5B,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC;QACrB,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC;QAC9B,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC;QACvB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC;QAChC;YACE,IAAI;YACJ,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,IAAI,UAAU;YACvD,OAAO,CAAC,QAAQ,CAAC,IAAI;YACrB,OAAO,CAAC,QAAQ;YAChB,OAAO,CAAC,IAAI;YACZ,IAAI;SACL;KACF,CAAC;AACJ,CAAC;AAGD,SAAS,kBAAkB,CAAC,QAAgB,EAAE,QAAgB;IAC5D,IAAI,YAAY,GAAG,EAAE,CAAC;IACtB,IAAI,GAAG,GAAG,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjC,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,UAAU,GAAG,QAAQ,EAAE,EAAE,GAAG,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC;QACrE,IAAI,IAAI,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC;QAC1B,IAAI,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YACpB,IAAI,CAAC;gBACH,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,2BAA2B,CAAC,CAAC;gBAC9C,OAAO,IAAI,CAAC;YACd,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;IACH,CAAC;IACD,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,UAAU,GAAG,QAAQ,EAAE,EAAE,GAAG,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC;QACrE,IAAI,IAAI,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC;QAC1B,KACE,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,kBAAkB,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,EACxD,EAAE,GAAG,EAAE,CAAC,MAAM,EACd,EAAE,EAAE,EACJ,CAAC;YACD,IAAI,SAAS,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;YACvB,IAAI,YAAY,GAAG,cAAI,CAAC,OAAO,CAAC,KAAK,CAAC,cAAI,EAAE,SAAS,CAAC,CAAC;YACvD,IAAI,CAAC;gBACH,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,+BAA+B,CAAC,CAAC;YACpD,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBAChC,SAAS;YACX,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AACD,SAAgB,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE;IAC5C,MAAM,KAAK,GAAG,kBAAkB,CAAC,QAAQ,EAAE;QACzC,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE;QAClD,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE;KAC/C,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC"}
|
||||
30
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/get-package-base.js
generated
vendored
Normal file
30
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/get-package-base.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getPackageBase = getPackageBase;
|
||||
exports.getPackageName = getPackageName;
|
||||
// returns the base-level package folder based on detecting "node_modules"
|
||||
// package name boundaries
|
||||
const pkgNameRegEx = /^(@[^\\\/]+[\\\/])?[^\\\/]+/;
|
||||
function getPackageBase(id) {
|
||||
const pkgIndex = id.lastIndexOf('node_modules');
|
||||
if (pkgIndex !== -1 &&
|
||||
(id[pkgIndex - 1] === '/' || id[pkgIndex - 1] === '\\') &&
|
||||
(id[pkgIndex + 12] === '/' || id[pkgIndex + 12] === '\\')) {
|
||||
const pkgNameMatch = id.slice(pkgIndex + 13).match(pkgNameRegEx);
|
||||
if (pkgNameMatch)
|
||||
return id.slice(0, pkgIndex + 13 + pkgNameMatch[0].length);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function getPackageName(id) {
|
||||
const pkgIndex = id.lastIndexOf('node_modules');
|
||||
if (pkgIndex !== -1 &&
|
||||
(id[pkgIndex - 1] === '/' || id[pkgIndex - 1] === '\\') &&
|
||||
(id[pkgIndex + 12] === '/' || id[pkgIndex + 12] === '\\')) {
|
||||
const pkgNameMatch = id.slice(pkgIndex + 13).match(pkgNameRegEx);
|
||||
if (pkgNameMatch && pkgNameMatch.length > 0) {
|
||||
return pkgNameMatch[0].replace(/\\/g, '/');
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/get-package-base.js.map
generated
vendored
Normal file
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/get-package-base.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"get-package-base.js","sourceRoot":"","sources":["../../src/utils/get-package-base.ts"],"names":[],"mappings":";;AAIA,wCAYC;AAED,wCAaC;AA/BD,0EAA0E;AAC1E,0BAA0B;AAC1B,MAAM,YAAY,GAAG,6BAA6B,CAAC;AAEnD,SAAgB,cAAc,CAAC,EAAU;IACvC,MAAM,QAAQ,GAAG,EAAE,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAChD,IACE,QAAQ,KAAK,CAAC,CAAC;QACf,CAAC,EAAE,CAAC,QAAQ,GAAG,CAAC,CAAC,KAAK,GAAG,IAAI,EAAE,CAAC,QAAQ,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC;QACvD,CAAC,EAAE,CAAC,QAAQ,GAAG,EAAE,CAAC,KAAK,GAAG,IAAI,EAAE,CAAC,QAAQ,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC,EACzD,CAAC;QACD,MAAM,YAAY,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACjE,IAAI,YAAY;YACd,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,GAAG,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAgB,cAAc,CAAC,EAAU;IACvC,MAAM,QAAQ,GAAG,EAAE,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAChD,IACE,QAAQ,KAAK,CAAC,CAAC;QACf,CAAC,EAAE,CAAC,QAAQ,GAAG,CAAC,CAAC,KAAK,GAAG,IAAI,EAAE,CAAC,QAAQ,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC;QACvD,CAAC,EAAE,CAAC,QAAQ,GAAG,EAAE,CAAC,KAAK,GAAG,IAAI,EAAE,CAAC,QAAQ,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC,EACzD,CAAC;QACD,MAAM,YAAY,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACjE,IAAI,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5C,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
||||
24
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/interop-require.js
generated
vendored
Normal file
24
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/interop-require.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.normalizeDefaultRequire = normalizeDefaultRequire;
|
||||
exports.normalizeWildcardRequire = normalizeWildcardRequire;
|
||||
function normalizeDefaultRequire(obj) {
|
||||
if (obj && obj.__esModule)
|
||||
return obj;
|
||||
return { default: obj };
|
||||
}
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
function normalizeWildcardRequire(obj) {
|
||||
if (obj && obj.__esModule)
|
||||
return obj;
|
||||
// Note: This implements only value properties and doesn't preserve getters.
|
||||
// This follows the simpler helpers generated by TypeScript.
|
||||
const out = {};
|
||||
for (const key in obj) {
|
||||
if (!hasOwnProperty.call(obj, key))
|
||||
continue;
|
||||
out[key] = obj[key];
|
||||
}
|
||||
out['default'] = obj;
|
||||
return out;
|
||||
}
|
||||
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/interop-require.js.map
generated
vendored
Normal file
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/interop-require.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"interop-require.js","sourceRoot":"","sources":["../../src/utils/interop-require.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,0DAGC;AAGD,4DAWC;AAjBD,SAAgB,uBAAuB,CAAC,GAAQ;IAC9C,IAAI,GAAG,IAAI,GAAG,CAAC,UAAU;QAAE,OAAO,GAAG,CAAC;IACtC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;AAC1B,CAAC;AAED,MAAM,cAAc,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACvD,SAAgB,wBAAwB,CAAC,GAAQ;IAC/C,IAAI,GAAG,IAAI,GAAG,CAAC,UAAU;QAAE,OAAO,GAAG,CAAC;IACtC,4EAA4E;IAC5E,4DAA4D;IAC5D,MAAM,GAAG,GAA8B,EAAE,CAAC;IAC1C,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC;YAAE,SAAS;QAC7C,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IACD,GAAG,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC;IACrB,OAAO,GAAG,CAAC;AACb,CAAC"}
|
||||
10
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/node-version.js
generated
vendored
Normal file
10
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/node-version.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getNodeMajorVersion = getNodeMajorVersion;
|
||||
/**
|
||||
* Gets the major version of the current Node.js runtime
|
||||
* @returns The major version number (e.g., 22 for Node.js v22.16.0)
|
||||
*/
|
||||
function getNodeMajorVersion() {
|
||||
return parseInt(process.versions.node.split('.')[0], 10);
|
||||
}
|
||||
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/node-version.js.map
generated
vendored
Normal file
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/node-version.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"node-version.js","sourceRoot":"","sources":["../../src/utils/node-version.ts"],"names":[],"mappings":";;AAIA,kDAEC;AAND;;;GAGG;AACH,SAAgB,mBAAmB;IACjC,OAAO,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC3D,CAAC"}
|
||||
33
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/sharedlib-emit.js
generated
vendored
Normal file
33
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/sharedlib-emit.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sharedLibEmit = sharedLibEmit;
|
||||
const os_1 = __importDefault(require("os"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const glob_1 = require("glob");
|
||||
const get_package_base_1 = require("./get-package-base");
|
||||
let sharedlibGlob = '';
|
||||
switch (os_1.default.platform()) {
|
||||
case 'darwin':
|
||||
sharedlibGlob = '/**/*.@(dylib|so?(.*))';
|
||||
break;
|
||||
case 'win32':
|
||||
sharedlibGlob = '/**/*.dll';
|
||||
break;
|
||||
default:
|
||||
sharedlibGlob = '/**/*.so?(.*)';
|
||||
}
|
||||
// helper for emitting the associated shared libraries when a binary is emitted
|
||||
async function sharedLibEmit(p, job) {
|
||||
// console.log('Emitting shared libs for ' + path);
|
||||
const pkgPath = (0, get_package_base_1.getPackageBase)(p);
|
||||
if (!pkgPath)
|
||||
return;
|
||||
const files = await (0, glob_1.glob)(pkgPath.replaceAll(path_1.default.sep, path_1.default.posix.sep) + sharedlibGlob, {
|
||||
ignore: pkgPath.replaceAll(path_1.default.sep, path_1.default.posix.sep) + '/**/node_modules/**/*',
|
||||
dot: true,
|
||||
});
|
||||
await Promise.all(files.map((file) => job.emitFile(file, 'sharedlib', p)));
|
||||
}
|
||||
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/sharedlib-emit.js.map
generated
vendored
Normal file
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/sharedlib-emit.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"sharedlib-emit.js","sourceRoot":"","sources":["../../src/utils/sharedlib-emit.ts"],"names":[],"mappings":";;;;;AAmBA,sCAcC;AAjCD,4CAAoB;AACpB,gDAAwB;AACxB,+BAA4B;AAC5B,yDAAoD;AAGpD,IAAI,aAAa,GAAG,EAAE,CAAC;AACvB,QAAQ,YAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;IACtB,KAAK,QAAQ;QACX,aAAa,GAAG,wBAAwB,CAAC;QACzC,MAAM;IACR,KAAK,OAAO;QACV,aAAa,GAAG,WAAW,CAAC;QAC5B,MAAM;IACR;QACE,aAAa,GAAG,eAAe,CAAC;AACpC,CAAC;AAED,+EAA+E;AACxE,KAAK,UAAU,aAAa,CAAC,CAAS,EAAE,GAAQ;IACrD,mDAAmD;IACnD,MAAM,OAAO,GAAG,IAAA,iCAAc,EAAC,CAAC,CAAC,CAAC;IAClC,IAAI,CAAC,OAAO;QAAE,OAAO;IAErB,MAAM,KAAK,GAAG,MAAM,IAAA,WAAI,EACtB,OAAO,CAAC,UAAU,CAAC,cAAI,CAAC,GAAG,EAAE,cAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,aAAa,EAC5D;QACE,MAAM,EACJ,OAAO,CAAC,UAAU,CAAC,cAAI,CAAC,GAAG,EAAE,cAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,uBAAuB;QACxE,GAAG,EAAE,IAAI;KACV,CACF,CAAC;IACF,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7E,CAAC"}
|
||||
339
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/special-cases.js
generated
vendored
Normal file
339
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/special-cases.js
generated
vendored
Normal file
@@ -0,0 +1,339 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = handleSpecialCases;
|
||||
const path_1 = require("path");
|
||||
const resolve_dependency_1 = __importDefault(require("../resolve-dependency"));
|
||||
const get_package_base_1 = require("./get-package-base");
|
||||
const graceful_fs_1 = require("graceful-fs");
|
||||
const specialCases = {
|
||||
'@generated/photon'({ id, emitAssetDirectory }) {
|
||||
if (id.endsWith('@generated/photon/index.js')) {
|
||||
emitAssetDirectory((0, path_1.resolve)((0, path_1.dirname)(id), 'runtime/'));
|
||||
}
|
||||
},
|
||||
'@serialport/bindings-cpp'({ id, emitAssetDirectory }) {
|
||||
if (id.endsWith('@serialport/bindings-cpp/dist/index.js')) {
|
||||
emitAssetDirectory((0, path_1.resolve)((0, path_1.dirname)(id), '..', 'build', 'Release'));
|
||||
emitAssetDirectory((0, path_1.resolve)((0, path_1.dirname)(id), '..', 'prebuilds'));
|
||||
}
|
||||
},
|
||||
argon2({ id, emitAssetDirectory }) {
|
||||
if (id.endsWith('argon2/argon2.js')) {
|
||||
emitAssetDirectory((0, path_1.resolve)((0, path_1.dirname)(id), 'build', 'Release'));
|
||||
emitAssetDirectory((0, path_1.resolve)((0, path_1.dirname)(id), 'prebuilds'));
|
||||
emitAssetDirectory((0, path_1.resolve)((0, path_1.dirname)(id), 'lib', 'binding'));
|
||||
}
|
||||
},
|
||||
bull({ id, emitAssetDirectory }) {
|
||||
if (id.endsWith('bull/lib/commands/index.js')) {
|
||||
emitAssetDirectory((0, path_1.resolve)((0, path_1.dirname)(id)));
|
||||
}
|
||||
},
|
||||
camaro({ id, emitAsset }) {
|
||||
if (id.endsWith('camaro/dist/camaro.js')) {
|
||||
emitAsset((0, path_1.resolve)((0, path_1.dirname)(id), 'camaro.wasm'));
|
||||
}
|
||||
},
|
||||
esbuild({ id, emitAssetDirectory }) {
|
||||
if (id.endsWith('esbuild/lib/main.js')) {
|
||||
const file = (0, path_1.resolve)(id, '..', '..', 'package.json');
|
||||
const pkg = JSON.parse((0, graceful_fs_1.readFileSync)(file, 'utf8'));
|
||||
for (const dep of Object.keys(pkg.optionalDependencies || {})) {
|
||||
const dir = (0, path_1.resolve)(id, '..', '..', '..', dep);
|
||||
emitAssetDirectory(dir);
|
||||
}
|
||||
}
|
||||
},
|
||||
'ffmpeg-static'({ id, emitAsset }) {
|
||||
if (id.endsWith('ffmpeg-static/index.js')) {
|
||||
const bin = require(id);
|
||||
emitAsset(bin);
|
||||
}
|
||||
},
|
||||
'google-gax'({ id, ast, emitAssetDirectory }) {
|
||||
if (id.endsWith('google-gax/build/src/grpc.js')) {
|
||||
// const googleProtoFilesDir = path.normalize(google_proto_files_1.getProtoPath('..'));
|
||||
// ->
|
||||
// const googleProtoFilesDir = resolve(__dirname, '../../../google-proto-files');
|
||||
for (const statement of ast.body) {
|
||||
if (statement.type === 'VariableDeclaration' &&
|
||||
statement.declarations[0].id.type === 'Identifier' &&
|
||||
statement.declarations[0].id.name === 'googleProtoFilesDir') {
|
||||
emitAssetDirectory((0, path_1.resolve)((0, path_1.dirname)(id), '../../../google-proto-files'));
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
oracledb({ id, ast, emitAsset }) {
|
||||
if (id.endsWith('oracledb/lib/oracledb.js')) {
|
||||
for (const statement of ast.body) {
|
||||
if (statement.type === 'ForStatement' &&
|
||||
'body' in statement.body &&
|
||||
statement.body.body &&
|
||||
Array.isArray(statement.body.body) &&
|
||||
statement.body.body[0] &&
|
||||
statement.body.body[0].type === 'TryStatement' &&
|
||||
statement.body.body[0].block.body[0] &&
|
||||
statement.body.body[0].block.body[0].type === 'ExpressionStatement' &&
|
||||
statement.body.body[0].block.body[0].expression.type ===
|
||||
'AssignmentExpression' &&
|
||||
statement.body.body[0].block.body[0].expression.operator === '=' &&
|
||||
statement.body.body[0].block.body[0].expression.left.type ===
|
||||
'Identifier' &&
|
||||
statement.body.body[0].block.body[0].expression.left.name ===
|
||||
'oracledbCLib' &&
|
||||
statement.body.body[0].block.body[0].expression.right.type ===
|
||||
'CallExpression' &&
|
||||
statement.body.body[0].block.body[0].expression.right.callee.type ===
|
||||
'Identifier' &&
|
||||
statement.body.body[0].block.body[0].expression.right.callee.name ===
|
||||
'require' &&
|
||||
statement.body.body[0].block.body[0].expression.right.arguments
|
||||
.length === 1 &&
|
||||
statement.body.body[0].block.body[0].expression.right.arguments[0]
|
||||
.type === 'MemberExpression' &&
|
||||
statement.body.body[0].block.body[0].expression.right.arguments[0]
|
||||
.computed === true &&
|
||||
statement.body.body[0].block.body[0].expression.right.arguments[0]
|
||||
.object.type === 'Identifier' &&
|
||||
statement.body.body[0].block.body[0].expression.right.arguments[0]
|
||||
.object.name === 'binaryLocations' &&
|
||||
statement.body.body[0].block.body[0].expression.right.arguments[0]
|
||||
.property.type === 'Identifier' &&
|
||||
statement.body.body[0].block.body[0].expression.right.arguments[0]
|
||||
.property.name === 'i') {
|
||||
statement.body.body[0].block.body[0].expression.right.arguments = [
|
||||
{ type: 'Literal', value: '_' },
|
||||
];
|
||||
const version = global._unit
|
||||
? '3.0.0'
|
||||
: JSON.parse((0, graceful_fs_1.readFileSync)(id.slice(0, -15) + 'package.json', 'utf8')).version;
|
||||
const useVersion = Number(version.slice(0, version.indexOf('.'))) >= 4;
|
||||
const binaryName = 'oracledb-' +
|
||||
(useVersion ? version : 'abi' + process.versions.modules) +
|
||||
'-' +
|
||||
process.platform +
|
||||
'-' +
|
||||
process.arch +
|
||||
'.node';
|
||||
emitAsset((0, path_1.resolve)(id, '../../build/Release/' + binaryName));
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'phantomjs-prebuilt'({ id, emitAssetDirectory }) {
|
||||
if (id.endsWith('phantomjs-prebuilt/lib/phantomjs.js')) {
|
||||
emitAssetDirectory((0, path_1.resolve)((0, path_1.dirname)(id), '..', 'bin'));
|
||||
}
|
||||
},
|
||||
'remark-prism'({ id, emitAssetDirectory }) {
|
||||
const file = 'remark-prism/src/highlight.js';
|
||||
if (id.endsWith(file)) {
|
||||
try {
|
||||
const node_modules = id.slice(0, -file.length);
|
||||
emitAssetDirectory((0, path_1.resolve)(node_modules, 'prismjs', 'components'));
|
||||
}
|
||||
catch (e) {
|
||||
// fail silently
|
||||
}
|
||||
}
|
||||
},
|
||||
semver({ id, emitAsset }) {
|
||||
if (id.endsWith('semver/index.js')) {
|
||||
// See https://github.com/npm/node-semver/blob/master/CHANGELOG.md#710
|
||||
emitAsset((0, path_1.resolve)(id.replace('index.js', 'preload.js')));
|
||||
}
|
||||
},
|
||||
sharp: async ({ id, emitAssetDirectory, job }) => {
|
||||
if (id.endsWith('sharp/lib/index.js')) {
|
||||
const file = (0, path_1.resolve)(id, '..', '..', 'package.json');
|
||||
const pkg = JSON.parse((0, graceful_fs_1.readFileSync)(file, 'utf8'));
|
||||
for (const dep of Object.keys(pkg.optionalDependencies || {})) {
|
||||
const dir = (0, path_1.resolve)(id, '..', '..', '..', dep);
|
||||
emitAssetDirectory(dir);
|
||||
try {
|
||||
const file = (0, path_1.resolve)(dir, 'package.json');
|
||||
const pkg = JSON.parse((0, graceful_fs_1.readFileSync)(file, 'utf8'));
|
||||
for (const innerDep of Object.keys(pkg.optionalDependencies || {})) {
|
||||
const innerDir = (0, path_1.resolve)(await job.realpath(dir), '..', '..', innerDep);
|
||||
emitAssetDirectory(innerDir);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
if (err && err.code !== 'ENOENT') {
|
||||
console.error(`Error reading "sharp" dependencies from "${dir}/package.json"'`);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
shiki({ id, emitAssetDirectory }) {
|
||||
if (id.endsWith('/dist/index.js')) {
|
||||
emitAssetDirectory((0, path_1.resolve)((0, path_1.dirname)(id), '..', 'languages'));
|
||||
emitAssetDirectory((0, path_1.resolve)((0, path_1.dirname)(id), '..', 'themes'));
|
||||
}
|
||||
},
|
||||
'socket.io': async function ({ id, ast, job }) {
|
||||
if (id.endsWith('socket.io/lib/index.js')) {
|
||||
async function replaceResolvePathStatement(statement) {
|
||||
if (statement.type === 'ExpressionStatement' &&
|
||||
statement.expression.type === 'AssignmentExpression' &&
|
||||
statement.expression.operator === '=' &&
|
||||
statement.expression.right.type === 'CallExpression' &&
|
||||
statement.expression.right.callee.type === 'Identifier' &&
|
||||
statement.expression.right.callee.name === 'read' &&
|
||||
statement.expression.right.arguments.length >= 1 &&
|
||||
statement.expression.right.arguments[0].type === 'CallExpression' &&
|
||||
statement.expression.right.arguments[0].callee.type ===
|
||||
'Identifier' &&
|
||||
statement.expression.right.arguments[0].callee.name ===
|
||||
'resolvePath' &&
|
||||
statement.expression.right.arguments[0].arguments.length === 1 &&
|
||||
statement.expression.right.arguments[0].arguments[0].type ===
|
||||
'Literal') {
|
||||
const arg = statement.expression.right.arguments[0].arguments[0].value;
|
||||
let resolved;
|
||||
try {
|
||||
const dep = await (0, resolve_dependency_1.default)(String(arg), id, job);
|
||||
if (typeof dep === 'string') {
|
||||
resolved = dep;
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
return undefined;
|
||||
}
|
||||
// The asset relocator will then pick up the AST rewriting from here
|
||||
const relResolved = '/' + (0, path_1.relative)((0, path_1.dirname)(id), resolved);
|
||||
statement.expression.right.arguments[0] = {
|
||||
type: 'BinaryExpression',
|
||||
// @ts-ignore Its okay if start is undefined
|
||||
start: statement.expression.right.arguments[0].start,
|
||||
// @ts-ignore Its okay if end is undefined
|
||||
end: statement.expression.right.arguments[0].end,
|
||||
operator: '+',
|
||||
left: {
|
||||
type: 'Identifier',
|
||||
name: '__dirname',
|
||||
},
|
||||
right: {
|
||||
type: 'Literal',
|
||||
value: relResolved,
|
||||
raw: JSON.stringify(relResolved),
|
||||
},
|
||||
};
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
for (const statement of ast.body) {
|
||||
if (statement.type === 'ExpressionStatement' &&
|
||||
statement.expression.type === 'AssignmentExpression' &&
|
||||
statement.expression.operator === '=' &&
|
||||
statement.expression.left.type === 'MemberExpression' &&
|
||||
statement.expression.left.object.type === 'MemberExpression' &&
|
||||
statement.expression.left.object.object.type === 'Identifier' &&
|
||||
statement.expression.left.object.object.name === 'Server' &&
|
||||
statement.expression.left.object.property.type === 'Identifier' &&
|
||||
statement.expression.left.object.property.name === 'prototype' &&
|
||||
statement.expression.left.property.type === 'Identifier' &&
|
||||
statement.expression.left.property.name === 'serveClient' &&
|
||||
statement.expression.right.type === 'FunctionExpression') {
|
||||
for (const node of statement.expression.right.body.body) {
|
||||
if (node.type === 'IfStatement' &&
|
||||
node.consequent &&
|
||||
'body' in node.consequent &&
|
||||
node.consequent.body) {
|
||||
const ifBody = node.consequent.body;
|
||||
let replaced = false;
|
||||
if (Array.isArray(ifBody) &&
|
||||
ifBody[0] &&
|
||||
ifBody[0].type === 'ExpressionStatement') {
|
||||
replaced = await replaceResolvePathStatement(ifBody[0]);
|
||||
}
|
||||
if (Array.isArray(ifBody) &&
|
||||
ifBody[1] &&
|
||||
ifBody[1].type === 'TryStatement' &&
|
||||
ifBody[1].block.body &&
|
||||
ifBody[1].block.body[0]) {
|
||||
replaced =
|
||||
(await replaceResolvePathStatement(ifBody[1].block.body[0])) || replaced;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
typescript({ id, emitAssetDirectory }) {
|
||||
if (id.endsWith('typescript/lib/tsc.js')) {
|
||||
emitAssetDirectory((0, path_1.resolve)(id, '../'));
|
||||
}
|
||||
},
|
||||
'uglify-es'({ id, emitAsset }) {
|
||||
if (id.endsWith('uglify-es/tools/node.js')) {
|
||||
emitAsset((0, path_1.resolve)(id, '../../lib/utils.js'));
|
||||
emitAsset((0, path_1.resolve)(id, '../../lib/ast.js'));
|
||||
emitAsset((0, path_1.resolve)(id, '../../lib/parse.js'));
|
||||
emitAsset((0, path_1.resolve)(id, '../../lib/transform.js'));
|
||||
emitAsset((0, path_1.resolve)(id, '../../lib/scope.js'));
|
||||
emitAsset((0, path_1.resolve)(id, '../../lib/output.js'));
|
||||
emitAsset((0, path_1.resolve)(id, '../../lib/compress.js'));
|
||||
emitAsset((0, path_1.resolve)(id, '../../lib/sourcemap.js'));
|
||||
emitAsset((0, path_1.resolve)(id, '../../lib/mozilla-ast.js'));
|
||||
emitAsset((0, path_1.resolve)(id, '../../lib/propmangle.js'));
|
||||
emitAsset((0, path_1.resolve)(id, '../../lib/minify.js'));
|
||||
emitAsset((0, path_1.resolve)(id, '../exports.js'));
|
||||
}
|
||||
},
|
||||
'uglify-js'({ id, emitAsset, emitAssetDirectory }) {
|
||||
if (id.endsWith('uglify-js/tools/node.js')) {
|
||||
emitAssetDirectory((0, path_1.resolve)(id, '../../lib'));
|
||||
emitAsset((0, path_1.resolve)(id, '../exports.js'));
|
||||
}
|
||||
},
|
||||
'playwright-core'({ id, emitAsset }) {
|
||||
if (id.endsWith('playwright-core/index.js')) {
|
||||
emitAsset((0, path_1.resolve)((0, path_1.dirname)(id), 'browsers.json'));
|
||||
}
|
||||
},
|
||||
'geo-tz'({ id, emitAsset }) {
|
||||
if (id.endsWith('geo-tz/dist/geo-tz.js')) {
|
||||
emitAsset((0, path_1.resolve)((0, path_1.dirname)(id), '../data/geo.dat'));
|
||||
}
|
||||
},
|
||||
pixelmatch({ id, emitDependency }) {
|
||||
if (id.endsWith('pixelmatch/index.js')) {
|
||||
emitDependency((0, path_1.resolve)((0, path_1.dirname)(id), 'bin/pixelmatch'));
|
||||
}
|
||||
},
|
||||
'geoip-lite'({ id, emitAsset }) {
|
||||
if (id.endsWith('geoip-lite/lib/geoip.js')) {
|
||||
emitAsset((0, path_1.resolve)((0, path_1.dirname)(id), '../data/geoip-city.dat'));
|
||||
emitAsset((0, path_1.resolve)((0, path_1.dirname)(id), '../data/geoip-city6.dat'));
|
||||
emitAsset((0, path_1.resolve)((0, path_1.dirname)(id), '../data/geoip-city-names.dat'));
|
||||
emitAsset((0, path_1.resolve)((0, path_1.dirname)(id), '../data/geoip-country.dat'));
|
||||
emitAsset((0, path_1.resolve)((0, path_1.dirname)(id), '../data/geoip-country6.dat'));
|
||||
}
|
||||
},
|
||||
};
|
||||
async function handleSpecialCases({ id, ast, emitDependency, emitAsset, emitAssetDirectory, job, }) {
|
||||
const pkgName = (0, get_package_base_1.getPackageName)(id);
|
||||
const specialCase = specialCases[pkgName || ''];
|
||||
id = id.replace(/\\/g, '/');
|
||||
if (specialCase)
|
||||
await specialCase({
|
||||
id,
|
||||
ast,
|
||||
emitDependency,
|
||||
emitAsset,
|
||||
emitAssetDirectory,
|
||||
job,
|
||||
});
|
||||
}
|
||||
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/special-cases.js.map
generated
vendored
Normal file
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/special-cases.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
579
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/static-eval.js
generated
vendored
Normal file
579
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/static-eval.js
generated
vendored
Normal file
@@ -0,0 +1,579 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.wildcardRegEx = exports.WILDCARD = exports.FUNCTION = exports.UNKNOWN = void 0;
|
||||
exports.evaluate = evaluate;
|
||||
async function evaluate(ast, vars = {}, computeBranches = true) {
|
||||
const state = {
|
||||
computeBranches,
|
||||
vars,
|
||||
};
|
||||
return walk(ast);
|
||||
// walk returns:
|
||||
// 1. Single known value: { value: value }
|
||||
// 2. Conditional value: { test, ifTrue, else }
|
||||
// 3. Unknown value: undefined
|
||||
function walk(node) {
|
||||
const visitor = visitors[node.type];
|
||||
if (visitor) {
|
||||
return visitor.call(state, node, walk);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
exports.UNKNOWN = Symbol();
|
||||
exports.FUNCTION = Symbol();
|
||||
exports.WILDCARD = '\x1a';
|
||||
exports.wildcardRegEx = /\x1a/g;
|
||||
function countWildcards(str) {
|
||||
exports.wildcardRegEx.lastIndex = 0;
|
||||
let cnt = 0;
|
||||
while (exports.wildcardRegEx.exec(str))
|
||||
cnt++;
|
||||
return cnt;
|
||||
}
|
||||
const visitors = {
|
||||
ArrayExpression: async function ArrayExpression(node, walk) {
|
||||
const arr = [];
|
||||
for (let i = 0, l = node.elements.length; i < l; i++) {
|
||||
if (node.elements[i] === null) {
|
||||
arr.push(null);
|
||||
continue;
|
||||
}
|
||||
const x = await walk(node.elements[i]);
|
||||
if (!x)
|
||||
return;
|
||||
if ('value' in x === false)
|
||||
return;
|
||||
arr.push(x.value);
|
||||
}
|
||||
return { value: arr };
|
||||
},
|
||||
ArrowFunctionExpression: async function (node, walk) {
|
||||
// () => val support only
|
||||
if (node.params.length === 0 &&
|
||||
!node.generator &&
|
||||
!node.async &&
|
||||
node.expression) {
|
||||
const innerValue = await walk(node.body);
|
||||
if (!innerValue || !('value' in innerValue))
|
||||
return;
|
||||
return {
|
||||
value: {
|
||||
[exports.FUNCTION]: () => innerValue.value,
|
||||
},
|
||||
};
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
BinaryExpression: async function BinaryExpression(node, walk) {
|
||||
const op = node.operator;
|
||||
let l = await walk(node.left);
|
||||
if (!l && op !== '+')
|
||||
return;
|
||||
let r = await walk(node.right);
|
||||
if (!l && !r)
|
||||
return;
|
||||
if (!l) {
|
||||
// UNKNOWN + 'str' -> wildcard string value
|
||||
if (this.computeBranches &&
|
||||
r &&
|
||||
'value' in r &&
|
||||
typeof r.value === 'string')
|
||||
return {
|
||||
value: exports.WILDCARD + r.value,
|
||||
wildcards: [node.left, ...(r.wildcards || [])],
|
||||
};
|
||||
return;
|
||||
}
|
||||
if (!r) {
|
||||
// 'str' + UKNOWN -> wildcard string value
|
||||
if (this.computeBranches && op === '+') {
|
||||
if (l && 'value' in l && typeof l.value === 'string')
|
||||
return {
|
||||
value: l.value + exports.WILDCARD,
|
||||
wildcards: [...(l.wildcards || []), node.right],
|
||||
};
|
||||
}
|
||||
// A || UNKNOWN -> A if A is truthy
|
||||
if (!('test' in l) && op === '||' && l.value)
|
||||
return l;
|
||||
return;
|
||||
}
|
||||
if ('test' in l && 'value' in r) {
|
||||
const v = r.value;
|
||||
if (op === '==')
|
||||
return { test: l.test, ifTrue: l.ifTrue == v, else: l.else == v };
|
||||
if (op === '===')
|
||||
return { test: l.test, ifTrue: l.ifTrue === v, else: l.else === v };
|
||||
if (op === '!=')
|
||||
return { test: l.test, ifTrue: l.ifTrue != v, else: l.else != v };
|
||||
if (op === '!==')
|
||||
return { test: l.test, ifTrue: l.ifTrue !== v, else: l.else !== v };
|
||||
if (op === '+')
|
||||
return { test: l.test, ifTrue: l.ifTrue + v, else: l.else + v };
|
||||
if (op === '-')
|
||||
return { test: l.test, ifTrue: l.ifTrue - v, else: l.else - v };
|
||||
if (op === '*')
|
||||
return { test: l.test, ifTrue: l.ifTrue * v, else: l.else * v };
|
||||
if (op === '/')
|
||||
return { test: l.test, ifTrue: l.ifTrue / v, else: l.else / v };
|
||||
if (op === '%')
|
||||
return { test: l.test, ifTrue: l.ifTrue % v, else: l.else % v };
|
||||
if (op === '<')
|
||||
return { test: l.test, ifTrue: l.ifTrue < v, else: l.else < v };
|
||||
if (op === '<=')
|
||||
return { test: l.test, ifTrue: l.ifTrue <= v, else: l.else <= v };
|
||||
if (op === '>')
|
||||
return { test: l.test, ifTrue: l.ifTrue > v, else: l.else > v };
|
||||
if (op === '>=')
|
||||
return { test: l.test, ifTrue: l.ifTrue >= v, else: l.else >= v };
|
||||
if (op === '|')
|
||||
return { test: l.test, ifTrue: l.ifTrue | v, else: l.else | v };
|
||||
if (op === '&')
|
||||
return { test: l.test, ifTrue: l.ifTrue & v, else: l.else & v };
|
||||
if (op === '^')
|
||||
return { test: l.test, ifTrue: l.ifTrue ^ v, else: l.else ^ v };
|
||||
if (op === '&&')
|
||||
return { test: l.test, ifTrue: l.ifTrue && v, else: l.else && v };
|
||||
if (op === '||')
|
||||
return { test: l.test, ifTrue: l.ifTrue || v, else: l.else || v };
|
||||
}
|
||||
else if ('test' in r && 'value' in l) {
|
||||
const v = l.value;
|
||||
if (op === '==')
|
||||
return { test: r.test, ifTrue: v == r.ifTrue, else: v == r.else };
|
||||
if (op === '===')
|
||||
return { test: r.test, ifTrue: v === r.ifTrue, else: v === r.else };
|
||||
if (op === '!=')
|
||||
return { test: r.test, ifTrue: v != r.ifTrue, else: v != r.else };
|
||||
if (op === '!==')
|
||||
return { test: r.test, ifTrue: v !== r.ifTrue, else: v !== r.else };
|
||||
if (op === '+')
|
||||
return { test: r.test, ifTrue: v + r.ifTrue, else: v + r.else };
|
||||
if (op === '-')
|
||||
return { test: r.test, ifTrue: v - r.ifTrue, else: v - r.else };
|
||||
if (op === '*')
|
||||
return { test: r.test, ifTrue: v * r.ifTrue, else: v * r.else };
|
||||
if (op === '/')
|
||||
return { test: r.test, ifTrue: v / r.ifTrue, else: v / r.else };
|
||||
if (op === '%')
|
||||
return { test: r.test, ifTrue: v % r.ifTrue, else: v % r.else };
|
||||
if (op === '<')
|
||||
return { test: r.test, ifTrue: v < r.ifTrue, else: v < r.else };
|
||||
if (op === '<=')
|
||||
return { test: r.test, ifTrue: v <= r.ifTrue, else: v <= r.else };
|
||||
if (op === '>')
|
||||
return { test: r.test, ifTrue: v > r.ifTrue, else: v > r.else };
|
||||
if (op === '>=')
|
||||
return { test: r.test, ifTrue: v >= r.ifTrue, else: v >= r.else };
|
||||
if (op === '|')
|
||||
return { test: r.test, ifTrue: v | r.ifTrue, else: v | r.else };
|
||||
if (op === '&')
|
||||
return { test: r.test, ifTrue: v & r.ifTrue, else: v & r.else };
|
||||
if (op === '^')
|
||||
return { test: r.test, ifTrue: v ^ r.ifTrue, else: v ^ r.else };
|
||||
if (op === '&&')
|
||||
return { test: r.test, ifTrue: v && r.ifTrue, else: l && r.else };
|
||||
if (op === '||')
|
||||
return { test: r.test, ifTrue: v || r.ifTrue, else: l || r.else };
|
||||
}
|
||||
else if ('value' in l && 'value' in r) {
|
||||
if (op === '==')
|
||||
return { value: l.value == r.value };
|
||||
if (op === '===')
|
||||
return { value: l.value === r.value };
|
||||
if (op === '!=')
|
||||
return { value: l.value != r.value };
|
||||
if (op === '!==')
|
||||
return { value: l.value !== r.value };
|
||||
if (op === '+') {
|
||||
const val = { value: l.value + r.value };
|
||||
let wildcards = [];
|
||||
if ('wildcards' in l && l.wildcards) {
|
||||
wildcards = wildcards.concat(l.wildcards);
|
||||
}
|
||||
if ('wildcards' in r && r.wildcards) {
|
||||
wildcards = wildcards.concat(r.wildcards);
|
||||
}
|
||||
if (wildcards.length > 0) {
|
||||
val.wildcards = wildcards;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
if (op === '-')
|
||||
return { value: l.value - r.value };
|
||||
if (op === '*')
|
||||
return { value: l.value * r.value };
|
||||
if (op === '/')
|
||||
return { value: l.value / r.value };
|
||||
if (op === '%')
|
||||
return { value: l.value % r.value };
|
||||
if (op === '<')
|
||||
return { value: l.value < r.value };
|
||||
if (op === '<=')
|
||||
return { value: l.value <= r.value };
|
||||
if (op === '>')
|
||||
return { value: l.value > r.value };
|
||||
if (op === '>=')
|
||||
return { value: l.value >= r.value };
|
||||
if (op === '|')
|
||||
return { value: l.value | r.value };
|
||||
if (op === '&')
|
||||
return { value: l.value & r.value };
|
||||
if (op === '^')
|
||||
return { value: l.value ^ r.value };
|
||||
if (op === '&&')
|
||||
return { value: l.value && r.value };
|
||||
if (op === '||')
|
||||
return { value: l.value || r.value };
|
||||
}
|
||||
return;
|
||||
},
|
||||
CallExpression: async function CallExpression(node, walk) {
|
||||
const callee = await walk(node.callee);
|
||||
if (!callee || 'test' in callee)
|
||||
return;
|
||||
let fn = callee.value;
|
||||
if (typeof fn === 'object' && fn !== null)
|
||||
fn = fn[exports.FUNCTION];
|
||||
if (typeof fn !== 'function')
|
||||
return;
|
||||
let ctx = null;
|
||||
if (node.callee.object) {
|
||||
ctx = await walk(node.callee.object);
|
||||
ctx = ctx && 'value' in ctx && ctx.value ? ctx.value : null;
|
||||
}
|
||||
// we allow one conditional argument to create a conditional expression
|
||||
let predicate;
|
||||
let args = [];
|
||||
let argsElse;
|
||||
let allWildcards = node.arguments.length > 0 && node.callee.property?.name !== 'concat';
|
||||
const wildcards = [];
|
||||
for (let i = 0, l = node.arguments.length; i < l; i++) {
|
||||
let x = await walk(node.arguments[i]);
|
||||
if (x) {
|
||||
allWildcards = false;
|
||||
if ('value' in x && typeof x.value === 'string' && x.wildcards)
|
||||
x.wildcards.forEach((w) => wildcards.push(w));
|
||||
}
|
||||
else {
|
||||
if (!this.computeBranches)
|
||||
return;
|
||||
// this works because provided static functions
|
||||
// operate on known string inputs
|
||||
x = { value: exports.WILDCARD };
|
||||
wildcards.push(node.arguments[i]);
|
||||
}
|
||||
if ('test' in x) {
|
||||
if (wildcards.length)
|
||||
return;
|
||||
if (predicate)
|
||||
return;
|
||||
predicate = x.test;
|
||||
argsElse = args.concat([]);
|
||||
args.push(x.ifTrue);
|
||||
argsElse.push(x.else);
|
||||
}
|
||||
else {
|
||||
args.push(x.value);
|
||||
if (argsElse)
|
||||
argsElse.push(x.value);
|
||||
}
|
||||
}
|
||||
if (allWildcards)
|
||||
return;
|
||||
try {
|
||||
const result = await fn.apply(ctx, args);
|
||||
if (result === exports.UNKNOWN)
|
||||
return;
|
||||
if (!predicate) {
|
||||
if (wildcards.length) {
|
||||
if (typeof result !== 'string' ||
|
||||
countWildcards(result) !== wildcards.length)
|
||||
return;
|
||||
return { value: result, wildcards };
|
||||
}
|
||||
return { value: result };
|
||||
}
|
||||
const resultElse = await fn.apply(ctx, argsElse);
|
||||
if (result === exports.UNKNOWN)
|
||||
return;
|
||||
return { test: predicate, ifTrue: result, else: resultElse };
|
||||
}
|
||||
catch (e) {
|
||||
return;
|
||||
}
|
||||
},
|
||||
ConditionalExpression: async function ConditionalExpression(node, walk) {
|
||||
const val = await walk(node.test);
|
||||
if (val && 'value' in val)
|
||||
return val.value ? walk(node.consequent) : walk(node.alternate);
|
||||
if (!this.computeBranches)
|
||||
return;
|
||||
const thenValue = await walk(node.consequent);
|
||||
if (!thenValue || 'wildcards' in thenValue || 'test' in thenValue)
|
||||
return;
|
||||
const elseValue = await walk(node.alternate);
|
||||
if (!elseValue || 'wildcards' in elseValue || 'test' in elseValue)
|
||||
return;
|
||||
return {
|
||||
test: node.test,
|
||||
ifTrue: thenValue.value,
|
||||
else: elseValue.value,
|
||||
};
|
||||
},
|
||||
ExpressionStatement: async function ExpressionStatement(node, walk) {
|
||||
return walk(node.expression);
|
||||
},
|
||||
Identifier: async function Identifier(node, _walk) {
|
||||
if (Object.hasOwnProperty.call(this.vars, node.name))
|
||||
return this.vars[node.name];
|
||||
return undefined;
|
||||
},
|
||||
Literal: async function Literal(node, _walk) {
|
||||
return { value: node.value };
|
||||
},
|
||||
MemberExpression: async function MemberExpression(node, walk) {
|
||||
const obj = await walk(node.object);
|
||||
if (!obj || 'test' in obj || typeof obj.value === 'function') {
|
||||
return undefined;
|
||||
}
|
||||
if (node.property.type === 'Identifier') {
|
||||
if (typeof obj.value === 'string' && node.property.name === 'concat') {
|
||||
return {
|
||||
value: {
|
||||
[exports.FUNCTION]: (...args) => obj.value.concat(args),
|
||||
},
|
||||
};
|
||||
}
|
||||
if (typeof obj.value === 'object' && obj.value !== null) {
|
||||
const objValue = obj.value;
|
||||
if (node.computed) {
|
||||
// See if we can compute the computed property
|
||||
const computedProp = await walk(node.property);
|
||||
if (computedProp && 'value' in computedProp && computedProp.value) {
|
||||
const val = objValue[computedProp.value];
|
||||
if (val === exports.UNKNOWN)
|
||||
return undefined;
|
||||
return { value: val };
|
||||
}
|
||||
// Special case for empty object
|
||||
if (!objValue[exports.UNKNOWN] && Object.keys(obj).length === 0) {
|
||||
return { value: undefined };
|
||||
}
|
||||
}
|
||||
else if (node.property.name in objValue) {
|
||||
const val = objValue[node.property.name];
|
||||
if (val === exports.UNKNOWN)
|
||||
return undefined;
|
||||
return { value: val };
|
||||
}
|
||||
else if (objValue[exports.UNKNOWN])
|
||||
return undefined;
|
||||
}
|
||||
else {
|
||||
return { value: undefined };
|
||||
}
|
||||
}
|
||||
const prop = await walk(node.property);
|
||||
if (!prop || 'test' in prop)
|
||||
return undefined;
|
||||
if (typeof obj.value === 'object' && obj.value !== null) {
|
||||
//@ts-ignore
|
||||
if (prop.value in obj.value) {
|
||||
//@ts-ignore
|
||||
const val = obj.value[prop.value];
|
||||
if (val === exports.UNKNOWN)
|
||||
return undefined;
|
||||
return { value: val };
|
||||
}
|
||||
//@ts-ignore
|
||||
else if (obj.value[exports.UNKNOWN]) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return { value: undefined };
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
MetaProperty: async function MetaProperty(node) {
|
||||
if (node.meta.name === 'import' && node.property.name === 'meta')
|
||||
return { value: this.vars['import.meta'] };
|
||||
return undefined;
|
||||
},
|
||||
NewExpression: async function NewExpression(node, walk) {
|
||||
// new URL('./local', parent)
|
||||
const cls = await walk(node.callee);
|
||||
if (cls && 'value' in cls && cls.value === URL && node.arguments.length) {
|
||||
const arg = await walk(node.arguments[0]);
|
||||
if (!arg)
|
||||
return undefined;
|
||||
let parent = null;
|
||||
if (node.arguments[1]) {
|
||||
parent = await walk(node.arguments[1]);
|
||||
if (!parent || !('value' in parent))
|
||||
return undefined;
|
||||
}
|
||||
if ('value' in arg) {
|
||||
if (parent) {
|
||||
try {
|
||||
return { value: new URL(arg.value, parent.value) };
|
||||
}
|
||||
catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
try {
|
||||
return { value: new URL(arg.value) };
|
||||
}
|
||||
catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const test = arg.test;
|
||||
if (parent) {
|
||||
try {
|
||||
return {
|
||||
test,
|
||||
ifTrue: new URL(arg.ifTrue, parent.value),
|
||||
else: new URL(arg.else, parent.value),
|
||||
};
|
||||
}
|
||||
catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
try {
|
||||
return {
|
||||
test,
|
||||
ifTrue: new URL(arg.ifTrue),
|
||||
else: new URL(arg.else),
|
||||
};
|
||||
}
|
||||
catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
ObjectExpression: async function ObjectExpression(node, walk) {
|
||||
const obj = {};
|
||||
for (let i = 0; i < node.properties.length; i++) {
|
||||
const prop = node.properties[i];
|
||||
const keyValue = prop.computed
|
||||
? walk(prop.key)
|
||||
: prop.key && { value: prop.key.name || prop.key.value };
|
||||
if (!keyValue || 'test' in keyValue)
|
||||
return;
|
||||
const value = await walk(prop.value);
|
||||
if (!value || 'test' in value)
|
||||
return;
|
||||
//@ts-ignore
|
||||
if (value.value === exports.UNKNOWN)
|
||||
return;
|
||||
//@ts-ignore
|
||||
obj[keyValue.value] = value.value;
|
||||
}
|
||||
return { value: obj };
|
||||
},
|
||||
SequenceExpression: async function SequenceExpression(node, walk) {
|
||||
if ('expressions' in node &&
|
||||
node.expressions.length === 2 &&
|
||||
node.expressions[0].type === 'Literal' &&
|
||||
node.expressions[0].value === 0 &&
|
||||
node.expressions[1].type === 'MemberExpression') {
|
||||
const arg = await walk(node.expressions[1]);
|
||||
return arg;
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
TemplateLiteral: async function TemplateLiteral(node, walk) {
|
||||
let val = { value: '' };
|
||||
for (var i = 0; i < node.expressions.length; i++) {
|
||||
if ('value' in val) {
|
||||
val.value += node.quasis[i].value.cooked;
|
||||
}
|
||||
else {
|
||||
val.ifTrue += node.quasis[i].value.cooked;
|
||||
val.else += node.quasis[i].value.cooked;
|
||||
}
|
||||
let exprValue = await walk(node.expressions[i]);
|
||||
if (!exprValue) {
|
||||
if (!this.computeBranches)
|
||||
return undefined;
|
||||
exprValue = { value: exports.WILDCARD, wildcards: [node.expressions[i]] };
|
||||
}
|
||||
if ('value' in exprValue) {
|
||||
if ('value' in val) {
|
||||
val.value += exprValue.value;
|
||||
if (exprValue.wildcards)
|
||||
val.wildcards = [...(val.wildcards || []), ...exprValue.wildcards];
|
||||
}
|
||||
else {
|
||||
if (exprValue.wildcards)
|
||||
return;
|
||||
val.ifTrue += exprValue.value;
|
||||
val.else += exprValue.value;
|
||||
}
|
||||
}
|
||||
else if ('value' in val) {
|
||||
if ('wildcards' in val) {
|
||||
// only support a single branch in a template
|
||||
return;
|
||||
}
|
||||
val = {
|
||||
test: exprValue.test,
|
||||
ifTrue: val.value + exprValue.ifTrue,
|
||||
else: val.value + exprValue.else,
|
||||
};
|
||||
}
|
||||
else {
|
||||
// only support a single branch in a template
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ('value' in val) {
|
||||
val.value += node.quasis[i].value.cooked;
|
||||
}
|
||||
else {
|
||||
val.ifTrue += node.quasis[i].value.cooked;
|
||||
val.else += node.quasis[i].value.cooked;
|
||||
}
|
||||
return val;
|
||||
},
|
||||
ThisExpression: async function ThisExpression(_node, _walk) {
|
||||
if (Object.hasOwnProperty.call(this.vars, 'this'))
|
||||
return this.vars['this'];
|
||||
return undefined;
|
||||
},
|
||||
UnaryExpression: async function UnaryExpression(node, walk) {
|
||||
const val = await walk(node.argument);
|
||||
if (!val)
|
||||
return undefined;
|
||||
if ('value' in val && 'wildcards' in val === false) {
|
||||
if (node.operator === '+')
|
||||
return { value: +val.value };
|
||||
if (node.operator === '-')
|
||||
return { value: -val.value };
|
||||
if (node.operator === '~')
|
||||
return { value: ~val.value };
|
||||
if (node.operator === '!')
|
||||
return { value: !val.value };
|
||||
}
|
||||
else if ('test' in val && 'wildcards' in val === false) {
|
||||
if (node.operator === '+')
|
||||
return { test: val.test, ifTrue: +val.ifTrue, else: +val.else };
|
||||
if (node.operator === '-')
|
||||
return { test: val.test, ifTrue: -val.ifTrue, else: -val.else };
|
||||
if (node.operator === '~')
|
||||
return { test: val.test, ifTrue: ~val.ifTrue, else: ~val.else };
|
||||
if (node.operator === '!')
|
||||
return { test: val.test, ifTrue: !val.ifTrue, else: !val.else };
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
visitors.LogicalExpression = visitors.BinaryExpression;
|
||||
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/static-eval.js.map
generated
vendored
Normal file
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/static-eval.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/types.js
generated
vendored
Normal file
2
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/types.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/types.js.map
generated
vendored
Normal file
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":""}
|
||||
659
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/wrappers.js
generated
vendored
Normal file
659
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/wrappers.js
generated
vendored
Normal file
@@ -0,0 +1,659 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.handleWrappers = handleWrappers;
|
||||
const estree_walker_1 = require("estree-walker");
|
||||
function isUndefinedOrVoid(node) {
|
||||
return ((node.type === 'Identifier' && node.name === 'undefined') ||
|
||||
(node.type === 'UnaryExpression' &&
|
||||
node.operator === 'void' &&
|
||||
node.argument.type === 'Literal' &&
|
||||
node.argument.value === 0));
|
||||
}
|
||||
// Wrapper detection pretransforms to enable static analysis
|
||||
function handleWrappers(ast) {
|
||||
// UglifyJS will convert function wrappers into !function(){}
|
||||
let wrapper;
|
||||
if (ast.body.length === 1 &&
|
||||
ast.body[0].type === 'ExpressionStatement' &&
|
||||
ast.body[0].expression.type === 'UnaryExpression' &&
|
||||
ast.body[0].expression.operator === '!' &&
|
||||
ast.body[0].expression.argument.type === 'CallExpression' &&
|
||||
ast.body[0].expression.argument.callee.type === 'FunctionExpression' &&
|
||||
ast.body[0].expression.argument.arguments.length === 1)
|
||||
wrapper = ast.body[0].expression.argument;
|
||||
else if (ast.body.length === 1 &&
|
||||
ast.body[0].type === 'ExpressionStatement' &&
|
||||
ast.body[0].expression.type === 'CallExpression' &&
|
||||
ast.body[0].expression.callee.type === 'FunctionExpression' &&
|
||||
(ast.body[0].expression.arguments.length === 1 ||
|
||||
ast.body[0].expression.arguments.length === 0))
|
||||
wrapper = ast.body[0].expression;
|
||||
else if (ast.body.length === 1 &&
|
||||
ast.body[0].type === 'ExpressionStatement' &&
|
||||
ast.body[0].expression.type === 'AssignmentExpression' &&
|
||||
ast.body[0].expression.left.type === 'MemberExpression' &&
|
||||
ast.body[0].expression.left.object.type === 'Identifier' &&
|
||||
ast.body[0].expression.left.object.name === 'module' &&
|
||||
ast.body[0].expression.left.property.type === 'Identifier' &&
|
||||
ast.body[0].expression.left.property.name === 'exports' &&
|
||||
ast.body[0].expression.right.type === 'CallExpression' &&
|
||||
ast.body[0].expression.right.callee.type === 'FunctionExpression' &&
|
||||
ast.body[0].expression.right.arguments.length === 1)
|
||||
wrapper = ast.body[0].expression.right;
|
||||
if (wrapper) {
|
||||
let browserifyReturn;
|
||||
let webpackModuleObj;
|
||||
// When.js-style AMD wrapper:
|
||||
// (function (define) { 'use strict' define(function (require) { ... }) })
|
||||
// (typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); })
|
||||
// ->
|
||||
// (function (define) { 'use strict' define(function () { ... }) })
|
||||
// (typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); })
|
||||
if (wrapper.arguments[0] &&
|
||||
wrapper.arguments[0].type === 'ConditionalExpression' &&
|
||||
wrapper.arguments[0].test.type === 'LogicalExpression' &&
|
||||
wrapper.arguments[0].test.operator === '&&' &&
|
||||
wrapper.arguments[0].test.left.type === 'BinaryExpression' &&
|
||||
wrapper.arguments[0].test.left.operator === '===' &&
|
||||
wrapper.arguments[0].test.left.left.type === 'UnaryExpression' &&
|
||||
wrapper.arguments[0].test.left.left.operator === 'typeof' &&
|
||||
'name' in wrapper.arguments[0].test.left.left.argument &&
|
||||
wrapper.arguments[0].test.left.left.argument.name === 'define' &&
|
||||
wrapper.arguments[0].test.left.right.type === 'Literal' &&
|
||||
wrapper.arguments[0].test.left.right.value === 'function' &&
|
||||
wrapper.arguments[0].test.right.type === 'MemberExpression' &&
|
||||
wrapper.arguments[0].test.right.object.type === 'Identifier' &&
|
||||
wrapper.arguments[0].test.right.property.type === 'Identifier' &&
|
||||
wrapper.arguments[0].test.right.property.name === 'amd' &&
|
||||
wrapper.arguments[0].test.right.computed === false &&
|
||||
wrapper.arguments[0].alternate.type === 'FunctionExpression' &&
|
||||
wrapper.arguments[0].alternate.params.length === 1 &&
|
||||
wrapper.arguments[0].alternate.params[0].type === 'Identifier' &&
|
||||
wrapper.arguments[0].alternate.body.body.length === 1 &&
|
||||
wrapper.arguments[0].alternate.body.body[0].type ===
|
||||
'ExpressionStatement' &&
|
||||
wrapper.arguments[0].alternate.body.body[0].expression.type ===
|
||||
'AssignmentExpression' &&
|
||||
wrapper.arguments[0].alternate.body.body[0].expression.left.type ===
|
||||
'MemberExpression' &&
|
||||
wrapper.arguments[0].alternate.body.body[0].expression.left.object
|
||||
.type === 'Identifier' &&
|
||||
wrapper.arguments[0].alternate.body.body[0].expression.left.object
|
||||
.name === 'module' &&
|
||||
wrapper.arguments[0].alternate.body.body[0].expression.left.property
|
||||
.type === 'Identifier' &&
|
||||
wrapper.arguments[0].alternate.body.body[0].expression.left.property
|
||||
.name === 'exports' &&
|
||||
wrapper.arguments[0].alternate.body.body[0].expression.left.computed ===
|
||||
false &&
|
||||
wrapper.arguments[0].alternate.body.body[0].expression.right.type ===
|
||||
'CallExpression' &&
|
||||
wrapper.arguments[0].alternate.body.body[0].expression.right.callee
|
||||
.type === 'Identifier' &&
|
||||
wrapper.arguments[0].alternate.body.body[0].expression.right.callee
|
||||
.name === wrapper.arguments[0].alternate.params[0].name &&
|
||||
'body' in wrapper.callee &&
|
||||
'body' in wrapper.callee.body &&
|
||||
Array.isArray(wrapper.callee.body.body) &&
|
||||
wrapper.arguments[0].alternate.body.body[0].expression.right.arguments
|
||||
.length === 1 &&
|
||||
wrapper.arguments[0].alternate.body.body[0].expression.right.arguments[0]
|
||||
.type === 'Identifier' &&
|
||||
wrapper.arguments[0].alternate.body.body[0].expression.right.arguments[0]
|
||||
.name === 'require') {
|
||||
let body = wrapper.callee.body.body;
|
||||
if (body[0].type === 'ExpressionStatement' &&
|
||||
body[0].expression.type === 'Literal' &&
|
||||
body[0].expression.value === 'use strict') {
|
||||
body = body.slice(1);
|
||||
}
|
||||
if (body.length === 1 &&
|
||||
body[0].type === 'ExpressionStatement' &&
|
||||
body[0].expression.type === 'CallExpression' &&
|
||||
body[0].expression.callee.type === 'Identifier' &&
|
||||
body[0].expression.callee.name ===
|
||||
wrapper.arguments[0].test.right.object.name &&
|
||||
body[0].expression.arguments.length === 1 &&
|
||||
body[0].expression.arguments[0].type === 'FunctionExpression' &&
|
||||
body[0].expression.arguments[0].params.length === 1 &&
|
||||
body[0].expression.arguments[0].params[0].type === 'Identifier' &&
|
||||
body[0].expression.arguments[0].params[0].name === 'require') {
|
||||
const arg = body[0].expression.arguments[0];
|
||||
arg.params = [];
|
||||
try {
|
||||
// @ts-ignore If it doesn't exist that's ok
|
||||
delete arg.scope.declarations.require;
|
||||
}
|
||||
catch (e) { }
|
||||
}
|
||||
}
|
||||
// Browserify-style wrapper
|
||||
// (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.bugsnag = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({
|
||||
// 1:[function(require,module,exports){
|
||||
// ...code...
|
||||
// },{"external":undefined}], 2: ...
|
||||
// },{},[24])(24)
|
||||
// });
|
||||
// ->
|
||||
// (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.bugsnag = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({
|
||||
// 1:[function(require,module,exports){
|
||||
// ...code...
|
||||
// },{"external":undefined}], 2: ...
|
||||
// },{
|
||||
// "external": { exports: require('external') }
|
||||
// },[24])(24)
|
||||
// });
|
||||
else if (wrapper.arguments[0] &&
|
||||
wrapper.arguments[0].type === 'FunctionExpression' &&
|
||||
wrapper.arguments[0].params.length === 0 &&
|
||||
(wrapper.arguments[0].body.body.length === 1 ||
|
||||
(wrapper.arguments[0].body.body.length === 2 &&
|
||||
wrapper.arguments[0].body.body[0].type === 'VariableDeclaration' &&
|
||||
wrapper.arguments[0].body.body[0].declarations.length === 3 &&
|
||||
wrapper.arguments[0].body.body[0].declarations.every((decl) => decl.init === null && decl.id.type === 'Identifier'))) &&
|
||||
wrapper.arguments[0].body.body[wrapper.arguments[0].body.body.length - 1]
|
||||
.type === 'ReturnStatement' &&
|
||||
(browserifyReturn = wrapper.arguments[0].body.body[wrapper.arguments[0].body.body.length - 1]) &&
|
||||
browserifyReturn.argument?.type === 'CallExpression' &&
|
||||
browserifyReturn.argument.arguments.length &&
|
||||
browserifyReturn.argument.arguments.every((arg) => arg && arg.type === 'Literal' && typeof arg.value === 'number') &&
|
||||
browserifyReturn.argument.callee.type === 'CallExpression' &&
|
||||
(browserifyReturn.argument.callee.callee.type === 'FunctionExpression' ||
|
||||
(browserifyReturn.argument.callee.callee.type === 'CallExpression' &&
|
||||
browserifyReturn.argument.callee.callee.callee.type ===
|
||||
'FunctionExpression' &&
|
||||
browserifyReturn.argument.callee.callee.arguments.length === 0)) &&
|
||||
// (dont go deeper into browserify loader internals than this)
|
||||
browserifyReturn.argument.callee.arguments.length === 3 &&
|
||||
browserifyReturn.argument.callee.arguments[0].type ===
|
||||
'ObjectExpression' &&
|
||||
browserifyReturn.argument.callee.arguments[1].type ===
|
||||
'ObjectExpression' &&
|
||||
browserifyReturn.argument.callee.arguments[2].type === 'ArrayExpression') {
|
||||
const modules = browserifyReturn.argument.callee.arguments[0].properties;
|
||||
// verify modules is the expected data structure
|
||||
// in the process, extract external requires
|
||||
const externals = {};
|
||||
if (modules.every((m) => {
|
||||
if (m.type !== 'Property' ||
|
||||
m.computed !== false ||
|
||||
m.key.type !== 'Literal' ||
|
||||
typeof m.key.value !== 'number' ||
|
||||
m.value.type !== 'ArrayExpression' ||
|
||||
m.value.elements.length !== 2 ||
|
||||
!m.value.elements[0] ||
|
||||
!m.value.elements[1] ||
|
||||
m.value.elements[0].type !== 'FunctionExpression' ||
|
||||
m.value.elements[1].type !== 'ObjectExpression') {
|
||||
return false;
|
||||
}
|
||||
// detect externals from undefined moduleMap values
|
||||
const moduleMap = m.value.elements[1].properties;
|
||||
for (const prop of moduleMap) {
|
||||
if (prop.type !== 'Property' ||
|
||||
(prop.value.type !== 'Identifier' &&
|
||||
prop.value.type !== 'Literal' &&
|
||||
!isUndefinedOrVoid(prop.value)) ||
|
||||
!((prop.key.type === 'Literal' &&
|
||||
typeof prop.key.value === 'string') ||
|
||||
prop.key.type === 'Identifier') ||
|
||||
prop.computed) {
|
||||
return false;
|
||||
}
|
||||
if (isUndefinedOrVoid(prop.value)) {
|
||||
if (prop.key.type === 'Identifier') {
|
||||
externals[prop.key.name] = {
|
||||
type: 'Literal',
|
||||
// @ts-ignore start can be undefined
|
||||
start: prop.key.start,
|
||||
// @ts-ignore end can be undefined
|
||||
end: prop.key.end,
|
||||
value: prop.key.name,
|
||||
raw: JSON.stringify(prop.key.name),
|
||||
};
|
||||
}
|
||||
else if (prop.key.type === 'Literal') {
|
||||
externals[String(prop.key.value)] = prop.key;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
})) {
|
||||
// if we have externals, inline them into the browserify cache for webpack to pick up
|
||||
const externalIds = Object.keys(externals);
|
||||
const cache = browserifyReturn.argument.callee.arguments[1];
|
||||
cache.properties = externalIds.map((ext) => {
|
||||
return {
|
||||
type: 'Property',
|
||||
method: false,
|
||||
shorthand: false,
|
||||
computed: false,
|
||||
kind: 'init',
|
||||
key: externals[ext],
|
||||
value: {
|
||||
type: 'ObjectExpression',
|
||||
properties: [
|
||||
{
|
||||
type: 'Property',
|
||||
kind: 'init',
|
||||
method: false,
|
||||
shorthand: false,
|
||||
computed: false,
|
||||
key: {
|
||||
type: 'Identifier',
|
||||
name: 'exports',
|
||||
},
|
||||
value: {
|
||||
type: 'CallExpression',
|
||||
optional: false,
|
||||
callee: {
|
||||
type: 'Identifier',
|
||||
name: 'require',
|
||||
},
|
||||
arguments: [externals[ext]],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
// UMD wrapper
|
||||
// (function (factory) {
|
||||
// if (typeof module === "object" && typeof module.exports === "object") {
|
||||
// var v = factory(require, exports);
|
||||
// if (v !== undefined) module.exports = v;
|
||||
// }
|
||||
// else if (typeof define === "function" && define.amd) {
|
||||
// define(["require", "exports", "./impl/format", "./impl/edit", "./impl/scanner", "./impl/parser"], factory);
|
||||
// }
|
||||
// })(function (require, exports) {
|
||||
// // ...
|
||||
// }
|
||||
// ->
|
||||
// (function (factory) {
|
||||
// if (typeof module === "object" && typeof module.exports === "object") {
|
||||
// var v = factory(require, exports);
|
||||
// if (v !== undefined) module.exports = v;
|
||||
// }
|
||||
// else if (typeof define === "function" && define.amd) {
|
||||
// define(["require", "exports", "./impl/format", "./impl/edit", "./impl/scanner", "./impl/parser"], factory);
|
||||
// }
|
||||
// })(function () {
|
||||
// // ...
|
||||
// }
|
||||
else if (wrapper.arguments[0] &&
|
||||
wrapper.arguments[0].type === 'FunctionExpression' &&
|
||||
wrapper.arguments[0].params.length === 2 &&
|
||||
wrapper.arguments[0].params[0].type === 'Identifier' &&
|
||||
wrapper.arguments[0].params[1].type === 'Identifier' &&
|
||||
'body' in wrapper.callee &&
|
||||
'body' in wrapper.callee.body &&
|
||||
Array.isArray(wrapper.callee.body.body) &&
|
||||
wrapper.callee.body.body.length === 1) {
|
||||
const statement = wrapper.callee.body.body[0];
|
||||
if (statement.type === 'IfStatement' &&
|
||||
statement.test.type === 'LogicalExpression' &&
|
||||
statement.test.operator === '&&' &&
|
||||
statement.test.left.type === 'BinaryExpression' &&
|
||||
statement.test.left.left.type === 'UnaryExpression' &&
|
||||
statement.test.left.left.operator === 'typeof' &&
|
||||
statement.test.left.left.argument.type === 'Identifier' &&
|
||||
statement.test.left.left.argument.name === 'module' &&
|
||||
statement.test.left.right.type === 'Literal' &&
|
||||
statement.test.left.right.value === 'object' &&
|
||||
statement.test.right.type === 'BinaryExpression' &&
|
||||
statement.test.right.left.type === 'UnaryExpression' &&
|
||||
statement.test.right.left.operator === 'typeof' &&
|
||||
statement.test.right.left.argument.type === 'MemberExpression' &&
|
||||
statement.test.right.left.argument.object.type === 'Identifier' &&
|
||||
statement.test.right.left.argument.object.name === 'module' &&
|
||||
statement.test.right.left.argument.property.type === 'Identifier' &&
|
||||
statement.test.right.left.argument.property.name === 'exports' &&
|
||||
statement.test.right.right.type === 'Literal' &&
|
||||
statement.test.right.right.value === 'object' &&
|
||||
statement.consequent.type === 'BlockStatement' &&
|
||||
statement.consequent.body.length > 0) {
|
||||
let callSite;
|
||||
if (statement.consequent.body[0].type === 'VariableDeclaration' &&
|
||||
statement.consequent.body[0].declarations[0].init &&
|
||||
statement.consequent.body[0].declarations[0].init.type ===
|
||||
'CallExpression')
|
||||
callSite = statement.consequent.body[0].declarations[0].init;
|
||||
else if (statement.consequent.body[0].type === 'ExpressionStatement' &&
|
||||
statement.consequent.body[0].expression.type === 'CallExpression')
|
||||
callSite = statement.consequent.body[0].expression;
|
||||
else if (statement.consequent.body[0].type === 'ExpressionStatement' &&
|
||||
statement.consequent.body[0].expression.type ===
|
||||
'AssignmentExpression' &&
|
||||
statement.consequent.body[0].expression.operator === '=' &&
|
||||
statement.consequent.body[0].expression.right.type ===
|
||||
'CallExpression')
|
||||
callSite = statement.consequent.body[0].expression.right;
|
||||
if (callSite &&
|
||||
callSite.callee.type === 'Identifier' &&
|
||||
'params' in wrapper.callee &&
|
||||
wrapper.callee.params.length > 0 &&
|
||||
'name' in wrapper.callee.params[0] &&
|
||||
callSite.callee.name === wrapper.callee.params[0].name &&
|
||||
callSite.arguments.length === 2 &&
|
||||
callSite.arguments[0].type === 'Identifier' &&
|
||||
callSite.arguments[0].name === 'require' &&
|
||||
callSite.arguments[1].type === 'Identifier' &&
|
||||
callSite.arguments[1].name === 'exports') {
|
||||
const funcExpression = wrapper.arguments[0];
|
||||
funcExpression.params = [];
|
||||
try {
|
||||
// @ts-ignore If scope doesn't exist that's ok
|
||||
const scope = funcExpression.scope;
|
||||
delete scope.declarations.require;
|
||||
delete scope.declarations.exports;
|
||||
}
|
||||
catch (e) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
// Webpack wrapper
|
||||
//
|
||||
// module.exports = (function(e) {
|
||||
// var t = {};
|
||||
// function r(n) { /*...*/ }
|
||||
// })([
|
||||
// function (e, t) {
|
||||
// e.exports = require("fs");
|
||||
// },
|
||||
// function(e, t, r) {
|
||||
// const n = r(0);
|
||||
// const ns = r.n(n);
|
||||
// ns.a.export;
|
||||
// }
|
||||
// ]);
|
||||
// ->
|
||||
// module.exports = (function(e) {
|
||||
// var t = {};
|
||||
// function r(n) { /*...*/ }
|
||||
// })([
|
||||
// function (e, t) {
|
||||
// e.exports = require("fs");
|
||||
// },
|
||||
// function(e, t, r) {
|
||||
// const n = require("fs");
|
||||
// const ns = Object.assign(a => n, { a: n });
|
||||
// }
|
||||
// ]);
|
||||
//
|
||||
// OR !(function (){})() | (function () {})() variants
|
||||
// OR { 0: function..., 'some-id': function () ... } registry variants
|
||||
// OR Webpack 5 non-runtime variant:
|
||||
//
|
||||
// (function() {
|
||||
// var exports = {};
|
||||
// exports.id = 223;
|
||||
// exports.ids = [223];
|
||||
// exports.modules = { ... };
|
||||
// var __webpack_require__ = require("../../webpack-runtime.js");
|
||||
// ...
|
||||
// })()
|
||||
//
|
||||
else if ((wrapper.callee.type === 'FunctionExpression' &&
|
||||
wrapper.callee.body.body.length > 2 &&
|
||||
wrapper.callee.body.body[0].type === 'VariableDeclaration' &&
|
||||
wrapper.callee.body.body[0].declarations.length === 1 &&
|
||||
wrapper.callee.body.body[0].declarations[0].type ===
|
||||
'VariableDeclarator' &&
|
||||
wrapper.callee.body.body[0].declarations[0].id.type === 'Identifier' &&
|
||||
wrapper.callee.body.body[0].declarations[0].init &&
|
||||
((wrapper.callee.body.body[0].declarations[0].init.type ===
|
||||
'ObjectExpression' &&
|
||||
wrapper.callee.body.body[0].declarations[0].init.properties.length ===
|
||||
0) ||
|
||||
(wrapper.callee.body.body[0].declarations[0].init.type ===
|
||||
'CallExpression' &&
|
||||
wrapper.callee.body.body[0].declarations[0].init.arguments
|
||||
.length === 1)) &&
|
||||
((wrapper.callee.body.body[1] &&
|
||||
wrapper.callee.body.body[1].type === 'FunctionDeclaration' &&
|
||||
wrapper.callee.body.body[1].params.length === 1 &&
|
||||
wrapper.callee.body.body[1].body.body.length >= 3) ||
|
||||
(wrapper.callee.body.body[2] &&
|
||||
wrapper.callee.body.body[2].type === 'FunctionDeclaration' &&
|
||||
wrapper.callee.body.body[2].params.length === 1 &&
|
||||
wrapper.callee.body.body[2].body.body.length >= 3)) &&
|
||||
wrapper.arguments[0] &&
|
||||
((wrapper.arguments[0].type === 'ArrayExpression' &&
|
||||
(webpackModuleObj = wrapper.arguments[0]) &&
|
||||
wrapper.arguments[0].elements.length > 0 &&
|
||||
wrapper.arguments[0].elements.every((el) => el && el.type === 'FunctionExpression')) ||
|
||||
(wrapper.arguments[0].type === 'ObjectExpression' &&
|
||||
(webpackModuleObj = wrapper.arguments[0]) &&
|
||||
wrapper.arguments[0].properties &&
|
||||
wrapper.arguments[0].properties.length > 0 &&
|
||||
wrapper.arguments[0].properties.every((prop) => prop &&
|
||||
prop.type === 'Property' &&
|
||||
!prop.computed &&
|
||||
prop.key &&
|
||||
prop.key.type === 'Literal' &&
|
||||
(typeof prop.key.value === 'string' ||
|
||||
typeof prop.key.value === 'number') &&
|
||||
prop.value &&
|
||||
prop.value.type === 'FunctionExpression')))) ||
|
||||
(wrapper.arguments.length === 0 &&
|
||||
wrapper.callee.type === 'FunctionExpression' &&
|
||||
wrapper.callee.params.length === 0 &&
|
||||
wrapper.callee.body.type === 'BlockStatement' &&
|
||||
wrapper.callee.body.body.length > 5 &&
|
||||
wrapper.callee.body.body[0].type === 'VariableDeclaration' &&
|
||||
wrapper.callee.body.body[0].declarations.length === 1 &&
|
||||
wrapper.callee.body.body[0].declarations[0].id.type === 'Identifier' &&
|
||||
wrapper.callee.body.body[1].type === 'ExpressionStatement' &&
|
||||
wrapper.callee.body.body[1].expression.type ===
|
||||
'AssignmentExpression' &&
|
||||
wrapper.callee.body.body[2].type === 'ExpressionStatement' &&
|
||||
wrapper.callee.body.body[2].expression.type ===
|
||||
'AssignmentExpression' &&
|
||||
wrapper.callee.body.body[3].type === 'ExpressionStatement' &&
|
||||
wrapper.callee.body.body[3].expression.type ===
|
||||
'AssignmentExpression' &&
|
||||
wrapper.callee.body.body[3].expression.left.type ===
|
||||
'MemberExpression' &&
|
||||
wrapper.callee.body.body[3].expression.left.object.type ===
|
||||
'Identifier' &&
|
||||
wrapper.callee.body.body[3].expression.left.object.name ===
|
||||
wrapper.callee.body.body[0].declarations[0].id.name &&
|
||||
wrapper.callee.body.body[3].expression.left.property.type ===
|
||||
'Identifier' &&
|
||||
wrapper.callee.body.body[3].expression.left.property.name ===
|
||||
'modules' &&
|
||||
wrapper.callee.body.body[3].expression.right.type ===
|
||||
'ObjectExpression' &&
|
||||
wrapper.callee.body.body[3].expression.right.properties.every((prop) => prop &&
|
||||
prop.type === 'Property' &&
|
||||
!prop.computed &&
|
||||
prop.key &&
|
||||
prop.key.type === 'Literal' &&
|
||||
(typeof prop.key.value === 'string' ||
|
||||
typeof prop.key.value === 'number') &&
|
||||
prop.value &&
|
||||
prop.value.type === 'FunctionExpression') &&
|
||||
(webpackModuleObj = wrapper.callee.body.body[3].expression.right) &&
|
||||
((wrapper.callee.body.body[4].type === 'VariableDeclaration' &&
|
||||
wrapper.callee.body.body[4].declarations.length === 1 &&
|
||||
wrapper.callee.body.body[4].declarations[0].init &&
|
||||
wrapper.callee.body.body[4].declarations[0].init.type ===
|
||||
'CallExpression' &&
|
||||
wrapper.callee.body.body[4].declarations[0].init.callee.type ===
|
||||
'Identifier' &&
|
||||
wrapper.callee.body.body[4].declarations[0].init.callee.name ===
|
||||
'require') ||
|
||||
(wrapper.callee.body.body[5].type === 'VariableDeclaration' &&
|
||||
wrapper.callee.body.body[5].declarations.length === 1 &&
|
||||
wrapper.callee.body.body[5].declarations[0].init &&
|
||||
wrapper.callee.body.body[5].declarations[0].init.type ===
|
||||
'CallExpression' &&
|
||||
wrapper.callee.body.body[5].declarations[0].init.callee.type ===
|
||||
'Identifier' &&
|
||||
wrapper.callee.body.body[5].declarations[0].init.callee.name ===
|
||||
'require')))) {
|
||||
const externalMap = new Map();
|
||||
let modules;
|
||||
if (webpackModuleObj.type === 'ArrayExpression')
|
||||
modules = webpackModuleObj.elements.filter((el) => el?.type === 'FunctionExpression').map((el, i) => [String(i), el]);
|
||||
// Structure already checked in conditional above
|
||||
else
|
||||
modules = webpackModuleObj.properties.map((prop) => [
|
||||
String(prop.key.value),
|
||||
prop.value,
|
||||
]);
|
||||
for (const [k, m] of modules) {
|
||||
const statement = m.body.body.length === 1
|
||||
? m.body.body[0]
|
||||
: (m.body.body.length === 2 ||
|
||||
(m.body.body.length === 3 &&
|
||||
m.body.body[2].type === 'EmptyStatement')) &&
|
||||
m.body.body[0].type === 'ExpressionStatement' &&
|
||||
m.body.body[0].expression.type === 'Literal' &&
|
||||
m.body.body[0].expression.value === 'use strict'
|
||||
? m.body.body[1]
|
||||
: null;
|
||||
if (statement &&
|
||||
statement.type === 'ExpressionStatement' &&
|
||||
statement.expression.type === 'AssignmentExpression' &&
|
||||
statement.expression.operator === '=' &&
|
||||
statement.expression.left.type === 'MemberExpression' &&
|
||||
statement.expression.left.object.type === 'Identifier' &&
|
||||
'params' in m &&
|
||||
m.params.length > 0 &&
|
||||
'name' in m.params[0] &&
|
||||
statement.expression.left.object.name === m.params[0].name &&
|
||||
statement.expression.left.property.type === 'Identifier' &&
|
||||
statement.expression.left.property.name === 'exports' &&
|
||||
statement.expression.right.type === 'CallExpression' &&
|
||||
statement.expression.right.callee.type === 'Identifier' &&
|
||||
statement.expression.right.callee.name === 'require' &&
|
||||
statement.expression.right.arguments.length === 1 &&
|
||||
statement.expression.right.arguments[0].type === 'Literal') {
|
||||
externalMap.set(k, statement.expression.right.arguments[0].value);
|
||||
}
|
||||
}
|
||||
for (const [, m] of modules) {
|
||||
if ('params' in m &&
|
||||
m.params.length === 3 &&
|
||||
m.params[2].type === 'Identifier') {
|
||||
const assignedVars = new Map();
|
||||
(0, estree_walker_1.walk)(m.body, {
|
||||
enter(_node, _maybeParent) {
|
||||
const node = _node;
|
||||
const maybeParent = _maybeParent;
|
||||
if (node.type === 'CallExpression' &&
|
||||
node.callee.type === 'Identifier' &&
|
||||
'name' in m.params[2] &&
|
||||
node.callee.name === m.params[2].name &&
|
||||
node.arguments.length === 1 &&
|
||||
node.arguments[0].type === 'Literal') {
|
||||
const externalId = externalMap.get(String(node.arguments[0].value));
|
||||
if (externalId) {
|
||||
const replacement = {
|
||||
type: 'CallExpression',
|
||||
optional: false,
|
||||
callee: {
|
||||
type: 'Identifier',
|
||||
name: 'require',
|
||||
},
|
||||
arguments: [
|
||||
{
|
||||
type: 'Literal',
|
||||
value: externalId,
|
||||
},
|
||||
],
|
||||
};
|
||||
const parent = maybeParent;
|
||||
if ('right' in parent && parent.right === node) {
|
||||
parent.right = replacement;
|
||||
}
|
||||
else if ('left' in parent && parent.left === node) {
|
||||
parent.left = replacement;
|
||||
}
|
||||
else if ('object' in parent && parent.object === node) {
|
||||
parent.object = replacement;
|
||||
}
|
||||
else if ('callee' in parent && parent.callee === node) {
|
||||
parent.callee = replacement;
|
||||
}
|
||||
else if ('arguments' in parent &&
|
||||
parent.arguments.some((arg) => arg === node)) {
|
||||
parent.arguments = parent.arguments.map((arg) => arg === node ? replacement : arg);
|
||||
}
|
||||
else if ('init' in parent && parent.init === node) {
|
||||
if (parent.type === 'VariableDeclarator' &&
|
||||
parent.id.type === 'Identifier')
|
||||
assignedVars.set(parent.id.name, externalId);
|
||||
parent.init = replacement;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (node.type === 'CallExpression' &&
|
||||
node.callee.type === 'MemberExpression' &&
|
||||
node.callee.object.type === 'Identifier' &&
|
||||
'name' in m.params[2] &&
|
||||
node.callee.object.name === m.params[2].name &&
|
||||
node.callee.property.type === 'Identifier' &&
|
||||
node.callee.property.name === 'n' &&
|
||||
node.arguments.length === 1 &&
|
||||
node.arguments[0].type === 'Identifier') {
|
||||
if (maybeParent &&
|
||||
'init' in maybeParent &&
|
||||
maybeParent.init === node) {
|
||||
const req = node.arguments[0];
|
||||
const callExpression = {
|
||||
type: 'CallExpression',
|
||||
optional: false,
|
||||
callee: {
|
||||
type: 'MemberExpression',
|
||||
computed: false,
|
||||
optional: false,
|
||||
object: {
|
||||
type: 'Identifier',
|
||||
name: 'Object',
|
||||
},
|
||||
property: {
|
||||
type: 'Identifier',
|
||||
name: 'assign',
|
||||
},
|
||||
},
|
||||
arguments: [
|
||||
{
|
||||
type: 'ArrowFunctionExpression',
|
||||
expression: true,
|
||||
params: [],
|
||||
body: req,
|
||||
},
|
||||
{
|
||||
type: 'ObjectExpression',
|
||||
properties: [
|
||||
{
|
||||
type: 'Property',
|
||||
kind: 'init',
|
||||
method: false,
|
||||
computed: false,
|
||||
shorthand: false,
|
||||
key: {
|
||||
type: 'Identifier',
|
||||
name: 'a',
|
||||
},
|
||||
value: req,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
maybeParent.init = callExpression;
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/wrappers.js.map
generated
vendored
Normal file
1
examples/nuxt3-websocket-client/node_modules/@vercel/nft/out/utils/wrappers.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user