Unverified Commit 83ff3d48 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

Turbopack: run NFT unit test (#83233)

Port the unit tests from https://github.com/vercel/nft/tree/941be1cb3b9d38fbc99a8a6f07af568a64ed0f12/test/unit
parent 1482af89
......@@ -227,7 +227,7 @@ jobs:
- name: Install node-file-trace test dependencies
if: ${{ inputs.needsNextest == 'yes' }}
working-directory: turbopack/crates/turbopack/tests/node-file-trace
working-directory: turbopack/crates/turbopack-tracing/tests/node-file-trace
run: pnpm install -r --side-effects-cache false
- run: ANALYZE=1 pnpm build
......
......@@ -71,6 +71,8 @@ test/e2e/async-modules/amp-validator-wasm.js
/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/*
/turbopack/crates/turbopack-tests/tests/**/output*
/turbopack/crates/turbopack-tests/tests/**/static
/turbopack/crates/turbopack-tracing/tests/node-file-trace/test/unit/syntax-err/input.js
/turbopack/crates/turbopack-tracing/tests/node-file-trace/test/unit/tsx/lib.tsx
/apps/docs/.source/*
......@@ -84,7 +86,6 @@ test/integration/edge-runtime-configurable-guards/node_modules/lib
test/production/app-dir/symbolic-file-links/src/i18n.ts
test/production/app-dir/symbolic-file-links/src/app/layout.tsx
test/production/app-dir/symbolic-file-links/src/app/page.tsx
turbopack/crates/turbopack/tests/node-file-trace/integration/pnpm/node_modules/foo
turbopack/crates/turbopack/tests/node-file-trace/integration/pnpm/node_modules/.pnpm/foo@2.1.0/node_modules/lodash-pnpm-test
turbopack/crates/turbopack/tests/node-file-trace/integration/symlink-to-file/linked.js
turbopack/crates/turbopack-tracing/tests/node-file-trace/integration/pnpm/node_modules/*
turbopack/crates/turbopack-tracing/tests/node-file-trace/integration/symlink-to-file/linked.js
turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/input/node_modules/component
......@@ -9467,12 +9467,8 @@ name = "turbopack"
version = "0.1.0"
dependencies = [
"anyhow",
"codspeed-criterion-compat",
"difference",
"either",
"regex",
"rstest",
"rstest_reuse",
"rustc-hash 2.1.1",
"serde",
"serde_json",
......@@ -9486,7 +9482,6 @@ dependencies = [
"turbo-tasks-env",
"turbo-tasks-fs",
"turbo-tasks-hash",
"turbo-tasks-malloc",
"turbopack-core",
"turbopack-css",
"turbopack-ecmascript",
......@@ -10078,6 +10073,29 @@ dependencies = [
"turbo-tasks-malloc",
]
[[package]]
name = "turbopack-tracing"
version = "0.1.0"
dependencies = [
"anyhow",
"codspeed-criterion-compat",
"difference",
"regex",
"rstest",
"rstest_reuse",
"serde",
"serde_json",
"tokio",
"turbo-rcstr",
"turbo-tasks",
"turbo-tasks-backend",
"turbo-tasks-fs",
"turbo-tasks-malloc",
"turbopack",
"turbopack-core",
"turbopack-resolve",
]
[[package]]
name = "turbopack-wasm"
version = "0.1.0"
......
[package]
name = "turbopack-tracing"
version = "0.1.0"
description = "TBD"
license = "MIT"
edition = "2024"
autobenches = false
[lib]
bench = false
[features]
test_persistent_cache = []
bench_against_node_nft = []
[lints]
workspace = true
[dependencies]
turbopack = { workspace = true }
[dev-dependencies]
anyhow = { workspace = true }
regex = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
turbo-rcstr = { workspace = true }
turbo-tasks = { workspace = true }
turbo-tasks-fs = { workspace = true }
turbo-tasks-malloc = { workspace = true, default-features = false }
turbo-tasks-backend = { workspace = true }
turbopack-core = { workspace = true }
turbopack-resolve = { workspace = true }
criterion = { workspace = true, features = ["async_tokio"] }
difference = "2.0"
rstest = { workspace = true }
rstest_reuse = "0.5.0"
tokio = { workspace = true }
[[bench]]
name = "mod"
harness = false
#![feature(box_patterns)]
#![feature(trivial_bounds)]
#![feature(min_specialization)]
#![feature(map_try_insert)]
#![feature(hash_set_entry)]
#![recursion_limit = "256"]
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
......@@ -2,4 +2,5 @@
dist
integration/**/dist
!integration/**/node_modules
\ No newline at end of file
!integration/**/node_modules
!integration/**/.pnpm
if (typeof define === 'function' && define.amd)
define(function (require) {
require('amd')
require('deps')
require('shouldnt')
require('detect')
})
'use strict'
const fs = require('fs')
const REPORT_JAVASCRIPT = [
fs.readFileSync(__dirname + '/renderer/util.js', 'utf8'),
fs.readFileSync(__dirname + '/renderer/dom.js', 'utf8'),
].join(';\n')
;[
'package.json',
'test/unit/array-emission/input.js',
'test/unit/array-emission/renderer/dom.js',
'test/unit/array-emission/renderer/util.js',
]
const path = require('path')
let moduleJsPath = path.join(
__dirname,
'.',
isHarmony ? 'asset1.txt' : 'asset2.txt'
)
;[
'package.json',
'test/unit/asset-conditional/asset1.txt',
'test/unit/asset-conditional/asset2.txt',
'test/unit/asset-conditional/input.js',
]
const { spawn } = require('node:child_process')
const { join } = require('node:path')
const child = spawn('gifsicle', [
'--colors',
'256',
join(__dirname, './asset1.txt'),
])
;[
'package.json',
'test/unit/asset-fs-array-expr-node-prefix/asset1.txt',
'test/unit/asset-fs-array-expr-node-prefix/input.js',
]
const { spawn } = require('child_process')
const { join } = require('path')
const child = spawn('gifsicle', [
'--colors',
'256',
join(__dirname, './asset1.txt'),
])
;[
'package.json',
'test/unit/asset-fs-array-expr/asset1.txt',
'test/unit/asset-fs-array-expr/input.js',
]
const fs = require('fs-extra')
console.log(fs.readFileSync(`${process.cwd()}/asset1.txt`))
console.log(fs.readJsonSync(process.cwd() + '/asset2.json'))
;[
'node_modules/fs-extra/lib/copy/copy-sync.js',
'node_modules/fs-extra/lib/copy/copy.js',
'node_modules/fs-extra/lib/copy/index.js',
'node_modules/fs-extra/lib/empty/index.js',
'node_modules/fs-extra/lib/ensure/file.js',
'node_modules/fs-extra/lib/ensure/index.js',
'node_modules/fs-extra/lib/ensure/link.js',
'node_modules/fs-extra/lib/ensure/symlink-paths.js',
'node_modules/fs-extra/lib/ensure/symlink-type.js',
'node_modules/fs-extra/lib/ensure/symlink.js',
'node_modules/fs-extra/lib/fs/index.js',
'node_modules/fs-extra/lib/index.js',
'node_modules/fs-extra/lib/json/index.js',
'node_modules/fs-extra/lib/json/jsonfile.js',
'node_modules/fs-extra/lib/json/output-json-sync.js',
'node_modules/fs-extra/lib/json/output-json.js',
'node_modules/fs-extra/lib/mkdirs/index.js',
'node_modules/fs-extra/lib/mkdirs/make-dir.js',
'node_modules/fs-extra/lib/mkdirs/utils.js',
'node_modules/fs-extra/lib/move/index.js',
'node_modules/fs-extra/lib/move/move-sync.js',
'node_modules/fs-extra/lib/move/move.js',
'node_modules/fs-extra/lib/output-file/index.js',
'node_modules/fs-extra/lib/path-exists/index.js',
'node_modules/fs-extra/lib/remove/index.js',
'node_modules/fs-extra/lib/remove/rimraf.js',
'node_modules/fs-extra/lib/util/stat.js',
'node_modules/fs-extra/lib/util/utimes.js',
'node_modules/fs-extra/package.json',
'node_modules/graceful-fs/clone.js',
'node_modules/graceful-fs/graceful-fs.js',
'node_modules/graceful-fs/legacy-streams.js',
'node_modules/graceful-fs/package.json',
'node_modules/graceful-fs/polyfills.js',
'node_modules/jsonfile/index.js',
'node_modules/jsonfile/package.json',
'node_modules/jsonfile/utils.js',
'node_modules/universalify/index.js',
'node_modules/universalify/package.json',
'package.json',
'test/unit/asset-fs-extra/asset1.txt',
'test/unit/asset-fs-extra/asset2.json',
'test/unit/asset-fs-extra/input.js',
]
'use strict'
function _typeof(obj) {
if (typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol') {
_typeof = function _typeof(obj) {
return typeof obj
}
} else {
_typeof = function _typeof(obj) {
return obj &&
typeof Symbol === 'function' &&
obj.constructor === Symbol &&
obj !== Symbol.prototype
? 'symbol'
: typeof obj
}
}
return _typeof(obj)
}
var _fs = _interopRequireDefault(require('fs'))
var path = _interopRequireWildcard(require('path'))
function _getRequireWildcardCache() {
if (typeof WeakMap !== 'function') return null
var cache = new WeakMap()
_getRequireWildcardCache = function _getRequireWildcardCache() {
return cache
}
return cache
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj
}
if (
obj === null ||
(_typeof(obj) !== 'object' && typeof obj !== 'function')
) {
return { default: obj }
}
var cache = _getRequireWildcardCache()
if (cache && cache.has(obj)) {
return cache.get(obj)
}
var newObj = {}
var hasPropertyDescriptor =
Object.defineProperty && Object.getOwnPropertyDescriptor
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor
? Object.getOwnPropertyDescriptor(obj, key)
: null
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc)
} else {
newObj[key] = obj[key]
}
}
}
newObj['default'] = obj
if (cache) {
cache.set(obj, newObj)
}
return newObj
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj }
}
console.log(
_fs['default'].readFileSync(path.join(__dirname, 'asset.txt'), 'utf8')
)
/* Input source:
import fs from 'fs';
import * as path from 'path';
console.log(fs.readFileSync(path.join(__dirname, 'asset.txt'), 'utf8'));
*/
;[
'package.json',
'test/unit/asset-fs-inline-path-babel/asset.txt',
'test/unit/asset-fs-inline-path-babel/input.js',
]
import fs from 'fs'
import path from 'path'
console.log(fs.readFileSync(path.join(__dirname, 'asset.txt'), 'utf8'))
;[
'package.json',
'test/unit/asset-fs-inline-path-enc-es-2/asset.txt',
'test/unit/asset-fs-inline-path-enc-es-2/input.js',
]
import fs from 'fs'
import { join } from 'path'
console.log(fs.readFileSync(join(__dirname, 'asset.txt'), 'utf8'))
;[
'package.json',
'test/unit/asset-fs-inline-path-enc-es-3/asset.txt',
'test/unit/asset-fs-inline-path-enc-es-3/input.js',
]
import fs from 'fs'
import * as path from 'path'
const join = path.join
console.log(fs.readFileSync(join(__dirname, 'asset.txt'), 'utf8'))
;[
'package.json',
'test/unit/asset-fs-inline-path-enc-es-4/asset.txt',
'test/unit/asset-fs-inline-path-enc-es-4/input.js',
]
import fs from 'fs'
import { join } from 'path'
console.log(fs.readFileSync(join(__dirname, 'asset.txt'), 'utf8'))
;[
'package.json',
'test/unit/asset-fs-inline-path-enc-es-5/asset.txt',
'test/unit/asset-fs-inline-path-enc-es-5/input.js',
]
import fs from 'fs'
import * as path from 'path'
console.log(fs.readFileSync(path.join(__dirname, 'asset.txt'), 'utf8'))
;[
'package.json',
'test/unit/asset-fs-inline-path-enc-es-node-prefix/asset.txt',
'test/unit/asset-fs-inline-path-enc-es-node-prefix/input.js',
]
import fs from 'fs'
import * as path from 'path'
console.log(fs.readFileSync(path.join(__dirname, 'asset.txt'), 'utf8'))
;[
'package.json',
'test/unit/asset-fs-inline-path-enc-es/asset.txt',
'test/unit/asset-fs-inline-path-enc-es/input.js',
]
const fs = require('fs')
const { join } = require('path')
console.log(fs.readFileSync(join(__dirname, 'asset.txt'), 'utf8'))
;(function () {
var join = () => 'nope'
console.log(fs.readFileSync(join(__dirname, 'asset.txt'), 'utf8'))
})()
;[
'package.json',
'test/unit/asset-fs-inline-path-shadow/asset.txt',
'test/unit/asset-fs-inline-path-shadow/input.js',
]
'use strict'
Object.defineProperty(exports, '__esModule', { value: true })
const fs_1 = require('fs')
const path = require('path')
console.log(
fs_1.default.readFileSync(path.join(__dirname, 'asset.txt'), 'utf8')
)
/* Input source (with modules: 'commonjs', no esModuleInterop):
import fs from 'fs';
import * as path from 'path';
console.log(fs.readFileSync(path.join(__dirname, 'asset.txt'), 'utf8'));
*/
;[
'package.json',
'test/unit/asset-fs-inline-path-ts-no-interop/asset.txt',
'test/unit/asset-fs-inline-path-ts-no-interop/input.js',
]
'use strict'
var __importDefault =
(this && this.__importDefault) ||
function (mod) {
return mod && mod.__esModule ? mod : { default: mod }
}
var __importStar =
(this && this.__importStar) ||
function (mod) {
if (mod && mod.__esModule) return mod
var result = {}
if (mod != null)
for (var k in mod)
if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]
result['default'] = mod
return result
}
Object.defineProperty(exports, '__esModule', { value: true })
const fs_1 = __importDefault(require('fs'))
const path = __importStar(require('path'))
console.log(
fs_1.default.readFileSync(path.join(__dirname, 'asset.txt'), 'utf8')
)
/* Input source (with modules: 'commonjs'):
import fs from 'fs';
import * as path from 'path';
console.log(fs.readFileSync(path.join(__dirname, 'asset.txt'), 'utf8'));
*/
;[
'package.json',
'test/unit/asset-fs-inline-path-ts/asset.txt',
'test/unit/asset-fs-inline-path-ts/input.js',
]
const fs = require('fs')
console.log(fs.readFileSync(`${__dirname}/asset.txt`))
;[
'package.json',
'test/unit/asset-fs-inline-tpl/asset.txt',
'test/unit/asset-fs-inline-tpl/input.js',
]
const fs = require('fs')
console.log(fs.readFileSync(__dirname + '/asset.txt'))
console.log(fs.readFileSync(__dirname + '/sub/asset.txt'))
;[
'package.json',
'test/unit/asset-fs-inlining-multi/asset.txt',
'test/unit/asset-fs-inlining-multi/input.js',
'test/unit/asset-fs-inlining-multi/sub/asset.txt',
]
const fs = require('fs')
console.log(fs.readFileSync(__dirname + '/asset.txt'))
;[
'package.json',
'test/unit/asset-fs-inlining/asset.txt',
'test/unit/asset-fs-inlining/input.js',
]
const fs = require('fs')
console.log(fs.readFileSync(`${__dirname}/asset${unknown ? '1' : '2'}.txt`))
;[
'package.json',
'test/unit/asset-fs-logical/asset1.txt',
'test/unit/asset-fs-logical/asset2.txt',
'test/unit/asset-fs-logical/input.js',
]
const fs = require('graceful-fs')
console.log(fs.readFileSync(`${process.cwd()}/asset.txt`))
console.log(fs.readFileSync(process.cwd() + '/sub/asset.txt'))
;[
'node_modules/graceful-fs/clone.js',
'node_modules/graceful-fs/graceful-fs.js',
'node_modules/graceful-fs/legacy-streams.js',
'node_modules/graceful-fs/package.json',
'node_modules/graceful-fs/polyfills.js',
'package.json',
'test/unit/asset-graceful-fs/asset.txt',
'test/unit/asset-graceful-fs/input.js',
'test/unit/asset-graceful-fs/sub/asset.txt',
]
;[
'package.json',
'test/unit/asset-node-require/input.js',
'test/unit/asset-node-require/mock.node',
]
const path = require('path')
var binding_path = binary.find(
path.resolve(path.join(__dirname, './package.json'))
)
;[
'test/unit/asset-package-json/input.js',
'test/unit/asset-package-json/package.json',
]
const path = require('path')
let moduleJsPath = path.join(__dirname, '.', 'asset.txt')
;[
'package.json',
'test/unit/asset-symlink/asset.txt',
'test/unit/asset-symlink/asset1.txt',
'test/unit/asset-symlink/input.js',
]
;[
'package.json',
'test/unit/basic-analysis-require/dep.js',
'test/unit/basic-analysis-require/input.js',
]
{
"name": "pkg",
"main": "index.js",
"exports": {
".": {
"import": "./subdir/import-main.js",
"require": "./require-main.cjs"
},
"./asdf": {
"import": "./subdir/import-main.js"
}
},
"browser": {
"./subdir/import-main.js": "./subdir/import-main-browser.js"
}
}
;[
'package.json',
'test/unit/browser-remappings-disabled/input.js',
'test/unit/browser-remappings-disabled/node_modules/pkg/index.js',
'test/unit/browser-remappings-disabled/node_modules/pkg/package.json',
'test/unit/browser-remappings-disabled/node_modules/pkg/require-main.cjs',
'test/unit/browser-remappings-disabled/node_modules/pkg/subdir/import-main.js',
'test/unit/browser-remappings-disabled/node_modules/pkg/subdir/package.json',
]
;[
'package.json',
'test/unit/browser-remappings-false/input.js',
'test/unit/browser-remappings-false/node_modules/pkg/browser.js',
'test/unit/browser-remappings-false/node_modules/pkg/index.js',
'test/unit/browser-remappings-false/node_modules/pkg/package.json',
]
{
"name": "pkg",
"main": "index.js",
"exports": {
".": {
"import": "./subdir/import-main.js",
"require": "./require-main.cjs"
},
"./asdf": {
"import": "./subdir/import-main.js"
}
},
"browser": "./subdir/import-main-browser.js"
}
;[
'package.json',
'test/unit/browser-remappings-malformed/input.js',
'test/unit/browser-remappings-malformed/node_modules/pkg/index.js',
'test/unit/browser-remappings-malformed/node_modules/pkg/package.json',
'test/unit/browser-remappings-malformed/node_modules/pkg/require-main.cjs',
'test/unit/browser-remappings-malformed/node_modules/pkg/subdir/import-main.js',
'test/unit/browser-remappings-malformed/node_modules/pkg/subdir/package.json',
]
{
"name": "pkg",
"main": "index.js",
"exports": {
".": {
"import": "./subdir/import-main.js",
"require": "./require-main.cjs"
},
"./asdf": {
"import": "./subdir/import-main.js"
}
},
"browser": {
"./subdir/import-main.js": "./invalid.js",
"./require-main.cjs": "invalid.js",
"./invalid.js": "./subdir/import-main-browser.js",
"invalid.js": "./subdir/import-main-browser.js",
"invalid2.js": "unknown.js"
}
}
;[
'package.json',
'test/unit/browser-remappings-malformed2/input.js',
'test/unit/browser-remappings-malformed2/node_modules/pkg/index.js',
'test/unit/browser-remappings-malformed2/node_modules/pkg/package.json',
'test/unit/browser-remappings-malformed2/node_modules/pkg/require-main.cjs',
'test/unit/browser-remappings-malformed2/node_modules/pkg/subdir/import-main.js',
'test/unit/browser-remappings-malformed2/node_modules/pkg/subdir/package.json',
]
;[
'package.json',
'test/unit/browser-remappings-string/input.js',
'test/unit/browser-remappings-string/node_modules/pkg/browser.js',
'test/unit/browser-remappings-string/node_modules/pkg/index.js',
'test/unit/browser-remappings-string/node_modules/pkg/package.json',
]
{
"name": "pkg",
"main": "index.js",
"exports": {
".": {
"import": "./subdir/import-main.js",
"require": "./require-main.cjs"
},
"./asdf": {
"import": "./subdir/import-main.js"
}
}
}
;[
'package.json',
'test/unit/browser-remappings-undefined/input.js',
'test/unit/browser-remappings-undefined/node_modules/pkg/index.js',
'test/unit/browser-remappings-undefined/node_modules/pkg/package.json',
'test/unit/browser-remappings-undefined/node_modules/pkg/require-main.cjs',
'test/unit/browser-remappings-undefined/node_modules/pkg/subdir/import-main.js',
'test/unit/browser-remappings-undefined/node_modules/pkg/subdir/package.json',
]
{
"name": "pkg",
"main": "index.js",
"exports": {
".": {
"import": "./subdir/import-main.js",
"require": "./require-main.cjs"
},
"./asdf": {
"import": "./subdir/import-main.js"
}
},
"browser": {
"./subdir/import-main.js": "./subdir/import-main-browser.js",
"./unknown.js": "./invalid.js"
}
}
;[
'package.json',
'test/unit/browser-remappings/input.js',
'test/unit/browser-remappings/node_modules/pkg/index.js',
'test/unit/browser-remappings/node_modules/pkg/package.json',
'test/unit/browser-remappings/node_modules/pkg/require-main.cjs',
'test/unit/browser-remappings/node_modules/pkg/subdir/import-main-browser.js',
'test/unit/browser-remappings/node_modules/pkg/subdir/import-main.js',
'test/unit/browser-remappings/node_modules/pkg/subdir/package.json',
]
!(function (e) {
'object' == typeof exports && 'undefined' != typeof module
? (module.exports = e())
: 'function' == typeof define && define.amd
? define([], e)
: (('undefined' != typeof window
? window
: 'undefined' != typeof global
? global
: 'undefined' != typeof self
? self
: this
).ytSearch = e())
})(function () {
return (function r(l, u, o) {
function s(t, e) {
if (!u[t]) {
if (!l[t]) {
var i = 'function' == typeof require && require
if (!e && i) return i(t, !0)
if (c) return c(t, !0)
var n = new Error("Cannot find module '" + t + "'")
throw ((n.code = 'MODULE_NOT_FOUND'), n)
}
var a = (u[t] = {
exports: {},
})
l[t][0].call(
a.exports,
function (e) {
return s(l[t][1][e] || e)
},
a,
a.exports,
r,
l,
u,
o
)
}
return u[t].exports
}
for (
var c = 'function' == typeof require && require, e = 0;
e < o.length;
e++
)
s(o[e])
return s
})(
{
1: [
function (s, e, t) {
'use strict'
var ee = s('acorn')
},
{
acorn: void 0,
},
],
},
{},
[1]
)(1)
})
;[
'node_modules/acorn/dist/acorn.js',
'node_modules/acorn/package.json',
'package.json',
'test/unit/browserify-minify/input.js',
]
!(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) {
module.exports = [require('./dep1'), require('./dep2')]
},
{ './dep1': undefined, './dep2': undefined },
],
},
{},
[1]
)(1)
})
;[
'package.json',
'test/unit/browserify-uglify/dep1.js',
'test/unit/browserify-uglify/dep2.js',
'test/unit/browserify-uglify/input.js',
]
;(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) {
module.exports = [require('./dep1'), require('./dep2')]
},
{ './dep1': undefined, './dep2': undefined },
],
},
{},
[1]
)(1)
})
;[
'package.json',
'test/unit/browserify/dep1.js',
'test/unit/browserify/dep2.js',
'test/unit/browserify/input.js',
]
const fs = require('fs')
class X extends Object {
constructor() {}
static(patterns, options) {}
static realStatic() {}
}
fs.readFileSync(__dirname + '/asset.txt')
;[
'package.json',
'test/unit/class-static/asset.txt',
'test/unit/class-static/input.js',
]
;[
'node_modules/@datadog/pprof/node_modules/node-gyp-build/index.js',
'node_modules/@datadog/pprof/node_modules/node-gyp-build/package.json',
'node_modules/@datadog/pprof/node_modules/source-map/lib/array-set.js',
'node_modules/@datadog/pprof/node_modules/source-map/lib/base64-vlq.js',
'node_modules/@datadog/pprof/node_modules/source-map/lib/base64.js',
'node_modules/@datadog/pprof/node_modules/source-map/lib/binary-search.js',
'node_modules/@datadog/pprof/node_modules/source-map/lib/mapping-list.js',
'node_modules/@datadog/pprof/node_modules/source-map/lib/mappings.wasm',
'node_modules/@datadog/pprof/node_modules/source-map/lib/read-wasm.js',
'node_modules/@datadog/pprof/node_modules/source-map/lib/source-map-consumer.js',
'node_modules/@datadog/pprof/node_modules/source-map/lib/source-map-generator.js',
'node_modules/@datadog/pprof/node_modules/source-map/lib/source-node.js',
'node_modules/@datadog/pprof/node_modules/source-map/lib/util.js',
'node_modules/@datadog/pprof/node_modules/source-map/lib/wasm.js',
'node_modules/@datadog/pprof/node_modules/source-map/package.json',
'node_modules/@datadog/pprof/node_modules/source-map/source-map.js',
'node_modules/@datadog/pprof/out/src/heap-profiler-bindings.js',
'node_modules/@datadog/pprof/out/src/heap-profiler.js',
'node_modules/@datadog/pprof/out/src/index.js',
'node_modules/@datadog/pprof/out/src/logger.js',
'node_modules/@datadog/pprof/out/src/profile-encoder.js',
'node_modules/@datadog/pprof/out/src/profile-serializer.js',
'node_modules/@datadog/pprof/out/src/sourcemapper/sourcemapper.js',
'node_modules/@datadog/pprof/out/src/time-profiler-bindings.js',
'node_modules/@datadog/pprof/out/src/time-profiler.js',
'node_modules/@datadog/pprof/package.json',
'node_modules/delay/index.js',
'node_modules/delay/package.json',
'node_modules/p-limit/index.js',
'node_modules/p-limit/package.json',
'node_modules/pprof-format/dist/index.js',
'node_modules/pprof-format/package.json',
'node_modules/yocto-queue/index.js',
'node_modules/yocto-queue/package.json',
'package.json',
'test/unit/datadog-pprof-node-gyp/input.js',
]
const fs = require('fs')
fs.promises.readdir(__dirname + '/assets').then((files) => {
console.log(files)
})
;[
'package.json',
'test/unit/dirname-emit-concat/assets/file.txt',
'test/unit/dirname-emit-concat/input.js',
]
const fs = require('fs')
const files = fs.readdirSync(__dirname)
console.log(files)
;[
'package.json',
'test/unit/dirname-emit/asset.txt',
'test/unit/dirname-emit/input.js',
'test/unit/dirname-emit/output.js',
'test/unit/dirname-emit/subdir/file.txt',
]
console.log(function (a, b) {
return b.filter(function (c) {
return __dirname.length
})
})
;[
'package.json',
'test/unit/dot-dot/dir/dot-dot-req.js',
'test/unit/dot-dot/index.js',
'test/unit/dot-dot/input.js',
]
async function main() {
const { foo } = await import('./dep.js')
console.log(foo)
}
;[
'test/unit/esm-dynamic-import/dep.js',
'test/unit/esm-dynamic-import/input.js',
'test/unit/esm-dynamic-import/package.json',
]
;[
'package.json',
'test/unit/esm-export-wildcard/all.js',
'test/unit/esm-export-wildcard/input.js',
'test/unit/esm-export-wildcard/week.js',
]
export const mon = 'mon'
export const tue = 'tues'
export const wed = 'wed'
export const thu = 'thu'
export const fri = 'fri'
;[
'package.json',
'test/unit/esm-paths-trailer/esm-dep.js',
'test/unit/esm-paths-trailer/input.js',
]
;[
'package.json',
'test/unit/esm-paths/esm-dep.js',
'test/unit/esm-paths/input.js',
]
;[
'package.json',
'test/unit/exports-fallback/input.js',
'test/unit/exports-fallback/node_modules/pkg/index.js',
'test/unit/exports-fallback/node_modules/pkg/package.json',
'test/unit/exports-fallback/node_modules/pkg/require-main.cjs',
]
;[
'test/unit/exports-nomodule/input.js',
'test/unit/exports-nomodule/node.js',
'test/unit/exports-nomodule/package.json',
]
{
"name": "x",
"type": "module",
"exports": {
".": {
"module": "./no.js",
"default": {
"node": "./node.js"
}
}
}
}
;[
'package.json',
'test/unit/exports-only/input.js',
'test/unit/exports-only/node_modules/pkg/package.json',
'test/unit/exports-only/node_modules/pkg/require-main.cjs',
'test/unit/exports-only/node_modules/pkg/subdir/import-main.js',
'test/unit/exports-only/node_modules/pkg/subdir/package.json',
]
const ReactNativeFile = require('apollo-upload-client/public/ReactNativeFile')
;[
'package.json',
'test/unit/exports-path/input.js',
'test/unit/exports-path/node_modules/apollo-upload-client/package.json',
'test/unit/exports-path/node_modules/apollo-upload-client/public/ReactNativeFile.js',
'test/unit/exports-path/node_modules/extract-files/package.json',
'test/unit/exports-path/node_modules/extract-files/public/ReactNativeFile.js',
]
;[
'test/unit/exports-wildcard/input.js',
'test/unit/exports-wildcard/node.js',
'test/unit/exports-wildcard/package.json',
]
{
"name": "y",
"type": "module",
"exports": {
"./*": {
"module": "./*.js",
"default": {
"node": "./*de.js"
}
}
}
}
;[
'package.json',
'test/unit/exports/input.js',
'test/unit/exports/node_modules/pkg/index.js',
'test/unit/exports/node_modules/pkg/package.json',
'test/unit/exports/node_modules/pkg/require-main.cjs',
'test/unit/exports/node_modules/pkg/subdir/import-main.js',
'test/unit/exports/node_modules/pkg/subdir/package.json',
]
'use strict'
var os = require('os')
var fs = require('fs')
var path = require('path')
var verifyFile
var platform = os.platform() + '-' + os.arch() && '.'
var packageName = '@ffmpeg-installer/' + platform
var binary = os.platform() === 'win32' ? 'ffmpeg.exe' : 'ffmpeg.exe'
// var npm3Path = path.resolve(__dirname, '..', platform);
var npm2Path = path.resolve(__dirname, '.', platform)
var npm3Binary = path.join(npm3Path, binary)
var npm2Binary = path.join(npm2Path, binary)
var npm3Package = path.join(npm3Path, 'package.json')
var npm2Package = path.join(npm2Path, 'package.json')
var ffmpegPath, packageJson
if (verifyFile(npm3Binary)) {
ffmpegPath = npm3Binary
} else if (verifyFile(npm2Binary)) {
ffmpegPath = npm2Binary
} else {
throw (
'Could not find ffmpeg executable, tried "' +
npm3Binary +
'" and "' +
npm2Binary +
'"'
)
}
var version = packageJson.ffmpeg || packageJson.version
var url = packageJson.homepage
module.exports = {
path: ffmpegPath,
version: version,
url: url,
}
;[
'package.json',
'test/unit/ffmpeg-installer/ffmpeg.exe',
'test/unit/ffmpeg-installer/ffmpeg.js',
'test/unit/ffmpeg-installer/input.js',
]
;[
'package.json',
'test/unit/file-folder-slash/file-folder/index.js',
'test/unit/file-folder-slash/input.js',
]
const fs = require('fs')
fs.readFileSync(__dirname + '/../../../package.json')
const fs = require('fs')
fs.readFile('./asset1.txt')
fs.readFile(require.resolve('./asset2.txt'))
const _basePath = __dirname
const asset3 = 'asset3.txt'
fs.readFileSync(_basePath + '/' + asset3, 'utf8')
;[
'package.json',
'test/unit/fs-emission/asset2.txt',
'test/unit/fs-emission/asset3.txt',
'test/unit/fs-emission/input.js',
]
const fs = require('fs')
const dotFiles = fs.readdirSync(__dirname, 'with-dot')
const nonDotFiles = fs.readdirSync(__dirname, 'without-dot')
console.log({
dotFiles,
nonDotFiles,
})
;[
'package.json',
'test/unit/glob-dot/input.js',
'test/unit/glob-dot/output.js',
'test/unit/glob-dot/with-dot/.dot/first.txt',
'test/unit/glob-dot/without-dot/normal/first.txt',
]
import foo from './foo'
import info from './info.json' assert { type: 'json' }
export default info
;[
'package.json',
'test/unit/import-assertions/foo.js',
'test/unit/import-assertions/info.json',
'test/unit/import-assertions/input.js',
]
import foo from './foo'
import info from './info.json' with { type: 'json' }
export default info
;[
'package.json',
'test/unit/import-attributes/foo.js',
'test/unit/import-attributes/info.json',
'test/unit/import-attributes/input.js',
]
import { readFileSync } from 'fs'
console.log(
readFileSync(new URL(unknown ? './asset1.txt' : './asset2.txt', 'not-a-url'))
)
console.log(readFileSync(new URL(unknown ? 'a--b' : './asset2.txt')))
console.log(readFileSync(new URL(unknown ? './asset1.txt' : 'a--b')))
console.log(readFileSync(new URL('file:///none')))
console.log(readFileSync(new URL('--')))
console.log(readFileSync(new URL('--', '--')))
console.log(readFileSync(new URL()))
console.log(readFileSync(new URL('./test', unknown)))
console.log(readFileSync(new URL(unknown)))
import { readFileSync } from 'fs'
import { fileURLToPath } from 'url'
console.log(
readFileSync(
fileURLToPath(
`${import.meta.url}/../${unknown ? 'asset1.txt' : 'asset2.txt'}`
)
).toString()
)
;[
'package.json',
'test/unit/import-meta-tpl-cnd/asset1.txt',
'test/unit/import-meta-tpl-cnd/asset2.txt',
'test/unit/import-meta-tpl-cnd/input.js',
]
import fs from 'fs'
console.log(fs.readFileSync(new URL('./asset.txt', import.meta.url)))
;[
'package.json',
'test/unit/import-meta-url/asset.txt',
'test/unit/import-meta-url/input.js',
]
;[
'test/unit/imports/input.js',
'test/unit/imports/node.js',
'test/unit/imports/package.json',
]
{
"name": "x",
"type": "module",
"imports": {
"#x": {
"module": "./no.js",
"default": {
"node": "./node.js"
}
}
}
}
;(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) {
require('./dep.js')
})
;[
'package.json',
'test/unit/jsonc-parser-wrapper/dep.js',
'test/unit/jsonc-parser-wrapper/input.js',
]
import { readFileSync } from 'fs'
readFileSync(__dirname + '/dep.jsx')
;['test/unit/jsx-input/dep.jsx', 'test/unit/jsx-input/input.jsx']
const microtime = require('microtime')
console.log('type of microtime is ' + typeof microtime)
;[
'node_modules/microtime/index.js',
'node_modules/microtime/package.json',
'node_modules/node-gyp-build/index.js',
'node_modules/node-gyp-build/node-gyp-build.js',
'node_modules/node-gyp-build/package.json',
'package.json',
'test/unit/microtime-node-gyp/input.js',
]
const { dep1 } = require('./commonjs-module')
import { dep2 } from './ecmascript-module'
if (dep1 && dep2) {
console.log(dep1)
console.log(dep2)
}
;[
'package.json',
'test/unit/mixed-esm-cjs/commonjs-module.js',
'test/unit/mixed-esm-cjs/ecmascript-module.js',
'test/unit/mixed-esm-cjs/input.js',
]
import * as module from 'node:module'
const req = module.createRequire(import.meta.url)
const lib = req('./lib.node')
;[
'package.json',
'test/unit/module-create-require/input.js',
'test/unit/module-create-require/lib.node',
]
import { register } from 'module'
// Load relative to the current file
register('./hook.mjs', import.meta.url)
// Load from a bare specifier
register('test-pkg')
// Load with parentURL in options object
register('./hook.mjs', { parentURL: import.meta.url })
const { register } = require('module')
const { pathToFileURL } = require('url')
import('./input-esm.mjs')
// Load relative to the current file
register('./hook2.mjs', pathToFileURL(__filename))
// Load relative to the current working directory
register('./test/unit/module-register/hook3.mjs', pathToFileURL('./'))
;[
'package.json',
'test/unit/module-register/hook.mjs',
'test/unit/module-register/hook2.mjs',
'test/unit/module-register/hook3.mjs',
'test/unit/module-register/input-esm.mjs',
'test/unit/module-register/input.js',
'test/unit/module-register/node_modules/test-pkg/index.mjs',
'test/unit/module-register/node_modules/test-pkg/package.json',
]
function x(module) {}
exports.asdf = 'asdf'
console.log(module.require('./dep.js'))
if (module.require) console.log('yes')
;[
'package.json',
'test/unit/module-require/dep.js',
'test/unit/module-require/input.js',
]
;[
'test/unit/module-sync-condition-cjs/input.js',
'test/unit/module-sync-condition-cjs/package.json',
]
{
"name": "test-pkg-sync-cjs",
"type": "commonjs",
"exports": {
".": {
"module-sync": "./module-sync.js",
"import": "./import.js",
"default": "./fallback.js"
}
}
}
;[
'test/unit/module-sync-condition-es-node20/import.js',
'test/unit/module-sync-condition-es-node20/input.js',
'test/unit/module-sync-condition-es-node20/package.json',
]
{
"name": "test-pkg-sync-es",
"type": "module",
"exports": {
".": {
"module-sync": "./module-sync.js",
"import": "./import.js",
"default": "./fallback.js"
}
}
}
;[
'test/unit/module-sync-condition-es/input.js',
'test/unit/module-sync-condition-es/module-sync.js',
'test/unit/module-sync-condition-es/package.json',
]
{
"name": "test-pkg-sync-es",
"type": "module",
"exports": {
".": {
"module-sync": "./module-sync.js",
"import": "./import.js",
"default": "./fallback.js"
}
}
}
const driver = global.MONGOOSE_DRIVER_PATH || './dir'
const Connection = require(driver + '/connection')
;[
'package.json',
'test/unit/mongoose/dir/connection.js',
'test/unit/mongoose/input.js',
]
const fs = require('fs')
const { join } = require('path')
require('./input-2')
fs.readFileSync(join(__dirname, 'asset.txt'))
const fs = require('fs')
const { join } = require('path')
fs.readFileSync(join(__dirname, 'asset.txt'))
fs.readFileSync(join(__dirname, 'asset-2.txt'))
const fs = require('fs')
const { join } = require('path')
fs.readFileSync(join(__dirname, 'asset.txt'))
const fs = require('fs')
const { join } = require('path')
fs.readFileSync(join(__dirname, 'style.module.css'))
import style from './style.module.css'
import child4 from './child-4'
;[
'package.json',
'test/unit/multi-input/asset-2.txt',
'test/unit/multi-input/asset.txt',
'test/unit/multi-input/child-1.js',
'test/unit/multi-input/child-2.js',
'test/unit/multi-input/child-3.js',
'test/unit/multi-input/child-4.js',
'test/unit/multi-input/input-2.js',
'test/unit/multi-input/input-3.js',
'test/unit/multi-input/input-4.js',
'test/unit/multi-input/input.js',
'test/unit/multi-input/style.module.css',
]
const fs = require('fs')
fs.readFileSync(__dirname + '/sub/' + unknown)
// analyzable:
require('./dep')
// non-analyzable:
var s = {
require,
}
s.require('./ignored.js')
require(escaped)
;[
'package.json',
'test/unit/non-analyzable-requires/dep.js',
'test/unit/non-analyzable-requires/input.js',
]
const { sep } = require('path')
const X = sep
fs.readFileSync(__dirname + X + 'asset.txt')
;['package.json', 'test/unit/path-sep/asset.txt', 'test/unit/path-sep/input.js']
const phantom = require('phantomjs-prebuilt')
console.log('type of phantomjs-prebuilt is ' + typeof phantom)
;[
'node_modules/es6-promise/dist/es6-promise.js',
'node_modules/es6-promise/package.json',
'node_modules/phantomjs-prebuilt/bin/phantomjs',
'node_modules/phantomjs-prebuilt/lib/location.js',
'node_modules/phantomjs-prebuilt/lib/phantomjs.js',
'node_modules/phantomjs-prebuilt/package.json',
'package.json',
'test/unit/phantomjs-prebuilt/input.js',
]
const pixelmatch = require('pixelmatch')
pixelmatch(new Uint8Array(), new Uint8Array(), null, 0, 0)
;[
'node_modules/pixelmatch/bin/pixelmatch',
'node_modules/pixelmatch/index.js',
'node_modules/pixelmatch/package.json',
'node_modules/pngjs/lib/bitmapper.js',
'node_modules/pngjs/lib/bitpacker.js',
'node_modules/pngjs/lib/chunkstream.js',
'node_modules/pngjs/lib/constants.js',
'node_modules/pngjs/lib/crc.js',
'node_modules/pngjs/lib/filter-pack.js',
'node_modules/pngjs/lib/filter-parse-async.js',
'node_modules/pngjs/lib/filter-parse-sync.js',
'node_modules/pngjs/lib/filter-parse.js',
'node_modules/pngjs/lib/format-normaliser.js',
'node_modules/pngjs/lib/interlace.js',
'node_modules/pngjs/lib/packer-async.js',
'node_modules/pngjs/lib/packer-sync.js',
'node_modules/pngjs/lib/packer.js',
'node_modules/pngjs/lib/paeth-predictor.js',
'node_modules/pngjs/lib/parser-async.js',
'node_modules/pngjs/lib/parser-sync.js',
'node_modules/pngjs/lib/parser.js',
'node_modules/pngjs/lib/png-sync.js',
'node_modules/pngjs/lib/png.js',
'node_modules/pngjs/lib/sync-inflate.js',
'node_modules/pngjs/lib/sync-reader.js',
'node_modules/pngjs/package.json',
'package.json',
'test/unit/pixelmatch/input.js',
]
;[
'node_modules/pkginfo/lib/pkginfo.js',
'node_modules/pkginfo/package.json',
'test/unit/pkginfo/input.js',
'test/unit/pkginfo/package.json',
]
'use strict'
const adapter = require('parse5-htmlparser2-tree-adapter')
;[
'test/unit/pnpm-symlinks/input.js',
'test/unit/pnpm-symlinks/node_modules/.pnpm/parse5-htmlparser2-tree-adapter@6.0.1/node_modules/parse5',
'test/unit/pnpm-symlinks/node_modules/.pnpm/parse5-htmlparser2-tree-adapter@6.0.1/node_modules/parse5-htmlparser2-tree-adapter/lib/index.js',
'test/unit/pnpm-symlinks/node_modules/.pnpm/parse5-htmlparser2-tree-adapter@6.0.1/node_modules/parse5-htmlparser2-tree-adapter/package.json',
'test/unit/pnpm-symlinks/node_modules/.pnpm/parse5@6.0.1/node_modules/parse5/lib/common/doctype.js',
'test/unit/pnpm-symlinks/node_modules/.pnpm/parse5@6.0.1/node_modules/parse5/lib/common/html.js',
'test/unit/pnpm-symlinks/node_modules/.pnpm/parse5@6.0.1/node_modules/parse5/package.json',
'test/unit/pnpm-symlinks/node_modules/parse5-htmlparser2-tree-adapter',
'test/unit/pnpm-symlinks/package.json',
]
{
"name": "pnpm-symlinks",
"version": "1.0.0",
"description": "",
"main": "actual.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"parse5-htmlparser2-tree-adapter": "^6.0.1"
}
}
lockfileVersion: 5.3
specifiers:
parse5-htmlparser2-tree-adapter: ^6.0.1
dependencies:
parse5-htmlparser2-tree-adapter: 6.0.1
packages:
/parse5-htmlparser2-tree-adapter/6.0.1:
resolution: {integrity: sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==}
dependencies:
parse5: 6.0.1
dev: false
/parse5/6.0.1:
resolution: {integrity: sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==}
dev: false
;[
'package.json',
'test/unit/prisma-photon/input.js',
'test/unit/prisma-photon/node_modules/@generated/photon/index.js',
'test/unit/prisma-photon/node_modules/@generated/photon/runtime/query-engine-darwin',
]
const { resolve } = require('path')
const fs = require('fs')
const { readdir } = fs.promises
async function getPosts() {
const postsDirectory = resolve(process.cwd(), '_posts')
const postFiles = await readdir(postsDirectory)
return postFiles
}
getPosts().catch(console.error)
;[
'package.json',
'test/unit/process-cwd/_posts/first.md',
'test/unit/process-cwd/_posts/second.md',
'test/unit/process-cwd/input.js',
]
require(process.env.NODE_ENV === 'production' ? './a.js' : './b.js')
;[
'package.json',
'test/unit/process-env/a.js',
'test/unit/process-env/b.js',
'test/unit/process-env/input.js',
]
;[
'package.json',
'test/unit/processed-dependency/child-2.js',
'test/unit/processed-dependency/child.js',
'test/unit/processed-dependency/input-cached.js',
'test/unit/processed-dependency/parent-2.js',
]
;[
'package.json',
'test/unit/processed-dependency/child-2.js',
'test/unit/processed-dependency/child.js',
'test/unit/processed-dependency/input.js',
'test/unit/processed-dependency/parent-1.js',
'test/unit/processed-dependency/parent-2.js',
]
'use strict'
const path = require('path')
// Load Google's well-known proto files that aren't exposed by Protobuf.js.
{
// Protobuf.js exposes: any, duration, empty, field_mask, struct, timestamp,
// and wrappers. compiler/plugin is excluded in Protobuf.js and here.
var wellKnownProtos = ['asset1', 'asset2']
var sourceDir = path.join(__dirname, 'assets')
for (
var _i = 0, wellKnownProtos_1 = wellKnownProtos;
_i < wellKnownProtos_1.length;
_i++
) {
var proto = wellKnownProtos_1[_i]
var file = path.join(sourceDir, proto + '.txt')
var descriptor_1 = Protobuf.loadSync(file).toJSON()
// @ts-ignore
Protobuf.common(proto, descriptor_1.nested.google.nested)
}
}
//# sourceMappingURL=index.js.map
;[
'package.json',
'test/unit/protobuf-loop/assets/asset1.txt',
'test/unit/protobuf-loop/assets/asset2.txt',
'test/unit/protobuf-loop/input.js',
]
'use strict'
const path = require('path')
// Load Google's well-known proto files that aren't exposed by Protobuf.js.
{
// Protobuf.js exposes: any, duration, empty, field_mask, struct, timestamp,
// and wrappers. compiler/plugin is excluded in Protobuf.js and here.
var wellKnownProtos = ['asset1', 'asset2']
var sourceDir = path.join(__dirname, 'assets')
var _i
for (_i = 0; _i < wellKnownProtos_1.length; _i++) {
var proto = wellKnownProtos[_i]
var file = path.join(sourceDir, proto + '.txt')
var descriptor_1 = Protobuf.loadSync(file).toJSON()
// @ts-ignore
Protobuf.common(proto, descriptor_1.nested.google.nested)
}
}
//# sourceMappingURL=index.js.map
;[
'package.json',
'test/unit/protobuf-loop2/assets/asset1.txt',
'test/unit/protobuf-loop2/assets/asset2.txt',
'test/unit/protobuf-loop2/input.js',
]
;[
'package.json',
'test/unit/require-dirname-tpl/dep.js',
'test/unit/require-dirname-tpl/input.js',
]
;[
'package.json',
'test/unit/require-dot/index.js',
'test/unit/require-dot/input.js',
]
;[
'package.json',
'test/unit/require-dynamic-fallback/dep.js',
'test/unit/require-dynamic-fallback/input.js',
]
try {
typescriptPath = ''
ts = require(typescriptPath)
} catch (_) {}
const asset1 = require.resolve('./asset1.txt')
function loader() {}
loader(require.resolve('./asset2.txt'))
unknown(require.resolve('./input.js') + '/../asset1.txt')
const thing = asdf(require.resolve('./asset3.txt'))
require.resolve('./dep1.js')
;[
'package.json',
'test/unit/require-resolve/asset1.txt',
'test/unit/require-resolve/asset2.txt',
'test/unit/require-resolve/asset3.txt',
'test/unit/require-resolve/dep1.js',
'test/unit/require-resolve/dep2.js',
'test/unit/require-resolve/input.js',
]
;[
'package.json',
'test/unit/require-symlink/another.js',
'test/unit/require-symlink/input.js',
'test/unit/require-symlink/symlink',
]
var libPath = process.env['CREATESEND_NODE_COV'] ? './lib1' : './lib2'
module.exports = require(libPath + '/createsend')
;[
'package.json',
'test/unit/require-var-branch/input.js',
'test/unit/require-var-branch/lib1/createsend.js',
'test/unit/require-var-branch/lib2/createsend.js',
]
const reaction = (name) => {
const res = require(name)
res.name = name.split('/').pop()
return res
}
const reactions = {
repository: {
publicized: reaction('./dep'),
},
}
;[
'package.json',
'test/unit/require-wrapper/dep.js',
'test/unit/require-wrapper/input.js',
]
function reaction(name) {
const res = require(name)
res.name = name.split('/').pop()
return res
}
const reactions = {
repository: {
publicized: reaction('./dep'),
},
}
;[
'package.json',
'test/unit/require-wrapper2/dep.js',
'test/unit/require-wrapper2/input.js',
]
const reaction = (name) => {
const res = require(name)
res.name = name.split('/').pop()
return res
}
const reactions = {
repository: {
publicized: reaction('./dep'),
},
}
;[
'package.json',
'test/unit/require-wrapper3/dep.js',
'test/unit/require-wrapper3/input.js',
]
var resolveFrom = require('resolve-from')
var x = resolveFrom(__dirname, './dep.js')
require(x)
;[
'node_modules/resolve-from/index.js',
'node_modules/resolve-from/package.json',
'package.json',
'test/unit/resolve-from/dep.js',
'test/unit/resolve-from/input.js',
]
;[
'custom-resolution-./local-dep',
'custom-resolution-external-dep',
'package.json',
'test/unit/resolve-hook/input.js',
]
;[
'package.json',
'test/unit/return-emission/asset.txt',
'test/unit/return-emission/input.js',
]
const { getHighlighter } = require('shiki')
async function main() {
const { codeToThemedTokens } = await getHighlighter({
theme: 'nord',
langs: ['javascript'],
})
const result = codeToThemedTokens('let n=1', 'javascript')
Array.isArray(result)
}
main()
;[
'node_modules/shiki/dist/index.js',
'node_modules/shiki/languages/abap.tmLanguage.json',
'node_modules/shiki/languages/actionscript-3.tmLanguage.json',
'node_modules/shiki/languages/ada.tmLanguage.json',
'node_modules/shiki/languages/apache.tmLanguage.json',
'node_modules/shiki/languages/apex.tmLanguage.json',
'node_modules/shiki/languages/apl.tmLanguage.json',
'node_modules/shiki/languages/applescript.tmLanguage.json',
'node_modules/shiki/languages/ara.tmLanguage.json',
'node_modules/shiki/languages/asm.tmLanguage.json',
'node_modules/shiki/languages/astro.tmLanguage.json',
'node_modules/shiki/languages/awk.tmLanguage.json',
'node_modules/shiki/languages/ballerina.tmLanguage.json',
'node_modules/shiki/languages/bat.tmLanguage.json',
'node_modules/shiki/languages/beancount.tmLanguage.json',
'node_modules/shiki/languages/berry.tmLanguage.json',
'node_modules/shiki/languages/bibtex.tmLanguage.json',
'node_modules/shiki/languages/bicep.tmLanguage.json',
'node_modules/shiki/languages/blade.tmLanguage.json',
'node_modules/shiki/languages/c.tmLanguage.json',
'node_modules/shiki/languages/cadence.tmLanguage.json',
'node_modules/shiki/languages/clarity.tmLanguage.json',
'node_modules/shiki/languages/clojure.tmLanguage.json',
'node_modules/shiki/languages/cmake.tmLanguage.json',
'node_modules/shiki/languages/cobol.tmLanguage.json',
'node_modules/shiki/languages/codeql.tmLanguage.json',
'node_modules/shiki/languages/coffee.tmLanguage.json',
'node_modules/shiki/languages/cpp-macro.tmLanguage.json',
'node_modules/shiki/languages/cpp.tmLanguage.json',
'node_modules/shiki/languages/crystal.tmLanguage.json',
'node_modules/shiki/languages/csharp.tmLanguage.json',
'node_modules/shiki/languages/css.tmLanguage.json',
'node_modules/shiki/languages/csv.tmLanguage.json',
'node_modules/shiki/languages/cue.tmLanguage.json',
'node_modules/shiki/languages/cypher.tmLanguage.json',
'node_modules/shiki/languages/d.tmLanguage.json',
'node_modules/shiki/languages/dart.tmLanguage.json',
'node_modules/shiki/languages/dax.tmLanguage.json',
'node_modules/shiki/languages/diff.tmLanguage.json',
'node_modules/shiki/languages/docker.tmLanguage.json',
'node_modules/shiki/languages/dream-maker.tmLanguage.json',
'node_modules/shiki/languages/elixir.tmLanguage.json',
'node_modules/shiki/languages/elm.tmLanguage.json',
'node_modules/shiki/languages/erb.tmLanguage.json',
'node_modules/shiki/languages/erlang.tmLanguage.json',
'node_modules/shiki/languages/fish.tmLanguage.json',
'node_modules/shiki/languages/fsharp.tmLanguage.json',
'node_modules/shiki/languages/gdresource.tmLanguage.json',
'node_modules/shiki/languages/gdscript.tmLanguage.json',
'node_modules/shiki/languages/gdshader.tmLanguage.json',
'node_modules/shiki/languages/gherkin.tmLanguage.json',
'node_modules/shiki/languages/git-commit.tmLanguage.json',
'node_modules/shiki/languages/git-rebase.tmLanguage.json',
'node_modules/shiki/languages/glimmer-js.tmLanguage.json',
'node_modules/shiki/languages/glimmer-ts.tmLanguage.json',
'node_modules/shiki/languages/glsl.tmLanguage.json',
'node_modules/shiki/languages/gnuplot.tmLanguage.json',
'node_modules/shiki/languages/go.tmLanguage.json',
'node_modules/shiki/languages/graphql.tmLanguage.json',
'node_modules/shiki/languages/groovy.tmLanguage.json',
'node_modules/shiki/languages/hack.tmLanguage.json',
'node_modules/shiki/languages/haml.tmLanguage.json',
'node_modules/shiki/languages/handlebars.tmLanguage.json',
'node_modules/shiki/languages/haskell.tmLanguage.json',
'node_modules/shiki/languages/hcl.tmLanguage.json',
'node_modules/shiki/languages/hjson.tmLanguage.json',
'node_modules/shiki/languages/hlsl.tmLanguage.json',
'node_modules/shiki/languages/html.tmLanguage.json',
'node_modules/shiki/languages/http.tmLanguage.json',
'node_modules/shiki/languages/imba.tmLanguage.json',
'node_modules/shiki/languages/ini.tmLanguage.json',
'node_modules/shiki/languages/java.tmLanguage.json',
'node_modules/shiki/languages/javascript.tmLanguage.json',
'node_modules/shiki/languages/jinja-html.tmLanguage.json',
'node_modules/shiki/languages/jinja.tmLanguage.json',
'node_modules/shiki/languages/jison.tmLanguage.json',
'node_modules/shiki/languages/json.tmLanguage.json',
'node_modules/shiki/languages/json5.tmLanguage.json',
'node_modules/shiki/languages/jsonc.tmLanguage.json',
'node_modules/shiki/languages/jsonl.tmLanguage.json',
'node_modules/shiki/languages/jsonnet.tmLanguage.json',
'node_modules/shiki/languages/jssm.tmLanguage.json',
'node_modules/shiki/languages/jsx.tmLanguage.json',
'node_modules/shiki/languages/julia.tmLanguage.json',
'node_modules/shiki/languages/kotlin.tmLanguage.json',
'node_modules/shiki/languages/kusto.tmLanguage.json',
'node_modules/shiki/languages/latex.tmLanguage.json',
'node_modules/shiki/languages/less.tmLanguage.json',
'node_modules/shiki/languages/liquid.tmLanguage.json',
'node_modules/shiki/languages/lisp.tmLanguage.json',
'node_modules/shiki/languages/logo.tmLanguage.json',
'node_modules/shiki/languages/lua.tmLanguage.json',
'node_modules/shiki/languages/make.tmLanguage.json',
'node_modules/shiki/languages/markdown.tmLanguage.json',
'node_modules/shiki/languages/marko.tmLanguage.json',
'node_modules/shiki/languages/matlab.tmLanguage.json',
'node_modules/shiki/languages/mdc.tmLanguage.json',
'node_modules/shiki/languages/mdx.tmLanguage.json',
'node_modules/shiki/languages/mermaid.tmLanguage.json',
'node_modules/shiki/languages/mojo.tmLanguage.json',
'node_modules/shiki/languages/narrat.tmLanguage.json',
'node_modules/shiki/languages/nextflow.tmLanguage.json',
'node_modules/shiki/languages/nginx.tmLanguage.json',
'node_modules/shiki/languages/nim.tmLanguage.json',
'node_modules/shiki/languages/nix.tmLanguage.json',
'node_modules/shiki/languages/nushell.tmLanguage.json',
'node_modules/shiki/languages/objective-c.tmLanguage.json',
'node_modules/shiki/languages/objective-cpp.tmLanguage.json',
'node_modules/shiki/languages/ocaml.tmLanguage.json',
'node_modules/shiki/languages/pascal.tmLanguage.json',
'node_modules/shiki/languages/perl.tmLanguage.json',
'node_modules/shiki/languages/php-html.tmLanguage.json',
'node_modules/shiki/languages/php.tmLanguage.json',
'node_modules/shiki/languages/plsql.tmLanguage.json',
'node_modules/shiki/languages/postcss.tmLanguage.json',
'node_modules/shiki/languages/powerquery.tmLanguage.json',
'node_modules/shiki/languages/powershell.tmLanguage.json',
'node_modules/shiki/languages/prisma.tmLanguage.json',
'node_modules/shiki/languages/prolog.tmLanguage.json',
'node_modules/shiki/languages/proto.tmLanguage.json',
'node_modules/shiki/languages/pug.tmLanguage.json',
'node_modules/shiki/languages/puppet.tmLanguage.json',
'node_modules/shiki/languages/purescript.tmLanguage.json',
'node_modules/shiki/languages/python.tmLanguage.json',
'node_modules/shiki/languages/r.tmLanguage.json',
'node_modules/shiki/languages/raku.tmLanguage.json',
'node_modules/shiki/languages/razor.tmLanguage.json',
'node_modules/shiki/languages/reg.tmLanguage.json',
'node_modules/shiki/languages/rel.tmLanguage.json',
'node_modules/shiki/languages/riscv.tmLanguage.json',
'node_modules/shiki/languages/rst.tmLanguage.json',
'node_modules/shiki/languages/ruby.tmLanguage.json',
'node_modules/shiki/languages/rust.tmLanguage.json',
'node_modules/shiki/languages/sas.tmLanguage.json',
'node_modules/shiki/languages/sass.tmLanguage.json',
'node_modules/shiki/languages/scala.tmLanguage.json',
'node_modules/shiki/languages/scheme.tmLanguage.json',
'node_modules/shiki/languages/scss.tmLanguage.json',
'node_modules/shiki/languages/shaderlab.tmLanguage.json',
'node_modules/shiki/languages/shellscript.tmLanguage.json',
'node_modules/shiki/languages/shellsession.tmLanguage.json',
'node_modules/shiki/languages/smalltalk.tmLanguage.json',
'node_modules/shiki/languages/solidity.tmLanguage.json',
'node_modules/shiki/languages/sparql.tmLanguage.json',
'node_modules/shiki/languages/splunk.tmLanguage.json',
'node_modules/shiki/languages/sql.tmLanguage.json',
'node_modules/shiki/languages/ssh-config.tmLanguage.json',
'node_modules/shiki/languages/stata.tmLanguage.json',
'node_modules/shiki/languages/stylus.tmLanguage.json',
'node_modules/shiki/languages/svelte.tmLanguage.json',
'node_modules/shiki/languages/swift.tmLanguage.json',
'node_modules/shiki/languages/system-verilog.tmLanguage.json',
'node_modules/shiki/languages/tasl.tmLanguage.json',
'node_modules/shiki/languages/tcl.tmLanguage.json',
'node_modules/shiki/languages/tex.tmLanguage.json',
'node_modules/shiki/languages/toml.tmLanguage.json',
'node_modules/shiki/languages/tsx.tmLanguage.json',
'node_modules/shiki/languages/turtle.tmLanguage.json',
'node_modules/shiki/languages/twig.tmLanguage.json',
'node_modules/shiki/languages/typescript.tmLanguage.json',
'node_modules/shiki/languages/v.tmLanguage.json',
'node_modules/shiki/languages/vb.tmLanguage.json',
'node_modules/shiki/languages/verilog.tmLanguage.json',
'node_modules/shiki/languages/vhdl.tmLanguage.json',
'node_modules/shiki/languages/viml.tmLanguage.json',
'node_modules/shiki/languages/vue-html.tmLanguage.json',
'node_modules/shiki/languages/vue.tmLanguage.json',
'node_modules/shiki/languages/vyper.tmLanguage.json',
'node_modules/shiki/languages/wasm.tmLanguage.json',
'node_modules/shiki/languages/wenyan.tmLanguage.json',
'node_modules/shiki/languages/wgsl.tmLanguage.json',
'node_modules/shiki/languages/wolfram.tmLanguage.json',
'node_modules/shiki/languages/xml.tmLanguage.json',
'node_modules/shiki/languages/xsl.tmLanguage.json',
'node_modules/shiki/languages/yaml.tmLanguage.json',
'node_modules/shiki/languages/zenscript.tmLanguage.json',
'node_modules/shiki/languages/zig.tmLanguage.json',
'node_modules/shiki/package.json',
'node_modules/shiki/themes/css-variables.json',
'node_modules/shiki/themes/dark-plus.json',
'node_modules/shiki/themes/dracula-soft.json',
'node_modules/shiki/themes/dracula.json',
'node_modules/shiki/themes/github-dark-dimmed.json',
'node_modules/shiki/themes/github-dark.json',
'node_modules/shiki/themes/github-light.json',
'node_modules/shiki/themes/light-plus.json',
'node_modules/shiki/themes/material-theme-darker.json',
'node_modules/shiki/themes/material-theme-lighter.json',
'node_modules/shiki/themes/material-theme-ocean.json',
'node_modules/shiki/themes/material-theme-palenight.json',
'node_modules/shiki/themes/material-theme.json',
'node_modules/shiki/themes/min-dark.json',
'node_modules/shiki/themes/min-light.json',
'node_modules/shiki/themes/monokai.json',
'node_modules/shiki/themes/nord.json',
'node_modules/shiki/themes/one-dark-pro.json',
'node_modules/shiki/themes/poimandres.json',
'node_modules/shiki/themes/rose-pine-dawn.json',
'node_modules/shiki/themes/rose-pine-moon.json',
'node_modules/shiki/themes/rose-pine.json',
'node_modules/shiki/themes/slack-dark.json',
'node_modules/shiki/themes/slack-ochin.json',
'node_modules/shiki/themes/solarized-dark.json',
'node_modules/shiki/themes/solarized-light.json',
'node_modules/shiki/themes/vitesse-black.json',
'node_modules/shiki/themes/vitesse-dark.json',
'node_modules/shiki/themes/vitesse-light.json',
'node_modules/vscode-oniguruma/package.json',
'node_modules/vscode-oniguruma/release/main.js',
'node_modules/vscode-oniguruma/release/onig.wasm',
'node_modules/vscode-textmate/package.json',
'node_modules/vscode-textmate/release/main.js',
'package.json',
'test/unit/shiki/input.js',
]
;['dep.js'].map((file) => {
const m = require('./lib/'.concat(file))
console.log(m)
})
;[
'package.json',
'test/unit/string-concat/input.js',
'test/unit/string-concat/lib/dep.js',
]
// if (typeof __filename > 'undefine') {
+
\ No newline at end of file
import { dep } from './module'
await Promise.resolve(console.log(dep))
;[
'package.json',
'test/unit/top-level-await/input.js',
'test/unit/top-level-await/module.js',
]
const { join } = require('path')
require('pkg')
// asset reference to ts file in node_modules
// should not cause ts file to be compiled
fs.readFileSync(join(__dirname, 'node_modules', 'pkg', 'index.ts'))
;[
'package.json',
'test/unit/ts-filter/input.js',
'test/unit/ts-filter/node_modules/pkg/index.js',
'test/unit/ts-filter/node_modules/pkg/index.ts',
]
async function start() {
const { dep2 } = await import('./dep2.js')
return dep2
}
start()
export const dep1 = 'dep1'
;[
'test/unit/ts-input-esm/dep1.ts',
'test/unit/ts-input-esm/dep2.ts',
'test/unit/ts-input-esm/input.ts',
'test/unit/ts-input-esm/package.json',
]
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"lib": ["esnext"],
"moduleResolution": "node",
"esModuleInterop": true,
"strict": true
}
}
'use strict'
Object.defineProperty(exports, '__esModule', { value: true })
const path_1 = require('path')
// See https://devblogs.microsoft.com/typescript/announcing-typescript-4-4/#more-compliant-indirect-calls-for-imported-functions
// Also https://2ality.com/2015/12/references.html
const file = (0, path_1.join)(__dirname, 'file.txt')
console.log(file)
;[
'package.json',
'test/unit/ts-path-join/file.txt',
'test/unit/ts-path-join/input.js',
]
;['test/unit/tsx-input/dep.tsx', 'test/unit/tsx-input/input.tsx']
;[
'package.json',
'test/unit/tsx/dep.tsx',
'test/unit/tsx/input.js',
'test/unit/tsx/lib.ts',
]
const URLParser = typeof window === 'undefined' ? URL : 'b'
;(function () {
var exports = {}
exports.id = 223
exports.ids = [223]
exports.modules = {
/***/ 0: /***/ function (module, exports, __webpack_require__) {
module.exports = __webpack_require__('PicC')
/***/
},
/***/ PicC: /***/ function (
module,
__webpack_exports__,
__webpack_require__
) {
'use strict'
__webpack_require__.r(__webpack_exports__)
/* harmony export (binding) */ __webpack_require__.d(
__webpack_exports__,
'default',
function () {
return handler
}
)
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = require('path')
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default =
/*#__PURE__*/ __webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__)
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = require('fs')
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default =
/*#__PURE__*/ __webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__)
f(__webpack_require__('oyvS'))
function handler(req, res) {
const dictionaryPath = path__WEBPACK_IMPORTED_MODULE_0___default().join(
process.cwd(),
'assets',
'dictionary.json'
)
const content = fs__WEBPACK_IMPORTED_MODULE_1___default().readFileSync(
dictionaryPath,
'utf-8'
)
res.json(content)
}
/***/
},
/***/ 'mw/K': /***/ function (module, exports) {
module.exports = require('fs')
/***/
},
/***/ oyvS: /***/ function (module, exports) {
module.exports = require('path')
/***/
},
/******/
}
// load runtime
var __webpack_require__ = require('../../webpack-runtime.js')
__webpack_require__.C(exports)
var __webpack_exec__ = function (moduleId) {
return __webpack_require__((__webpack_require__.s = moduleId))
}
var __webpack_exports__ = __webpack_exec__(277)
module.exports = __webpack_exports__
})()
;[
'package.json',
'test/unit/webpack-5-wrapper-namespace/assets/dictionary.json',
'test/unit/webpack-5-wrapper-namespace/input.js',
]
const page = require('./level1/level2/level3/page')
console.log(`${page.getChunk('a')} ${page.getChunk('c')}`)
function getChunk(chunkId) {
var chunk = require(
'../../' +
({}[chunkId] || chunkId) +
'.' +
{
a: 'b',
c: 'd',
}[chunkId] +
'.js'
)
return chunk
}
module.exports = { getChunk }
;[
'package.json',
'test/unit/webpack-node/input.js',
'test/unit/webpack-node/level1/a.b.js',
'test/unit/webpack-node/level1/c.d.js',
'test/unit/webpack-node/level1/level2/level3/page.js',
]
module.exports = /******/ (function (modules) {
// webpackBootstrap
/******/ // The module cache
/******/ var installedModules = require('../../ssr-module-cache.js')
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if (installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports
/******/
}
/******/ // Create a new module (and put it into the cache)
/******/ var module = (installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {},
/******/
})
/******/
/******/ // Execute the module function
/******/ var threw = true
/******/ try {
/******/ modules[moduleId].call(
module.exports,
module,
module.exports,
__webpack_require__
)
/******/ threw = false
/******/
} finally {
/******/ if (threw) delete installedModules[moduleId]
/******/
}
/******/
/******/ // Flag the module as loaded
/******/ module.l = true
/******/
/******/ // Return the exports of the module
/******/ return module.exports
/******/
}
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function (exports, name, getter) {
/******/ if (!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
enumerable: true,
get: getter,
})
/******/
}
/******/
}
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function (exports) {
/******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, {
value: 'Module',
})
/******/
}
/******/ Object.defineProperty(exports, '__esModule', { value: true })
/******/
}
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function (value, mode) {
/******/ if (mode & 1) value = __webpack_require__(value)
/******/ if (mode & 8) return value
/******/ if (
mode & 4 &&
typeof value === 'object' &&
value &&
value.__esModule
)
return value
/******/ var ns = Object.create(null)
/******/ __webpack_require__.r(ns)
/******/ Object.defineProperty(ns, 'default', {
enumerable: true,
value: value,
})
/******/ if (mode & 2 && typeof value != 'string')
for (var key in value)
__webpack_require__.d(
ns,
key,
function (key) {
return value[key]
}.bind(null, key)
)
/******/ return ns
/******/
}
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function (module) {
/******/ var getter =
module && module.__esModule
? /******/ function getDefault() {
return module['default']
}
: /******/ function getModuleExports() {
return module
}
/******/ __webpack_require__.d(getter, 'a', getter)
/******/ return getter
/******/
}
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function (object, property) {
return Object.prototype.hasOwnProperty.call(object, property)
}
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = ''
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__((__webpack_require__.s = 1))
/******/
})(
/************************************************************************/
/******/ {
/***/ '6oGy': /***/ function (module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */ ;(function (__dirname) {
Object.defineProperty(exports, '__esModule', {
value: true,
})
const {
PrismaClientKnownRequestError,
PrismaClientUnknownRequestError,
PrismaClientRustPanicError,
PrismaClientInitializationError,
PrismaClientValidationError,
warnEnvConflicts,
getPrismaClient,
debugLib,
sqltag,
empty,
join,
raw,
Decimal,
} = __webpack_require__('OSkX')
const path = __webpack_require__('oyvS')
const debug = debugLib('prisma-client')
const Prisma = {}
exports.Prisma = Prisma
/**
* Build tool annotations
* In order to make `ncc` and `@vercel/nft` happy.
* The process.cwd() annotation is only needed for https://github.com/vercel/vercel/tree/master/packages/now-next
**/
path.join(__dirname, 'query-engine-debian-openssl-1.1.x')
path.join(
process.cwd(),
'./prisma/generated/client/query-engine-debian-openssl-1.1.x'
)
/**
* Annotation for `@vercel/nft`
* The process.cwd() annotation is only needed for https://github.com/vercel/vercel/tree/master/packages/now-next
**/
path.join(__dirname, 'schema.prisma')
path.join(process.cwd(), './schema.prisma')
/* WEBPACK VAR INJECTION */
}).call(this, '/')
/***/
},
/***/ oyvS: /***/ function (module, exports) {
module.exports = require('path')
/***/
},
/******/
}
)
;[
'package.json',
'test/unit/webpack-wrapper-dirname-inject/input.js',
'test/unit/webpack-wrapper-dirname-inject/schema.prisma',
]
;(function () {
var exports = {}
exports.id = 405
exports.ids = [405]
exports.modules = {
/***/ 474: /***/ function (
__unused_webpack_module,
__webpack_exports__,
__webpack_require__
) {
'use strict'
__webpack_require__.r(__webpack_exports__)
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ default: function () {
return /* binding */ _
},
/* harmony export */ getServerSideProps: function () {
return /* binding */ getServerSideProps
},
/* harmony export */
})
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ =
__webpack_require__(282)
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default =
/*#__PURE__*/ __webpack_require__.n(
react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__
)
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ =
__webpack_require__(747)
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default =
/*#__PURE__*/ __webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__)
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ =
__webpack_require__(622)
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default =
/*#__PURE__*/ __webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__)
function _({ text }) {
return /*#__PURE__*/ (0,
react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)('div', {
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(
'h1',
{
children: 'next-webpack-5-fs-bug',
}
),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(
'p',
{
children: text,
}
),
],
})
}
function getServerSideProps() {
const text = (0, fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync)(
path__WEBPACK_IMPORTED_MODULE_2___default().resolve(
__dirname,
'asset.txt'
),
{
encoding: 'utf-8',
}
)
return {
props: {
text,
},
}
}
/***/
},
/***/ 747: /***/ function (module) {
'use strict'
module.exports = require('fs')
/***/
},
/***/ 622: /***/ function (module) {
'use strict'
module.exports = require('path')
/***/
},
/***/ 282: /***/ function (module) {
'use strict'
module.exports = none
/***/
},
}
// load runtime
var __webpack_require__ = require('../webpack-runtime.js')
__webpack_require__.C(exports)
var __webpack_exec__ = function (moduleId) {
return __webpack_require__((__webpack_require__.s = moduleId))
}
var __webpack_exports__ = __webpack_exec__(474)
module.exports = __webpack_exports__
})()
;[
'package.json',
'test/unit/webpack-wrapper-multi/asset.txt',
'test/unit/webpack-wrapper-multi/input.js',
]
;(function () {
var exports = {}
exports.id = 405
exports.ids = [405]
exports.modules = {
/***/ 912: /***/ function () {
/*!
* fullpage.js Fading Effect Extension 0.1.2 for fullPage.js v3
* https://github.com/alvarotrigo/fullPage.js
*
* @license This code has been bought from www.alvarotrigo.com/fullPage/extensions/ and it is not free to use or distribute.
* Copyright (C) 2016 alvarotrigo.com - A project by Alvaro Trigo
*/
/* eslint-disable */
window.fp_fadingEffectExtension = function () {
var n,
o,
a,
l,
e = this,
r = window.fp_utils,
s = window.fullpage_api,
c = r.$,
t = s.getFullpageData(),
f = t.options,
d = t.internals,
i = f.scrollingSpeed,
u = '.fullpage-wrapper',
p = '.active',
m = '.fp-section',
v = m + p,
g = '.fp-slide',
w = '.fp-slidesContainer',
E = g + p,
h = 'fp-fading-animations',
y = '#' + h,
S = 'fp-fading-sheet',
T = '#' + S
function x(e) {
e.detail ? ((l = !1), C()) : ((l = a.autoScrolling), N())
}
function O() {
var e
;((e = c(u)[0]).addEventListener('afterResponsive', x),
e.addEventListener('destroy', C))
var t = f.scrollOverflowHandler
;((f.scrollOverflowHandler = null),
(a = r.deepExtend({}, f)),
(l = a.autoScrolling),
(f.scrollOverflowHandler = t),
(a.scrollOverflowHandler = t),
(f.scrollBar = !1),
b('sections') && s.setAutoScrolling(!0))
var n = b('slides') ? L(g) : '',
i = b('sections') ? L(m) : ''
;(f.fadingEffect && A(S, i + n),
d.removeAnimation(c(w)),
clearTimeout(o),
(o = setTimeout(B, 300)))
}
function b(e) {
return !0 === f.fadingEffect || f.fadingEffect === e
}
function A(e, t) {
if (!c('#' + e).length) {
var n = document.head || document.getElementsByTagName('head')[0]
r.appendTo(
((i = e),
(o = t),
((a = document.createElement('style')).type = 'text/css'),
(a.id = i),
a.styleSheet
? (a.styleSheet.cssText = o)
: a.appendChild(document.createTextNode(o)),
a),
n
)
}
var i, o, a
}
function B() {
n = 'all ' + i + 'ms ' + f.easingcss3
var e = b('slides') ? H(g) : '',
t = b('sections') ? H(m) : ''
A(h, e + t)
}
function H(e) {
return e + '{-webkit-transition: ' + n + ';transition: ' + n + ';}'
}
function L(e) {
return (
(e === g
? '.fp-slidesContainer {width: 100% !important;transform: none!important;}'
: '') +
e +
'{width: 100% !important;position: absolute !important;left: 0;top: 0;visibility: hidden;opacity: 0;}' +
e +
'.active{visibility: visible;opacity: 1;z-index: 1}'
)
}
function C() {
if ((r.remove(c(y)), _())) {
var e = c(E, c(v)[0])[0],
t = c(w, c(v)[0])
;(d.removeAnimation(t),
r.remove(c(T)),
(f.scrollBar = a.scrollBar),
s.setAutoScrolling(l),
null != e && d.silentLandscapeScroll(e))
}
}
function _() {
return c(T).length
}
function N() {
;((f.fadingEffect = a.fadingEffect),
_() || (O(), window.scrollTo(0, 0), d.silentScroll(0)))
}
;((e.update = function (e) {
;(r.remove(c(y)), (i = e), B())
}),
(e.turnOn = N),
(e.turnOff = C),
(e.apply = O),
(e.c = d.c))
var k = e['common'.charAt(0)]
return (
'complete' === document.readyState && k('fadingEffect'),
window.addEventListener('load', function () {
k('fadingEffect')
}),
e
)
}
/***/
},
}
// load runtime
var __webpack_require__ = require('../webpack-runtime.js')
__webpack_require__.C(exports)
var __webpack_exec__ = function (moduleId) {
return __webpack_require__((__webpack_require__.s = moduleId))
}
var __webpack_exports__ = __webpack_exec__(3178)
module.exports = __webpack_exports__
})()
;[
'package.json',
'test/unit/webpack-wrapper-name/input.js',
'test/unit/webpack-wrapper-name/mangled.js',
]
module.exports = (function (t) {
var e = {}
function r(n) {
if (e[n]) return e[n].exports
var o = (e[n] = {
i: n,
l: !1,
exports: {},
})
return (t[n].call(o.exports, o, o.exports, r), (o.l = !0), o.exports)
}
return (
(r.m = t),
(r.c = e),
(r.d = function (t, e, n) {
r.o(t, e) ||
Object.defineProperty(t, e, {
enumerable: !0,
get: n,
})
}),
(r.r = function (t) {
;('undefined' != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(t, Symbol.toStringTag, {
value: 'Module',
}),
Object.defineProperty(t, '__esModule', {
value: !0,
}))
}),
(r.t = function (t, e) {
if ((1 & e && (t = r(t)), 8 & e)) return t
if (4 & e && 'object' == typeof t && t && t.__esModule) return t
var n = Object.create(null)
if (
(r.r(n),
Object.defineProperty(n, 'default', {
enumerable: !0,
value: t,
}),
2 & e && 'string' != typeof t)
)
for (var o in t)
r.d(
n,
o,
function (e) {
return t[e]
}.bind(null, o)
)
return n
}),
(r.n = function (t) {
var e =
t && t.__esModule
? function () {
return t.default
}
: function () {
return t
}
return (r.d(e, 'a', e), e)
}),
(r.o = function (t, e) {
return Object.prototype.hasOwnProperty.call(t, e)
}),
(r.p = ''),
r((r.s = 5))
)
})([
function (t, e, r) {
function n(t) {
return (n =
'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator
? function (t) {
return typeof t
}
: function (t) {
return t &&
'function' == typeof Symbol &&
t.constructor === Symbol &&
t !== Symbol.prototype
? 'symbol'
: typeof t
})(t)
}
var o = r(1),
u = Object.seal(['string', 'number'])
t.exports = function () {
for (var t = arguments.length, e = new Array(t), r = 0; r < t; r++)
e[r] = arguments[r]
var i = {
recursive: !0,
resolve: !0,
clean: !1,
}
function f() {
var t =
arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : '',
r = arguments.length > 1 ? arguments[1] : void 0
if ('string' != typeof t)
throw new TypeError(
'paraphrase expects first argument to be a string, got a '
.concat(n(t), ' (')
.concat(t, ')')
)
if (!r) return t
for (
var c = arguments.length, l = new Array(c > 2 ? c - 2 : 0), y = 2;
y < c;
y++
)
l[y - 2] = arguments[y]
function a(t, e) {
var c = i.resolve ? o(r, e.trim()) : r[e.trim()]
return u.includes(n(c)) ? c : i.clean ? '' : t
}
u.includes(n(r)) && (r = [r].concat(l))
var p = e.reduce(function (t, e) {
return t.replace(e, a)
}, t)
return i.recursive && t !== p ? f.apply(void 0, [p, r].concat(l)) : p
}
return (
e.length && c(e[e.length - 1]) && Object.assign(i, e.pop()),
(f.patterns = e),
f
)
}
var c = function (t) {
return '[object Object]' === ''.concat(t)
}
},
function (t, e, r) {
'use strict'
function n(t) {
return (n =
'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator
? function (t) {
return typeof t
}
: function (t) {
return t &&
'function' == typeof Symbol &&
t.constructor === Symbol &&
t !== Symbol.prototype
? 'symbol'
: typeof t
})(t)
}
function o(t) {
return (o =
'function' == typeof Symbol && 'symbol' === n(Symbol.iterator)
? function (t) {
return n(t)
}
: function (t) {
return t &&
'function' == typeof Symbol &&
t.constructor === Symbol &&
t !== Symbol.prototype
? 'symbol'
: n(t)
})(t)
}
t.exports = function (t) {
var e =
arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : ''
return e.split('.').reduce(function (t, e) {
return 'object' === o(t) ? t[e] : t
}, t)
}
},
,
,
,
function (t, e, r) {
t.exports = r(0)(/%{([^{}]*)}/gm)
},
])
;[
'package.json',
'test/unit/webpack-wrapper-null/input.js',
'test/unit/webpack-wrapper-null/mangled.js',
]
;[
'node_modules/object-assign/index.js',
'node_modules/object-assign/package.json',
'node_modules/prop-types/checkPropTypes.js',
'node_modules/prop-types/factoryWithThrowingShims.js',
'node_modules/prop-types/factoryWithTypeCheckers.js',
'node_modules/prop-types/index.js',
'node_modules/prop-types/lib/ReactPropTypesSecret.js',
'node_modules/prop-types/lib/has.js',
'node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js',
'node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js',
'node_modules/prop-types/node_modules/react-is/index.js',
'node_modules/prop-types/node_modules/react-is/package.json',
'node_modules/prop-types/package.json',
'node_modules/react/cjs/react.development.js',
'node_modules/react/cjs/react.production.min.js',
'node_modules/react/index.js',
'node_modules/react/package.json',
'package.json',
'test/unit/webpack-wrapper-strs-namespaces-large/content/guides/index.md',
'test/unit/webpack-wrapper-strs-namespaces-large/content/packages.json',
'test/unit/webpack-wrapper-strs-namespaces-large/input.js',
]
module.exports = /******/ (function (modules) {
// webpackBootstrap
/******/ // The module cache
/******/ var installedModules = require('path')
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if (installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports
/******/
}
/******/ // Create a new module (and put it into the cache)
/******/ var module = (installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {},
/******/
})
/******/
/******/ // Execute the module function
/******/ var threw = true
/******/ try {
/******/ modules[moduleId].call(
module.exports,
module,
module.exports,
__webpack_require__
)
/******/ threw = false
/******/
} finally {
/******/ if (threw) delete installedModules[moduleId]
/******/
}
/******/
/******/ // Flag the module as loaded
/******/ module.l = true
/******/
/******/ // Return the exports of the module
/******/ return module.exports
/******/
}
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function (exports, name, getter) {
/******/ if (!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
enumerable: true,
get: getter,
})
/******/
}
/******/
}
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function (exports) {
/******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, {
value: 'Module',
})
/******/
}
/******/ Object.defineProperty(exports, '__esModule', { value: true })
/******/
}
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function (value, mode) {
/******/ if (mode & 1) value = __webpack_require__(value)
/******/ if (mode & 8) return value
/******/ if (
mode & 4 &&
typeof value === 'object' &&
value &&
value.__esModule
)
return value
/******/ var ns = Object.create(null)
/******/ __webpack_require__.r(ns)
/******/ Object.defineProperty(ns, 'default', {
enumerable: true,
value: value,
})
/******/ if (mode & 2 && typeof value != 'string')
for (var key in value)
__webpack_require__.d(
ns,
key,
function (key) {
return value[key]
}.bind(null, key)
)
/******/ return ns
/******/
}
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function (module) {
/******/ var getter =
module && module.__esModule
? /******/ function getDefault() {
return module['default']
}
: /******/ function getModuleExports() {
return module
}
/******/ __webpack_require__.d(getter, 'a', getter)
/******/ return getter
/******/
}
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function (object, property) {
return Object.prototype.hasOwnProperty.call(object, property)
}
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = ''
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__((__webpack_require__.s = 0))
/******/
})(
/************************************************************************/
/******/ {
/***/ 0: /***/ function (module, exports, __webpack_require__) {
module.exports = __webpack_require__('PicC')
/***/
},
/***/ PicC: /***/ function (
module,
__webpack_exports__,
__webpack_require__
) {
'use strict'
__webpack_require__.r(__webpack_exports__)
/* harmony export (binding) */ __webpack_require__.d(
__webpack_exports__,
'default',
function () {
return handler
}
)
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ =
__webpack_require__('oyvS')
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default =
/*#__PURE__*/ __webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__)
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ =
__webpack_require__('mw/K')
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default =
/*#__PURE__*/ __webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__)
f(__webpack_require__('oyvS'))
function handler(req, res) {
const dictionaryPath = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(
process.cwd(),
'assets',
'dictionary.json'
)
const content = fs__WEBPACK_IMPORTED_MODULE_1___default.a.readFileSync(
dictionaryPath,
'utf-8'
)
res.json(content)
}
/***/
},
/***/ 'mw/K': /***/ function (module, exports) {
module.exports = require('fs')
/***/
},
/***/ oyvS: /***/ function (module, exports) {
module.exports = require('path')
/***/
},
/******/
}
)
;[
'package.json',
'test/unit/webpack-wrapper-strs-namespaces/assets/dictionary.json',
'test/unit/webpack-wrapper-strs-namespaces/input.js',
]
!(function (e) {
var t = {}
function r(n) {
if (t[n]) return t[n].exports
var o = (t[n] = { i: n, l: !1, exports: {} })
return (e[n].call(o.exports, o, o.exports, r), (o.l = !0), o.exports)
}
;((r.m = e),
(r.c = t),
(r.d = function (e, t, n) {
r.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: n })
}),
(r.r = function (e) {
;('undefined' != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }),
Object.defineProperty(e, '__esModule', { value: !0 }))
}),
(r.t = function (e, t) {
if ((1 & t && (e = r(e)), 8 & t)) return e
if (4 & t && 'object' == typeof e && e && e.__esModule) return e
var n = Object.create(null)
if (
(r.r(n),
Object.defineProperty(n, 'default', { enumerable: !0, value: e }),
2 & t && 'string' != typeof e)
)
for (var o in e)
r.d(
n,
o,
function (t) {
return e[t]
}.bind(null, o)
)
return n
}),
(r.n = function (e) {
var t =
e && e.__esModule
? function () {
return e.default
}
: function () {
return e
}
return (r.d(t, 'a', t), t)
}),
(r.o = function (e, t) {
return Object.prototype.hasOwnProperty.call(e, t)
}),
(r.p = ''),
r((r.s = 2)))
})([
function (e, t) {
e.exports = require('fs')
},
function (e, t) {
e.exports = require('path')
},
function (e, t, r) {
const n = r(0),
o = r(1)
console.log(n.readFileSync(o.resolve(__dirname, './asset.txt')))
},
])
;[
'package.json',
'test/unit/webpack-wrapper/asset.txt',
'test/unit/webpack-wrapper/input.js',
]
;(function (define) {
'use strict'
define(function (require) {
require('./dep.js')
})
})(
typeof define === 'function' && define.amd
? define
: function (factory) {
module.exports = factory(require)
}
)
;[
'package.json',
'test/unit/when-wrapper/dep.js',
'test/unit/when-wrapper/input.js',
]
const num = Math.ceil(Math.random() * 3, 0)
const m = require(`./modules/module${num}`)
console.log(m)
;[
'package.json',
'test/unit/wildcard-require/input.js',
'test/unit/wildcard-require/modules/module1.js',
'test/unit/wildcard-require/modules/module2.js',
'test/unit/wildcard-require/modules/module3.js',
]
const path = require('path')
fs.readFileSync(path.join(__dirname, 'assets', unknown) + '.txt')
fs.readFileSync(path.join(__dirname, 'assets', ...unknown) + '.txt')
;[
'package.json',
'test/unit/wildcard/assets/asset1.txt',
'test/unit/wildcard/assets/asset2.txt',
'test/unit/wildcard/assets/asset3.txt',
'test/unit/wildcard/input.js',
]
const path = require('path')
fs.readFileSync(path.join(__dirname, unknown) + '/asset1.txt')
;[
'package.json',
'test/unit/wildcard2/assets/asset1.txt',
'test/unit/wildcard2/input.js',
]
const path = require('path')
const num = Math.ceil(Math.random() * 3)
fs.readFileSync(path.join(__dirname, 'assets', 'asset') + num + '.txt')
;[
'package.json',
'test/unit/wildcard3/assets/asset1.txt',
'test/unit/wildcard3/assets/asset2.txt',
'test/unit/wildcard3/assets/asset3.txt',
'test/unit/wildcard3/input.js',
]
{
"systemParams": "darwin-x64-72",
"modulesFolders": [
"node_modules",
"node_modules"
],
"flags": [],
"linkedModules": [],
"topLevelPatterns": [
"@example/common@1.0.0",
"@example/common@1.0.0",
"@example/web@2.0.0"
],
"lockfileEntries": {},
"files": [],
"artifacts": {}
}
\ No newline at end of file
;[
'test/unit/yarn-workspace-esm/input.js',
'test/unit/yarn-workspace-esm/node_modules/@example/common',
'test/unit/yarn-workspace-esm/node_modules/@example/web',
'test/unit/yarn-workspace-esm/package.json',
'test/unit/yarn-workspace-esm/packages/common/hello.js',
'test/unit/yarn-workspace-esm/packages/common/package.json',
'test/unit/yarn-workspace-esm/packages/web/index.js',
'test/unit/yarn-workspace-esm/packages/web/package.json',
]
{
"private": true,
"type": "module",
"workspaces": {
"packages": [
"packages/*"
]
}
}
{
"name": "@example/common",
"version": "1.0.0",
"main": "hello.js",
"type": "module"
}
import { hello } from '@example/common'
export default function handler() {
console.log(hello('world'))
}
{
"name": "@example/web",
"version": "2.0.0",
"type": "module",
"dependencies": {
"@example/common": "1.0.0"
}
}
;[
'package.json',
'test/unit/yarn-workspaces/input.js',
'test/unit/yarn-workspaces/node_modules/x',
'test/unit/yarn-workspaces/packages/x/dep.js',
'test/unit/yarn-workspaces/packages/x/main.ts',
'test/unit/yarn-workspaces/packages/x/package.json',
]
;[
'node_modules/@aminya/node-gyp-build/index.js',
'node_modules/@aminya/node-gyp-build/package.json',
'node_modules/zeromq/lib/draft.js',
'node_modules/zeromq/lib/index.js',
'node_modules/zeromq/lib/native.js',
'node_modules/zeromq/lib/util.js',
'node_modules/zeromq/package.json',
'package.json',
'test/unit/zeromq-node-gyp/input.js',
]
const fs = require('fs')
const { join, relative } = require('path')
const { nodeFileTrace } = require('../out/node-file-trace')
const gracefulFS = require('graceful-fs')
const analyze = require('../out/analyze.js').default
const stat = gracefulFS.promises.stat
const readlink = gracefulFS.promises.readlink
const readFile = gracefulFS.promises.readFile
global._unit = true
const nodeGypTests = [
'datadog-pprof-node-gyp',
'microtime-node-gyp',
'zeromq-node-gyp',
]
const skipOnWindows = [
'datadog-pprof-node-gyp',
'yarn-workspaces',
'yarn-workspaces-base-root',
'yarn-workspace-esm',
'asset-symlink',
'require-symlink',
]
const skipOnMac = []
const skipOnNode20AndBelow = ['module-sync-condition-es']
const skipOnNode22AndAbove = ['module-sync-condition-es-node20']
if (process.platform === 'darwin' && process.arch === 'arm64') {
skipOnMac.push('microtime-node-gyp')
}
const unitTestDirs = fs.readdirSync(join(__dirname, 'unit'))
const unitTests = [
...unitTestDirs.map((testName) => ({ testName, isRoot: false })),
...unitTestDirs.map((testName) => ({ testName, isRoot: true })),
]
jest.mock('../out/analyze.js', () => {
const originalModule = jest.requireActual('../out/analyze.js').default
return {
__esModule: true,
default: jest.fn(originalModule),
}
})
jest.mock('graceful-fs', () => {
const originalModule = jest.requireActual('graceful-fs')
return {
...originalModule,
promises: {
...originalModule.promises,
stat: jest.fn(originalModule.promises.stat),
readFile: jest.fn(originalModule.promises.readFile),
readlink: jest.fn(originalModule.promises.readlink),
},
}
})
function resetFileIOMocks() {
analyze.mockClear()
stat.mockClear()
readFile.mockClear()
readlink.mockClear()
}
afterEach(resetFileIOMocks)
for (const { testName, isRoot } of unitTests) {
const testSuffix = `${testName} from ${isRoot ? 'root' : 'cwd'}`
const nodeVersion = parseInt(process.versions.node.split('.')[0], 10)
if (
process.platform === 'win32' &&
(isRoot || skipOnWindows.includes(testName))
) {
console.log(`Skipping unit test on Windows: ${testSuffix}`)
continue
}
if (process.platform === 'darwin' && skipOnMac.includes(testName)) {
console.log(`Skipping unit test on macOS: ${testSuffix}`)
continue
}
if (nodeVersion < 22 && skipOnNode20AndBelow.includes(testName)) {
console.log(`Skipping unit test on Node.js 20 or below: ${testSuffix}`)
continue
}
if (nodeVersion >= 22 && skipOnNode22AndAbove.includes(testName)) {
console.log(`Skipping unit test on Node.js 22 or above: ${testSuffix}`)
continue
}
const unitPath = join(__dirname, 'unit', testName)
it(`should correctly trace ${testSuffix}`, async () => {
// We mock readFile because when node-file-trace is integrated into @now/node
// this is the hook that triggers TypeScript compilation. So if this doesn't
// get called, the TypeScript files won't get compiled: Currently this is only
// used in the tsx-input test:
const readFileMock = jest.fn(function () {
const [id] = arguments
if (id.startsWith('custom-resolution-')) {
return ''
}
// ensure sync readFile works as expected since default is
// async now
if (testName === 'wildcard') {
try {
return fs.readFileSync(id).toString()
} catch (err) {
return null
}
}
return this.constructor.prototype.readFile.apply(this, arguments)
})
const nftCache = {}
const doTrace = async (cached = false) => {
let inputFileNames = ['input.js']
let outputFileName = 'output.js'
if (testName === 'jsx-input') {
inputFileNames = ['input.jsx']
}
if (testName === 'tsx-input') {
inputFileNames = ['input.tsx']
}
if (testName === 'ts-input-esm') {
inputFileNames = ['input.ts']
}
if (testName === 'processed-dependency' && cached) {
inputFileNames = ['input-cached.js']
outputFileName = 'output-cached.js'
}
if (testName === 'multi-input') {
inputFileNames.push('input-2.js', 'input-3.js', 'input-4.js')
}
// Type: { conditions?: string[] }
let testOpts = {}
try {
testOpts = JSON.parse(
fs.readFileSync(join(unitPath, 'test-opts.json')).toString()
)
} catch {
// Ignore.
}
const { fileList, reasons } = await nodeFileTrace(
inputFileNames.map((file) => join(unitPath, file)),
{
conditions: testOpts.conditions,
base: isRoot ? '/' : `${__dirname}/../`,
processCwd: unitPath,
paths: {
dep: `${__dirname}/../test/unit/esm-paths/esm-dep.js`,
'dep/': `${__dirname}/../test/unit/esm-paths-trailer/`,
},
cache: nftCache,
exportsOnly: testName.startsWith('exports-only'),
ts: true,
log: true,
// disable analysis for basic-analysis unit tests
analysis: !testName.startsWith('basic-analysis'),
mixedModules: true,
// Ignore unit test output "actual.js", and ignore GitHub Actions preinstalled packages
ignore: (str) =>
str.endsWith('/actual.js') || str.startsWith('usr/local'),
readFile: readFileMock,
resolve: testName.startsWith('resolve-hook')
? (id, parent) => `custom-resolution-${id}`
: undefined,
}
)
const normalizeFilesRoot = (f) =>
(isRoot ? relative(join('./', __dirname, '..'), f) : f).replace(
/\\/g,
'/'
)
const normalizeInputRoot = (f) =>
isRoot ? join('./', unitPath, f) : join('test/unit', testName, f)
const getReasonType = (f) => reasons.get(normalizeInputRoot(f)).type
if (testName === 'multi-input') {
const collectFiles = (parent, files = new Set()) => {
fileList.forEach((file) => {
if (files.has(file)) return
const reason = reasons.get(file)
if (reason.parents && reason.parents.has(parent)) {
files.add(file)
collectFiles(file, files)
}
})
return files
}
expect(
[...collectFiles(normalizeInputRoot('input.js'))]
.map(normalizeFilesRoot)
.sort()
).toEqual([
'package.json',
'test/unit/multi-input/asset-2.txt',
'test/unit/multi-input/asset.txt',
'test/unit/multi-input/child-1.js',
'test/unit/multi-input/child-2.js',
'test/unit/multi-input/input-2.js',
])
expect(
[...collectFiles(normalizeInputRoot('input-2.js'))]
.map(normalizeFilesRoot)
.sort()
).toEqual([
'package.json',
'test/unit/multi-input/asset-2.txt',
'test/unit/multi-input/asset.txt',
'test/unit/multi-input/child-1.js',
'test/unit/multi-input/child-2.js',
'test/unit/multi-input/input-2.js',
])
expect(
[...collectFiles(normalizeInputRoot('input-3.js'))]
.map(normalizeFilesRoot)
.sort()
).toEqual([
'package.json',
'test/unit/multi-input/asset.txt',
'test/unit/multi-input/child-3.js',
])
expect(
[...collectFiles(normalizeInputRoot('input-4.js'))]
.map(normalizeFilesRoot)
.sort()
).toEqual([
'package.json',
'test/unit/multi-input/child-4.js',
'test/unit/multi-input/style.module.css',
])
expect(getReasonType('input.js')).toEqual(['initial', 'dependency'])
expect(getReasonType('input-2.js')).toEqual(['initial', 'dependency'])
expect(getReasonType('input-3.js')).toEqual(['initial', 'dependency'])
expect(getReasonType('input-4.js')).toEqual(['initial', 'dependency'])
expect(getReasonType('child-1.js')).toEqual(['dependency'])
expect(getReasonType('child-2.js')).toEqual(['dependency'])
expect(getReasonType('child-3.js')).toEqual(['dependency'])
expect(getReasonType('child-4.js')).toEqual(['dependency'])
expect(getReasonType('asset.txt')).toEqual(['asset'])
expect(getReasonType('asset-2.txt')).toEqual(['asset'])
expect(getReasonType('style.module.css')).toEqual([
'dependency',
'asset',
])
}
let sortedFileList = [...fileList].sort()
if (nodeGypTests.includes(testName)) {
let foundMatchingBinary = false
sortedFileList = sortedFileList.filter((file) => {
if (file.includes('prebuilds') && file.endsWith('.node')) {
// remove from fileList for expected checking
// as it will differ per platform
foundMatchingBinary = true
fileList.delete(file)
return false
}
return true
})
expect(foundMatchingBinary).toBe(true)
}
let expected
try {
expected = JSON.parse(
fs.readFileSync(join(unitPath, outputFileName)).toString()
)
if (process.platform === 'win32') {
// When using Windows, the expected output should use backslash
expected = expected.map((str) => str.replace(/\//g, '\\'))
}
if (isRoot) {
// We set `base: "/"` but we can't hardcode an absolute path because
// CI will look different than a local machine so we fix the path here.
expected = expected.map((str) => join(__dirname, '..', str).slice(1))
}
} catch (e) {
console.warn(e)
expected = []
}
try {
expect(sortedFileList).toEqual(expected)
} catch (e) {
console.warn(reasons)
fs.writeFileSync(
join(unitPath, 'actual.js'),
JSON.stringify(sortedFileList, null, 2)
)
throw e
}
if (cached) {
// Everything should be cached in the second run, except for `processed-dependency` which adds 1 new input file
expect(stat).toHaveBeenCalledTimes(0)
expect(readlink).toHaveBeenCalledTimes(
testName === 'processed-dependency' ? 1 : 0
)
expect(readFile).toHaveBeenCalledTimes(
testName === 'processed-dependency' ? 1 : 0
)
expect(analyze).toHaveBeenCalledTimes(
testName === 'processed-dependency' ? 1 : 0
)
} else {
// Ensure all cached calls are only called once per file. The expected count is the count of calls unique per path
const uniqueStatCalls = new Set(stat.mock.calls.map((call) => call[0]))
const uniqueReadlinkCalls = new Set(
readlink.mock.calls.map((call) => call[0])
)
const uniqueReadFileCalls = new Set(
readFile.mock.calls.map((call) => call[0])
)
const uniqueAnalyzeFileCalls = new Set(
analyze.mock.calls.map((call) => call[0])
)
expect(stat).toHaveBeenCalledTimes(uniqueStatCalls.size)
expect(readlink).toHaveBeenCalledTimes(uniqueReadlinkCalls.size)
expect(readFile).toHaveBeenCalledTimes(uniqueReadFileCalls.size)
expect(analyze).toHaveBeenCalledTimes(uniqueAnalyzeFileCalls.size)
}
resetFileIOMocks()
}
await doTrace()
// test tracing again with a populated nftTrace
expect(nftCache.fileCache).toBeDefined()
expect(nftCache.statCache).toBeDefined()
expect(nftCache.symlinkCache).toBeDefined()
expect(nftCache.analysisCache).toBeDefined()
try {
await doTrace(true)
} catch (err) {
console.error(`Failed for cached run`)
throw err
}
if (testName === 'tsx-input') {
expect(readFileMock.mock.calls.length).toBe(2)
}
})
}
#![allow(clippy::items_after_test_module)]
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
mod helpers;
use std::{path::PathBuf, sync::LazyLock};
use anyhow::Result;
use difference::Changeset;
use regex::Regex;
use rstest::*;
use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{FxIndexSet, ResolvedVc, TryJoinIterExt, TurboTasks, Vc};
use turbo_tasks_backend::TurboTasksBackend;
use turbo_tasks_fs::{DiskFileSystem, FileSystem};
use turbopack::{
ModuleAssetContext,
module_options::{CssOptionsContext, EcmascriptOptionsContext, ModuleOptionsContext},
};
use turbopack_core::{
chunk::ChunkingType,
compile_time_info::CompileTimeInfo,
context::AssetContext,
environment::{BrowserEnvironment, Environment, ExecutionEnvironment, NodeJsEnvironment},
file_source::FileSource,
ident::Layer,
module::Module,
output::OutputAsset,
reference::{all_assets_from_entries, primary_chunkable_referenced_modules},
reference_type::ReferenceType,
traced_asset::TracedAsset,
};
use turbopack_resolve::resolve_options_context::ResolveOptionsContext;
use crate::helpers::print_changeset;
#[global_allocator]
static ALLOC: turbo_tasks_malloc::TurboMalloc = turbo_tasks_malloc::TurboMalloc;
// TODO fix failures
#[rstest]
#[case::amd_disable("amd-disable")]
// #[case::array_emission("array-emission")]
#[case::array_holes("array-holes")]
// #[case::asset_conditional("asset-conditional")]
#[case::asset_fs_array_expr("asset-fs-array-expr")]
#[case::asset_fs_array_expr_node_prefix("asset-fs-array-expr-node-prefix")]
// #[case::asset_fs_extra("asset-fs-extra")]
#[case::asset_fs_inline_path_babel("asset-fs-inline-path-babel")]
#[case::asset_fs_inline_path_enc_es("asset-fs-inline-path-enc-es")]
#[case::asset_fs_inline_path_enc_es_2("asset-fs-inline-path-enc-es-2")]
#[case::asset_fs_inline_path_enc_es_3("asset-fs-inline-path-enc-es-3")]
#[case::asset_fs_inline_path_enc_es_4("asset-fs-inline-path-enc-es-4")]
#[case::asset_fs_inline_path_enc_es_5("asset-fs-inline-path-enc-es-5")]
#[case::asset_fs_inline_path_enc_es_node_prefix("asset-fs-inline-path-enc-es-node-prefix")]
#[case::asset_fs_inline_path_shadow("asset-fs-inline-path-shadow")]
// #[case::asset_fs_inline_path_ts("asset-fs-inline-path-ts")]
#[case::asset_fs_inline_path_ts_no_interop("asset-fs-inline-path-ts-no-interop")]
#[case::asset_fs_inline_tpl("asset-fs-inline-tpl")]
#[case::asset_fs_inlining("asset-fs-inlining")]
#[case::asset_fs_inlining_multi("asset-fs-inlining-multi")]
#[case::asset_fs_logical("asset-fs-logical")]
// #[case::asset_graceful_fs("asset-graceful-fs")]
// #[case::asset_node_require("asset-node-require")]
#[case::asset_package_json("asset-package-json")]
// #[case::asset_symlink("asset-symlink")]
// #[case::basic_analysis_require("basic-analysis-require")]
// #[case::browser_remappings("browser-remappings")]
// #[case::browser_remappings_disabled("browser-remappings-disabled")]
// #[case::browser_remappings_false("browser-remappings-false")]
// #[case::browser_remappings_malformed("browser-remappings-malformed")]
// #[case::browser_remappings_malformed2("browser-remappings-malformed2")]
// #[case::browser_remappings_string("browser-remappings-string")]
// #[case::browser_remappings_undefined("browser-remappings-undefined")]
// #[case::browserify("browserify")]
// #[case::browserify_minify("browserify-minify")]
// #[case::browserify_uglify("browserify-uglify")]
#[case::class_static("class-static")]
// #[case::datadog_pprof_node_gyp("datadog-pprof-node-gyp")]
// #[case::dirname_emit("dirname-emit")]
// #[case::dirname_emit_concat("dirname-emit-concat")]
#[case::dirname_len("dirname-len")]
// #[case::dot_dot("dot-dot")]
// #[case::esm_dynamic_import("esm-dynamic-import")]
// #[case::esm_export_wildcard("esm-export-wildcard")]
// #[case::esm_paths("esm-paths")]
// #[case::esm_paths_trailer("esm-paths-trailer")]
// #[case::exports("exports")]
// #[case::exports_fallback("exports-fallback")]
// #[case::exports_nomodule("exports-nomodule")]
// #[case::exports_only("exports-only")]
// #[case::exports_path("exports-path")]
// #[case::exports_wildcard("exports-wildcard")]
// #[case::ffmpeg_installer("ffmpeg-installer")]
// #[case::file_folder_slash("file-folder-slash")]
// #[case::filter_asset_base("filter-asset-base")]
// #[case::fs_emission("fs-emission")]
// #[case::glob_dot("glob-dot")]
// #[case::import_assertions("import-assertions")]
// #[case::import_attributes("import-attributes")]
// #[case::import_meta_bad_url("import-meta-bad-url")]
// #[case::import_meta_tpl_cnd("import-meta-tpl-cnd")]
#[case::import_meta_url("import-meta-url")]
// #[case::imports("imports")]
// #[case::jsonc_parser_wrapper("jsonc-parser-wrapper")]
// #[case::jsx_input("jsx-input")]
// #[case::microtime_node_gyp("microtime-node-gyp")]
// #[case::mixed_esm_cjs("mixed-esm-cjs")]
// #[case::module_create_require("module-create-require")]
// #[case::module_register("module-register")]
// #[case::module_require("module-require")]
// #[case::module_sync_condition_cjs("module-sync-condition-cjs")]
// #[case::module_sync_condition_es("module-sync-condition-es")]
// #[case::module_sync_condition_es_node20("module-sync-condition-es-node20")]
// #[case::mongoose("mongoose")]
// #[case::multi_input("multi-input")]
#[case::node_modules_filter("node-modules-filter")]
// #[case::non_analyzable_requires("non-analyzable-requires")]
#[case::null_destructure("null-destructure")]
// #[case::path_sep("path-sep")]
// #[case::phantomjs_prebuilt("phantomjs-prebuilt")]
// #[case::pixelmatch("pixelmatch")]
// #[case::pkginfo("pkginfo")]
// #[case::pnpm_symlinks("pnpm-symlinks")]
// #[case::prisma_photon("prisma-photon")]
// #[case::process_cwd("process-cwd")]
// #[case::process_env("process-env")]
// #[case::processed_dependency("processed-dependency")]
#[case::protobuf_loop("protobuf-loop")]
#[case::protobuf_loop2("protobuf-loop2")]
#[case::require_call("require-call")]
// #[case::require_dirname_tpl("require-dirname-tpl")]
// #[case::require_dot("require-dot")]
// #[case::require_dynamic_fallback("require-dynamic-fallback")]
#[case::require_empty("require-empty")]
// #[case::require_resolve("require-resolve")]
// #[case::require_symlink("require-symlink")]
// #[case::require_var_branch("require-var-branch")]
// #[case::require_wrapper("require-wrapper")]
// #[case::require_wrapper2("require-wrapper2")]
// #[case::require_wrapper3("require-wrapper3")]
// #[case::resolve_from("resolve-from")]
// #[case::resolve_hook("resolve-hook")]
// #[case::return_emission("return-emission")]
// #[case::shiki("shiki")]
// #[case::string_concat("string-concat")]
#[case::syntax_err("syntax-err")]
// #[case::top_level_await("top-level-await")]
// #[case::ts_filter("ts-filter")]
// #[case::ts_input_esm("ts-input-esm")]
#[case::ts_path_join("ts-path-join")]
// #[case::tsx("tsx")]
// #[case::tsx_input("tsx-input")]
#[case::url_error("url-error")]
// #[case::webpack_5_wrapper_namespace("webpack-5-wrapper-namespace")]
// #[case::webpack_node("webpack-node")]
// #[case::webpack_wrapper("webpack-wrapper")]
// #[case::webpack_wrapper_dirname_inject("webpack-wrapper-dirname-inject")]
// #[case::webpack_wrapper_multi("webpack-wrapper-multi")]
// #[case::webpack_wrapper_name("webpack-wrapper-name")]
// #[case::webpack_wrapper_null("webpack-wrapper-null")]
// #[case::webpack_wrapper_strs_namespaces("webpack-wrapper-strs-namespaces")]
// #[case::webpack_wrapper_strs_namespaces_large("webpack-wrapper-strs-namespaces-large")]
// #[case::when_wrapper("when-wrapper")]
#[case::wildcard("wildcard")]
// #[case::wildcard_require("wildcard-require")]
// #[case::wildcard2("wildcard2")]
// #[case::wildcard3("wildcard3")]
// #[case::yarn_workspace_esm("yarn-workspace-esm")]
// #[case::yarn_workspaces("yarn-workspaces")]
// #[case::zeromq_node_gyp("zeromq-node-gyp")]
fn unit_test(#[case] input: &str) -> Result<()> {
node_file_trace(input)
}
#[turbo_tasks::function(operation)]
async fn node_file_trace_operation(package_root: RcStr, input: RcStr) -> Result<Vc<Vec<RcStr>>> {
let workspace_fs: Vc<Box<dyn FileSystem>> = Vc::upcast(DiskFileSystem::new(
rcstr!("workspace"),
package_root.clone(),
));
let input_dir = workspace_fs.root().owned().await?;
let input = input_dir.join(&input)?;
let source = FileSource::new(input);
let environment = Environment::new(
ExecutionEnvironment::NodeJsLambda(NodeJsEnvironment::default().resolved_cell()),
BrowserEnvironment::default().cell(),
);
let module_asset_context = ModuleAssetContext::new(
Default::default(),
// TODO These test cases should move into the `node-file-trace` crate and use the same
// config.
// It's easy to make a mistake here as this should match the config in the binary from
// turbopack/crates/turbopack/src/lib.rs
CompileTimeInfo::new(environment),
ModuleOptionsContext {
ecmascript: EcmascriptOptionsContext {
..Default::default()
},
css: CssOptionsContext {
enable_raw_css: true,
..Default::default()
},
// Environment is not passed in order to avoid downleveling JS / CSS for
// node-file-trace.
environment: None,
is_tracing: true,
..Default::default()
}
.cell(),
ResolveOptionsContext {
enable_node_native_modules: true,
enable_node_modules: Some(input_dir.clone()),
custom_conditions: vec![rcstr!("node")],
..Default::default()
}
.cell(),
Layer::new(rcstr!("test")),
);
let module = module_asset_context
.process(Vc::upcast(source), ReferenceType::Undefined)
.module();
// We treat the entry as bundled code, so start with the references.
let assets = primary_chunkable_referenced_modules(module, true)
.await?
.iter()
.flat_map(|(ty, _, modules)| {
if *ty == ChunkingType::Traced {
Some(modules.into_iter())
} else {
None
}
})
.flatten()
.map(async |m| {
Ok(ResolvedVc::upcast(
TracedAsset::new(**m).to_resolved().await?,
))
})
.try_join()
.await?;
let mut paths = to_list(assets).await?;
paths.push(module.ident().path().await?.path.clone());
Ok(Vc::cell(paths))
}
async fn to_list(assets: Vec<ResolvedVc<Box<dyn OutputAsset>>>) -> Result<Vec<RcStr>> {
let mut assets = all_assets_from_entries(Vc::cell(assets))
.await?
.iter()
.map(async |a| Ok(a.path().await?.path.clone()))
.try_join()
.await?;
assets.sort();
assets.dedup();
Ok(assets)
}
static TRAILING_COMMA: LazyLock<Regex> = LazyLock::new(|| Regex::new(r",[\s\n]*\]").unwrap());
fn node_file_trace(input_path: &str) -> Result<()> {
let r = &mut {
let mut builder = tokio::runtime::Builder::new_multi_thread();
builder.enable_all();
builder.max_blocking_threads(20);
builder.build().unwrap()
};
let package_root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let package_root = package_root.join("tests/node-file-trace");
let input: RcStr = format!("test/unit/{input_path}/input.js").into();
let reference = package_root.join(format!("test/unit/{input_path}/output.js"));
r.block_on(async move {
let future = async move {
let op =
node_file_trace_operation(package_root.to_string_lossy().into(), input.clone());
let list = op
.read_strongly_consistent()
.await?
.into_iter()
.map(|s| s.to_string())
.collect::<FxIndexSet<_>>();
// println!(
// "issues: {:#?}",
// op.peek_issues_with_path().await?.get_plain_issues().await?
// );
let reference = std::fs::read_to_string(reference)?;
// crude JS -> JSON conversion
let reference = TRAILING_COMMA
.replace(&reference, "]")
.replace(";", "")
.replace('\'', "\"");
let reference = serde_json::from_str::<Vec<String>>(&reference)?
.into_iter()
.filter(|m| m != "package.json")
.collect::<FxIndexSet<_>>();
if reference == list {
anyhow::Ok(())
} else {
let reference = reference.into_iter().collect::<Vec<_>>().join("\n");
let list = list.into_iter().collect::<Vec<_>>().join("\n");
println!(
"{}",
print_changeset(&Changeset::new(reference.trim(), list.trim(), "\n"))
);
anyhow::bail!("file trace does not match reference");
}
};
let tt = TurboTasks::new(TurboTasksBackend::new(
turbo_tasks_backend::BackendOptions::default(),
turbo_tasks_backend::noop_backing_storage(),
));
tt.run_once(future).await?;
std::mem::forget(tt);
anyhow::Ok(())
})
}
......@@ -6,12 +6,8 @@ license = "MIT"
edition = "2024"
autobenches = false
[lib]
bench = false
[features]
test_persistent_cache = []
bench_against_node_nft = []
[lints]
workspace = true
......@@ -45,15 +41,4 @@ turbopack-static = { workspace = true }
turbopack-wasm = { workspace = true }
[dev-dependencies]
criterion = { workspace = true, features = ["async_tokio"] }
difference = "2.0"
rstest = { workspace = true }
rstest_reuse = "0.5.0"
tokio = { workspace = true }
turbo-tasks-malloc = { workspace = true, default-features = false }
turbo-tasks-backend = { workspace = true }
[[bench]]
name = "mod"
harness = false
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment