├── test ├── unit │ ├── tsx │ │ ├── lib.ts │ │ ├── lib.tsx │ │ ├── dep.tsx │ │ ├── input.js │ │ └── output.js │ ├── dirname-emit │ │ ├── asset.txt │ │ ├── subdir │ │ │ └── file.txt │ │ ├── input.js │ │ └── output.js │ ├── fs-emission │ │ ├── asset1.txt │ │ ├── asset2.txt │ │ ├── asset3.txt │ │ ├── output.js │ │ └── input.js │ ├── import-assertions │ │ ├── foo.js │ │ ├── info.json │ │ ├── input.js │ │ └── output.js │ ├── import-attributes │ │ ├── foo.js │ │ ├── info.json │ │ ├── input.js │ │ └── output.js │ ├── path-sep │ │ ├── asset.txt │ │ ├── output.js │ │ └── input.js │ ├── asset-graceful-fs │ │ ├── sub │ │ │ └── asset.txt │ │ ├── asset.txt │ │ ├── input.js │ │ └── output.js │ ├── asset-node-require │ │ ├── mock.node │ │ ├── input.js │ │ └── output.js │ ├── class-static │ │ ├── asset.txt │ │ ├── output.js │ │ └── input.js │ ├── multi-input │ │ ├── asset.txt │ │ ├── asset-2.txt │ │ ├── style.module.css │ │ ├── input-3.js │ │ ├── input.js │ │ ├── input-2.js │ │ ├── input-4.js │ │ ├── child-3.js │ │ ├── child-4.js │ │ ├── child-1.js │ │ ├── child-2.js │ │ └── output.js │ ├── require-symlink │ │ ├── symlink │ │ ├── input.js │ │ ├── another.js │ │ └── output.js │ ├── ts-path-join │ │ ├── file.txt │ │ ├── output.js │ │ └── input.js │ ├── webpack-wrapper │ │ ├── asset.txt │ │ ├── output.js │ │ └── input.js │ ├── asset-fs-extra │ │ ├── asset1.txt │ │ ├── asset2.json │ │ └── input.js │ ├── asset-fs-inlining-multi │ │ ├── sub │ │ │ └── asset.txt │ │ ├── asset.txt │ │ ├── input.js │ │ └── output.js │ ├── asset-fs-inlining │ │ ├── asset.txt │ │ ├── input.js │ │ └── output.js │ ├── asset-fs-logical │ │ ├── asset1.txt │ │ ├── asset2.txt │ │ ├── input.js │ │ └── output.js │ ├── asset-symlink │ │ ├── asset.txt │ │ ├── asset1.txt │ │ ├── input.js │ │ └── output.js │ ├── glob-dot │ │ ├── with-dot │ │ │ └── .dot │ │ │ │ └── first.txt │ │ ├── without-dot │ │ │ └── normal │ │ │ │ └── first.txt │ │ ├── output.js │ │ └── input.js │ ├── import-meta-url │ │ ├── asset.txt │ │ ├── input.js │ │ └── output.js │ ├── imports │ │ ├── no.js │ │ ├── node.js │ │ ├── input.js │ │ ├── output.js │ │ └── package.json │ ├── process-cwd │ │ ├── _posts │ │ │ ├── first.md │ │ │ └── second.md │ │ ├── output.js │ │ └── input.js │ ├── process-env │ │ ├── a.js │ │ ├── b.js │ │ ├── input.js │ │ └── output.js │ ├── require-dot │ │ ├── input.js │ │ ├── index.js │ │ └── output.js │ ├── require-resolve │ │ ├── asset1.txt │ │ ├── asset2.txt │ │ ├── asset3.txt │ │ ├── dep2.js │ │ ├── dep1.js │ │ ├── output.js │ │ └── input.js │ ├── return-emission │ │ ├── asset.txt │ │ ├── input.js │ │ └── output.js │ ├── webpack-wrapper-multi │ │ ├── asset.txt │ │ └── output.js │ ├── wildcard │ │ ├── assets │ │ │ ├── asset1.txt │ │ │ ├── asset2.txt │ │ │ └── asset3.txt │ │ ├── input.js │ │ └── output.js │ ├── wildcard2 │ │ ├── assets │ │ │ ├── asset1.txt │ │ │ ├── asset2.txt │ │ │ └── asset3.txt │ │ ├── input.js │ │ └── output.js │ ├── wildcard3 │ │ ├── assets │ │ │ ├── asset1.txt │ │ │ ├── asset2.txt │ │ │ └── asset3.txt │ │ ├── input.js │ │ └── output.js │ ├── array-emission │ │ ├── renderer │ │ │ ├── dom.js │ │ │ └── util.js │ │ ├── output.js │ │ └── input.js │ ├── array-holes │ │ ├── input.js │ │ └── output.js │ ├── asset-conditional │ │ ├── asset1.txt │ │ ├── asset2.txt │ │ ├── input.js │ │ └── output.js │ ├── asset-fs-array-expr │ │ ├── asset1.txt │ │ ├── output.js │ │ └── input.js │ ├── asset-fs-inline-tpl │ │ ├── asset.txt │ │ ├── input.js │ │ └── output.js │ ├── browserify │ │ ├── dep1.js │ │ ├── dep2.js │ │ ├── output.js │ │ └── input.js │ ├── dirname-emit-concat │ │ ├── assets │ │ │ └── file.txt │ │ ├── input.js │ │ └── output.js │ ├── esm │ │ ├── esm-dep.js │ │ ├── input.js │ │ └── output.js │ ├── exports │ │ ├── input.js │ │ ├── node_modules │ │ │ └── pkg │ │ │ │ ├── index.js │ │ │ │ ├── subdir │ │ │ │ ├── package.json │ │ │ │ └── import-main.js │ │ │ │ ├── require-main.cjs │ │ │ │ └── package.json │ │ └── output.js │ ├── import-meta-bad-url │ │ ├── asset1.txt │ │ ├── asset2.txt │ │ ├── output.js │ │ └── input.js │ ├── import-meta-tpl-cnd │ │ ├── asset1.txt │ │ ├── asset2.txt │ │ ├── output.js │ │ └── input.js │ ├── protobuf-loop │ │ ├── assets │ │ │ ├── asset1.txt │ │ │ └── asset2.txt │ │ ├── output.js │ │ └── input.js │ ├── protobuf-loop2 │ │ ├── assets │ │ │ ├── asset1.txt │ │ │ └── asset2.txt │ │ ├── output.js │ │ └── input.js │ ├── require-call │ │ ├── input.js │ │ └── output.js │ ├── tsx-input │ │ ├── dep.tsx │ │ ├── input.tsx │ │ └── output.js │ ├── yarn-workspaces │ │ ├── input.js │ │ ├── node_modules │ │ │ └── x │ │ ├── packages │ │ │ └── x │ │ │ │ ├── dep.js │ │ │ │ ├── main.ts │ │ │ │ └── package.json │ │ ├── .gitignore │ │ └── output.js │ ├── asset-fs-inline-path-babel │ │ ├── asset.txt │ │ ├── output.js │ │ └── input.js │ ├── asset-fs-inline-path-enc-es │ │ ├── asset.txt │ │ ├── input.js │ │ └── output.js │ ├── asset-fs-inline-path-shadow │ │ ├── asset.txt │ │ ├── output.js │ │ └── input.js │ ├── asset-fs-inline-path-ts │ │ ├── asset.txt │ │ ├── output.js │ │ └── input.js │ ├── dot-dot │ │ ├── index.js │ │ ├── input.js │ │ ├── dir │ │ │ └── dot-dot-req.js │ │ └── output.js │ ├── esm-paths │ │ ├── esm-dep.js │ │ ├── input.js │ │ └── output.js │ ├── exports-fallback │ │ ├── input.js │ │ ├── node_modules │ │ │ └── pkg │ │ │ │ ├── subdir │ │ │ │ ├── package.json │ │ │ │ └── import-main.js │ │ │ │ ├── index.js │ │ │ │ ├── require-main.cjs │ │ │ │ └── package.json │ │ └── output.js │ ├── exports-nomodule │ │ ├── no.js │ │ ├── node.js │ │ ├── input.js │ │ ├── output.js │ │ └── package.json │ ├── exports-only │ │ ├── input.js │ │ ├── node_modules │ │ │ └── pkg │ │ │ │ ├── index.js │ │ │ │ ├── subdir │ │ │ │ ├── package.json │ │ │ │ └── import-main.js │ │ │ │ ├── require-main.cjs │ │ │ │ └── package.json │ │ └── output.js │ ├── exports-wildcard │ │ ├── no.js │ │ ├── node.js │ │ ├── input.js │ │ ├── output.js │ │ └── package.json │ ├── ffmpeg-installer │ │ ├── ffmpeg.exe │ │ ├── input.js │ │ ├── output.js │ │ └── ffmpeg.js │ ├── jsx-input │ │ ├── dep.jsx │ │ ├── output.js │ │ └── input.jsx │ ├── module-register │ │ ├── hook.mjs │ │ ├── hook2.mjs │ │ ├── hook3.mjs │ │ ├── node_modules │ │ │ └── test-pkg │ │ │ │ ├── index.mjs │ │ │ │ └── package.json │ │ ├── input-esm.mjs │ │ ├── input.js │ │ └── output.js │ ├── resolve-from │ │ ├── dep.js │ │ ├── input.js │ │ └── output.js │ ├── resolve-hook │ │ ├── dep.js │ │ ├── input.js │ │ └── output.js │ ├── when-wrapper │ │ ├── dep.js │ │ ├── output.js │ │ └── input.js │ ├── asset-fs-array-expr-node-prefix │ │ ├── asset1.txt │ │ ├── output.js │ │ └── input.js │ ├── asset-fs-inline-path-enc-es-2 │ │ ├── asset.txt │ │ ├── input.js │ │ └── output.js │ ├── asset-fs-inline-path-enc-es-3 │ │ ├── asset.txt │ │ ├── input.js │ │ └── output.js │ ├── asset-fs-inline-path-enc-es-4 │ │ ├── asset.txt │ │ ├── output.js │ │ └── input.js │ ├── asset-fs-inline-path-enc-es-5 │ │ ├── asset.txt │ │ ├── input.js │ │ └── output.js │ ├── basic-analysis-require │ │ ├── input.js │ │ ├── dep.js │ │ └── output.js │ ├── browser-remappings │ │ ├── input.js │ │ ├── node_modules │ │ │ └── pkg │ │ │ │ ├── subdir │ │ │ │ ├── package.json │ │ │ │ ├── import-main.js │ │ │ │ └── import-main-browser.js │ │ │ │ ├── index.js │ │ │ │ ├── require-main.cjs │ │ │ │ └── package.json │ │ ├── test-opts.json │ │ ├── .gitignore │ │ └── output.js │ ├── browserify-uglify │ │ ├── dep1.js │ │ ├── dep2.js │ │ ├── output.js │ │ └── input.js │ ├── esm-dynamic-import │ │ ├── dep.js │ │ ├── package.json │ │ ├── input.js │ │ └── output.js │ ├── esm-export-wildcard │ │ ├── all.js │ │ ├── input.js │ │ ├── week.js │ │ └── output.js │ ├── module-require │ │ ├── dep.js │ │ ├── output.js │ │ └── input.js │ ├── processed-dependency │ │ ├── parent-1.js │ │ ├── parent-2.js │ │ ├── child-2.js │ │ ├── input-cached.js │ │ ├── child.js │ │ ├── input.js │ │ ├── output-cached.js │ │ └── output.js │ ├── require-wrapper │ │ ├── dep.js │ │ ├── output.js │ │ └── input.js │ ├── require-wrapper2 │ │ ├── dep.js │ │ ├── output.js │ │ └── input.js │ ├── require-wrapper3 │ │ ├── dep.js │ │ ├── output.js │ │ └── input.js │ ├── string-concat │ │ ├── lib │ │ │ └── dep.js │ │ ├── input.js │ │ └── output.js │ ├── top-level-await │ │ ├── module.js │ │ ├── input.js │ │ └── output.js │ ├── ts-input-esm │ │ ├── dep2.ts │ │ ├── input.ts │ │ ├── package.json │ │ ├── dep1.ts │ │ ├── output.js │ │ └── tsconfig.json │ ├── webpack-wrapper-dirname-inject │ │ ├── schema.prisma │ │ └── output.js │ ├── webpack-wrapper-name │ │ ├── input.js │ │ └── output.js │ ├── webpack-wrapper-null │ │ ├── input.js │ │ └── output.js │ ├── asset-fs-inline-path-ts-no-interop │ │ ├── asset.txt │ │ ├── output.js │ │ └── input.js │ ├── browser-remappings-false │ │ ├── input.js │ │ ├── test-opts.json │ │ ├── .gitignore │ │ ├── node_modules │ │ │ └── pkg │ │ │ │ ├── browser.js │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ └── output.js │ ├── esm-paths-trailer │ │ ├── esm-dep.js │ │ ├── input.js │ │ └── output.js │ ├── jsonc-parser-wrapper │ │ ├── dep.js │ │ ├── output.js │ │ └── input.js │ ├── node-modules-filter │ │ ├── sub │ │ │ └── node_modules │ │ │ │ └── pkg │ │ │ │ └── noemit │ │ ├── output.js │ │ └── input.js │ ├── non-analyzable-requires │ │ ├── dep.js │ │ ├── ignored.js │ │ ├── output.js │ │ └── input.js │ ├── prisma-photon │ │ ├── input.js │ │ ├── node_modules │ │ │ └── @generated │ │ │ │ └── photon │ │ │ │ ├── index.js │ │ │ │ └── runtime │ │ │ │ └── query-engine-darwin │ │ └── output.js │ ├── require-dirname-tpl │ │ ├── dep.js │ │ ├── input.js │ │ └── output.js │ ├── ts-filter │ │ ├── node_modules │ │ │ └── pkg │ │ │ │ ├── index.ts │ │ │ │ ├── index.js │ │ │ │ └── dep.js │ │ ├── output.js │ │ └── input.js │ ├── webpack-node │ │ ├── level1 │ │ │ ├── a.b.js │ │ │ ├── c.d.js │ │ │ └── level2 │ │ │ │ └── level3 │ │ │ │ └── page.js │ │ ├── input.js │ │ └── output.js │ ├── asset-fs-inline-path-enc-es-node-prefix │ │ ├── asset.txt │ │ ├── input.js │ │ └── output.js │ ├── asset-package-json │ │ ├── package.json │ │ ├── output.js │ │ └── input.js │ ├── browser-remappings-disabled │ │ ├── input.js │ │ ├── test-opts.json │ │ ├── node_modules │ │ │ └── pkg │ │ │ │ ├── subdir │ │ │ │ ├── package.json │ │ │ │ ├── import-main.js │ │ │ │ └── import-main-browser.js │ │ │ │ ├── index.js │ │ │ │ ├── require-main.cjs │ │ │ │ └── package.json │ │ ├── .gitignore │ │ └── output.js │ ├── browser-remappings-malformed │ │ ├── input.js │ │ ├── node_modules │ │ │ └── pkg │ │ │ │ ├── subdir │ │ │ │ ├── package.json │ │ │ │ ├── import-main.js │ │ │ │ └── import-main-browser.js │ │ │ │ ├── index.js │ │ │ │ ├── require-main.cjs │ │ │ │ └── package.json │ │ ├── test-opts.json │ │ ├── .gitignore │ │ └── output.js │ ├── browser-remappings-malformed2 │ │ ├── input.js │ │ ├── test-opts.json │ │ ├── node_modules │ │ │ └── pkg │ │ │ │ ├── index.js │ │ │ │ ├── subdir │ │ │ │ ├── package.json │ │ │ │ ├── import-main.js │ │ │ │ └── import-main-browser.js │ │ │ │ ├── require-main.cjs │ │ │ │ └── package.json │ │ ├── .gitignore │ │ └── output.js │ ├── browser-remappings-string │ │ ├── input.js │ │ ├── test-opts.json │ │ ├── node_modules │ │ │ └── pkg │ │ │ │ ├── browser.js │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ ├── .gitignore │ │ └── output.js │ ├── browser-remappings-undefined │ │ ├── input.js │ │ ├── node_modules │ │ │ └── pkg │ │ │ │ ├── subdir │ │ │ │ ├── package.json │ │ │ │ ├── import-main.js │ │ │ │ └── import-main-browser.js │ │ │ │ ├── index.js │ │ │ │ ├── require-main.cjs │ │ │ │ └── package.json │ │ ├── test-opts.json │ │ ├── .gitignore │ │ └── output.js │ ├── file-folder-slash │ │ ├── input.js │ │ ├── file-folder.js │ │ ├── file-folder │ │ │ └── index.js │ │ └── output.js │ ├── module-create-require │ │ ├── lib.node │ │ ├── output.js │ │ └── input.js │ ├── mongoose │ │ ├── dir │ │ │ └── connection.js │ │ ├── input.js │ │ └── output.js │ ├── require-dynamic-fallback │ │ ├── dep.js │ │ ├── input.js │ │ └── output.js │ ├── wildcard-require │ │ ├── modules │ │ │ ├── module1.js │ │ │ ├── module2.js │ │ │ └── module3.js │ │ ├── input.js │ │ └── output.js │ ├── yarn-workspace-esm │ │ ├── node_modules │ │ │ ├── @example │ │ │ │ ├── web │ │ │ │ └── common │ │ │ └── .yarn-integrity │ │ ├── .gitignore │ │ ├── input.js │ │ ├── packages │ │ │ ├── common │ │ │ │ ├── hello.js │ │ │ │ └── package.json │ │ │ └── web │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ ├── yarn.lock │ │ ├── package.json │ │ └── output.js │ ├── mixed-esm-cjs │ │ ├── ecmascript-module.js │ │ ├── commonjs-module.js │ │ ├── input.js │ │ └── output.js │ ├── syntax-err │ │ ├── input.js │ │ └── output.js │ ├── webpack-wrapper-strs-namespaces-large │ │ ├── content │ │ │ ├── packages.json │ │ │ └── guides │ │ │ │ └── index.md │ │ └── output.js │ ├── datadog-pprof-node-gyp │ │ └── input.js │ ├── require-var-branch │ │ ├── lib1 │ │ │ └── createsend.js │ │ ├── lib2 │ │ │ └── createsend.js │ │ ├── input.js │ │ └── output.js │ ├── webpack-5-wrapper-namespace │ │ ├── assets │ │ │ └── dictionary.json │ │ ├── output.js │ │ └── input.js │ ├── pkginfo │ │ ├── input.js │ │ ├── package.json │ │ └── output.js │ ├── webpack-wrapper-strs-namespaces │ │ ├── assets │ │ │ └── dictionary.json │ │ └── output.js │ ├── url-error │ │ ├── input.js │ │ └── output.js │ ├── null-destructure │ │ ├── input.js │ │ └── output.js │ ├── pnpm-symlinks │ │ ├── node_modules │ │ │ ├── .pnpm │ │ │ │ ├── node_modules │ │ │ │ │ └── parse5 │ │ │ │ ├── parse5-htmlparser2-tree-adapter@6.0.1 │ │ │ │ │ └── node_modules │ │ │ │ │ │ ├── parse5 │ │ │ │ │ │ └── parse5-htmlparser2-tree-adapter │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ ├── LICENSE │ │ │ │ │ │ └── README.md │ │ │ │ ├── parse5@6.0.1 │ │ │ │ │ └── node_modules │ │ │ │ │ │ └── parse5 │ │ │ │ │ │ ├── lib │ │ │ │ │ │ ├── utils │ │ │ │ │ │ │ ├── merge-options.js │ │ │ │ │ │ │ └── mixin.js │ │ │ │ │ │ ├── extensions │ │ │ │ │ │ │ ├── error-reporting │ │ │ │ │ │ │ │ ├── tokenizer-mixin.js │ │ │ │ │ │ │ │ ├── preprocessor-mixin.js │ │ │ │ │ │ │ │ ├── mixin-base.js │ │ │ │ │ │ │ │ └── parser-mixin.js │ │ │ │ │ │ │ └── location-info │ │ │ │ │ │ │ │ └── open-element-stack-mixin.js │ │ │ │ │ │ └── index.js │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ └── LICENSE │ │ │ │ └── lock.yaml │ │ │ ├── parse5-htmlparser2-tree-adapter │ │ │ └── .modules.yaml │ │ ├── input.js │ │ ├── package.json │ │ ├── pnpm-lock.yaml │ │ └── output.js │ ├── zeromq-node-gyp │ │ ├── input.js │ │ └── output.js │ ├── amd-disable │ │ ├── output.js │ │ └── input.js │ ├── dirname-len │ │ ├── output.js │ │ └── input.js │ ├── exports-path │ │ ├── node_modules │ │ │ ├── apollo-upload-client │ │ │ │ ├── index.js │ │ │ │ ├── public │ │ │ │ │ └── ReactNativeFile.js │ │ │ │ └── package.json │ │ │ └── extract-files │ │ │ │ ├── public │ │ │ │ └── ReactNativeFile.js │ │ │ │ └── package.json │ │ ├── input.js │ │ └── output.js │ ├── require-empty │ │ ├── output.js │ │ └── input.js │ ├── filter-asset-base │ │ ├── output.js │ │ └── input.js │ ├── microtime-node-gyp │ │ ├── input.js │ │ └── output.js │ ├── pixelmatch │ │ ├── input.js │ │ └── output.js │ ├── phantomjs-prebuilt │ │ ├── input.js │ │ └── output.js │ ├── browserify-minify │ │ ├── output.js │ │ └── input.js │ └── shiki │ │ └── input.js ├── fixtures │ ├── tsconfig.json │ ├── es-module-dep.js │ ├── index.html │ ├── test.ts │ ├── es-module.js │ ├── img.jpg │ └── test.js ├── integration │ ├── camaro.js │ ├── got.js │ ├── loopback.js │ ├── mariadb.js │ ├── oracledb.js │ ├── chromeless.js │ ├── fast-glob.js │ ├── hot-shots.js │ ├── jimp.js │ ├── lighthouse.js │ ├── azure-storage.js │ ├── firebase-admin.js │ ├── path-platform.js │ ├── azure-cosmos.js │ ├── es-get-iterator.js │ ├── express.js │ ├── fetch-h2.js │ ├── ioredis.js │ ├── mailgun.js │ ├── stripe.js │ ├── dogfood.js │ ├── firestore.js │ ├── sentry.js │ ├── bindings-failure.js │ ├── datadog-pprof.js │ ├── paraphrase.js │ ├── tiny-json-http.js │ ├── browserify-middleware.js │ ├── ffmpeg.js │ ├── koa.js │ ├── sparql-builder.js │ ├── aws-sdk.js │ ├── jugglingdb.js │ ├── zeromq.js │ ├── passport-trakt.js │ ├── pg.js │ ├── pug.js │ ├── bugsnag-js.js │ ├── core-js.js │ ├── passport.js │ ├── redis.js │ ├── when.js │ ├── vm2.js │ ├── argon2.js │ ├── saslprep.js │ ├── serialport.js │ ├── env-var.js │ ├── leveldown.js │ ├── memcached.js │ ├── analytics-node.js │ ├── geo-tz.js │ ├── fluent-ffmpeg.js │ ├── geoip-lite.js │ ├── otel-api.js │ ├── pixelmatch.js │ ├── bcrypt.js │ ├── esm.js │ ├── google-bigquery.js │ ├── sequelize.js │ ├── pdfkit.js │ ├── uglify.js │ ├── mysql.js │ ├── twilio.js │ ├── semver.js │ ├── highlights.js │ ├── cowsay.js │ ├── pdf2json.js │ ├── socket.io.js │ ├── remark-prism.mjs │ ├── auth0.js │ ├── sharp.js │ ├── react.js │ ├── sharp-pnpm.js │ ├── vue.js │ ├── axios.js │ ├── rxjs.js │ ├── playwright-core.js │ ├── shiki.js │ ├── esbuild.js │ ├── isomorphic-unfetch.js │ ├── express-template.js │ ├── polyfill-library.js │ ├── mongoose.js │ ├── express-template-engine.js │ ├── request.js │ ├── express-consolidate.js │ ├── apollo.js │ ├── bull.js │ ├── typescript.js │ ├── bullmq.js │ └── firebase.js └── ecmascript │ ├── README.md │ └── update-all-data.mjs ├── release.config.js ├── .gitignore ├── .github ├── CODEOWNERS └── workflows │ └── pr.yml ├── src ├── index.ts └── utils │ ├── types.ts │ ├── interop-require.ts │ ├── sharedlib-emit.ts │ ├── get-package-base.ts │ └── ast-helpers.ts ├── .prettierignore ├── jest.config.js ├── .git-blame-ignore-revs ├── .kodiak.toml ├── tsconfig.json └── LICENSE /test/unit/tsx/lib.ts: -------------------------------------------------------------------------------- 1 | included 2 | -------------------------------------------------------------------------------- /test/fixtures/tsconfig.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/unit/dirname-emit/asset.txt: -------------------------------------------------------------------------------- 1 | asset -------------------------------------------------------------------------------- /test/unit/fs-emission/asset1.txt: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /test/unit/fs-emission/asset2.txt: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /test/unit/fs-emission/asset3.txt: -------------------------------------------------------------------------------- 1 | 3 2 | -------------------------------------------------------------------------------- /test/unit/import-assertions/foo.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/unit/import-attributes/foo.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/unit/path-sep/asset.txt: -------------------------------------------------------------------------------- 1 | asset 2 | -------------------------------------------------------------------------------- /test/unit/tsx/lib.tsx: -------------------------------------------------------------------------------- 1 | not included 2 | -------------------------------------------------------------------------------- /test/integration/camaro.js: -------------------------------------------------------------------------------- 1 | require('camaro') -------------------------------------------------------------------------------- /test/integration/got.js: -------------------------------------------------------------------------------- 1 | require('got'); 2 | -------------------------------------------------------------------------------- /test/unit/asset-graceful-fs/sub/asset.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/unit/asset-node-require/mock.node: -------------------------------------------------------------------------------- 1 | asdf -------------------------------------------------------------------------------- /test/unit/class-static/asset.txt: -------------------------------------------------------------------------------- 1 | asset 2 | -------------------------------------------------------------------------------- /test/unit/dirname-emit/subdir/file.txt: -------------------------------------------------------------------------------- 1 | file -------------------------------------------------------------------------------- /test/unit/multi-input/asset.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/require-symlink/symlink: -------------------------------------------------------------------------------- 1 | another.js -------------------------------------------------------------------------------- /test/unit/ts-path-join/file.txt: -------------------------------------------------------------------------------- 1 | file content -------------------------------------------------------------------------------- /test/unit/tsx/dep.tsx: -------------------------------------------------------------------------------- 1 | import './lib'; 2 | -------------------------------------------------------------------------------- /test/unit/tsx/input.js: -------------------------------------------------------------------------------- 1 | require('./dep'); -------------------------------------------------------------------------------- /test/unit/webpack-wrapper/asset.txt: -------------------------------------------------------------------------------- 1 | asset -------------------------------------------------------------------------------- /test/fixtures/es-module-dep.js: -------------------------------------------------------------------------------- 1 | export var p = 5; -------------------------------------------------------------------------------- /test/integration/loopback.js: -------------------------------------------------------------------------------- 1 | require("loopback"); -------------------------------------------------------------------------------- /test/unit/asset-fs-extra/asset1.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/asset-fs-inlining-multi/sub/asset.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/unit/asset-fs-inlining/asset.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/asset-fs-logical/asset1.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/asset-fs-logical/asset2.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/asset-graceful-fs/asset.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/asset-symlink/asset.txt: -------------------------------------------------------------------------------- 1 | ./asset1.txt -------------------------------------------------------------------------------- /test/unit/asset-symlink/asset1.txt: -------------------------------------------------------------------------------- 1 | asset1 2 | -------------------------------------------------------------------------------- /test/unit/glob-dot/with-dot/.dot/first.txt: -------------------------------------------------------------------------------- 1 | hello -------------------------------------------------------------------------------- /test/unit/import-meta-url/asset.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/imports/no.js: -------------------------------------------------------------------------------- 1 | export var y = 'y'; 2 | -------------------------------------------------------------------------------- /test/unit/multi-input/asset-2.txt: -------------------------------------------------------------------------------- 1 | hello again -------------------------------------------------------------------------------- /test/unit/process-cwd/_posts/first.md: -------------------------------------------------------------------------------- 1 | # first -------------------------------------------------------------------------------- /test/unit/process-cwd/_posts/second.md: -------------------------------------------------------------------------------- 1 | # second -------------------------------------------------------------------------------- /test/unit/process-env/a.js: -------------------------------------------------------------------------------- 1 | console.log('a'); 2 | -------------------------------------------------------------------------------- /test/unit/process-env/b.js: -------------------------------------------------------------------------------- 1 | console.log('b'); 2 | -------------------------------------------------------------------------------- /test/unit/require-dot/input.js: -------------------------------------------------------------------------------- 1 | require('.'); 2 | -------------------------------------------------------------------------------- /test/unit/require-resolve/asset1.txt: -------------------------------------------------------------------------------- 1 | asset1 2 | -------------------------------------------------------------------------------- /test/unit/require-resolve/asset2.txt: -------------------------------------------------------------------------------- 1 | asset2 2 | -------------------------------------------------------------------------------- /test/unit/require-resolve/asset3.txt: -------------------------------------------------------------------------------- 1 | asset3 2 | -------------------------------------------------------------------------------- /test/unit/return-emission/asset.txt: -------------------------------------------------------------------------------- 1 | asset1 2 | -------------------------------------------------------------------------------- /test/unit/webpack-wrapper-multi/asset.txt: -------------------------------------------------------------------------------- 1 | asset -------------------------------------------------------------------------------- /test/unit/wildcard/assets/asset1.txt: -------------------------------------------------------------------------------- 1 | asset1 2 | -------------------------------------------------------------------------------- /test/unit/wildcard/assets/asset2.txt: -------------------------------------------------------------------------------- 1 | asset2 2 | -------------------------------------------------------------------------------- /test/unit/wildcard/assets/asset3.txt: -------------------------------------------------------------------------------- 1 | asset3 2 | -------------------------------------------------------------------------------- /test/unit/wildcard2/assets/asset1.txt: -------------------------------------------------------------------------------- 1 | asset1 2 | -------------------------------------------------------------------------------- /test/unit/wildcard2/assets/asset2.txt: -------------------------------------------------------------------------------- 1 | asset2 2 | -------------------------------------------------------------------------------- /test/unit/wildcard2/assets/asset3.txt: -------------------------------------------------------------------------------- 1 | asset3 2 | -------------------------------------------------------------------------------- /test/unit/wildcard3/assets/asset1.txt: -------------------------------------------------------------------------------- 1 | asset1 2 | -------------------------------------------------------------------------------- /test/unit/wildcard3/assets/asset2.txt: -------------------------------------------------------------------------------- 1 | asset2 2 | -------------------------------------------------------------------------------- /test/unit/wildcard3/assets/asset3.txt: -------------------------------------------------------------------------------- 1 | asset3 2 | -------------------------------------------------------------------------------- /test/fixtures/index.html: -------------------------------------------------------------------------------- 1 |

{{ title }}

2 | -------------------------------------------------------------------------------- /test/fixtures/test.ts: -------------------------------------------------------------------------------- 1 | export var p: number = 5; 2 | -------------------------------------------------------------------------------- /test/integration/mariadb.js: -------------------------------------------------------------------------------- 1 | require('mariadb') 2 | -------------------------------------------------------------------------------- /test/integration/oracledb.js: -------------------------------------------------------------------------------- 1 | require('oracledb'); 2 | -------------------------------------------------------------------------------- /test/unit/array-emission/renderer/dom.js: -------------------------------------------------------------------------------- 1 | asset2 2 | -------------------------------------------------------------------------------- /test/unit/array-emission/renderer/util.js: -------------------------------------------------------------------------------- 1 | asset1 2 | -------------------------------------------------------------------------------- /test/unit/array-holes/input.js: -------------------------------------------------------------------------------- 1 | var a = [1,,2]; 2 | -------------------------------------------------------------------------------- /test/unit/asset-conditional/asset1.txt: -------------------------------------------------------------------------------- 1 | asset1 2 | -------------------------------------------------------------------------------- /test/unit/asset-conditional/asset2.txt: -------------------------------------------------------------------------------- 1 | asset2 2 | -------------------------------------------------------------------------------- /test/unit/asset-fs-array-expr/asset1.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-tpl/asset.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/browserify/dep1.js: -------------------------------------------------------------------------------- 1 | module.exports = 'dep1'; -------------------------------------------------------------------------------- /test/unit/browserify/dep2.js: -------------------------------------------------------------------------------- 1 | module.exports = 'dep2'; -------------------------------------------------------------------------------- /test/unit/dirname-emit-concat/assets/file.txt: -------------------------------------------------------------------------------- 1 | file -------------------------------------------------------------------------------- /test/unit/esm/esm-dep.js: -------------------------------------------------------------------------------- 1 | export var hello = 'world'; -------------------------------------------------------------------------------- /test/unit/exports/input.js: -------------------------------------------------------------------------------- 1 | require('pkg'); 2 | 3 | -------------------------------------------------------------------------------- /test/unit/glob-dot/without-dot/normal/first.txt: -------------------------------------------------------------------------------- 1 | hello -------------------------------------------------------------------------------- /test/unit/import-meta-bad-url/asset1.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/import-meta-bad-url/asset2.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/import-meta-tpl-cnd/asset1.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/import-meta-tpl-cnd/asset2.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/imports/node.js: -------------------------------------------------------------------------------- 1 | export var x = 'x'; 2 | -------------------------------------------------------------------------------- /test/unit/protobuf-loop/assets/asset1.txt: -------------------------------------------------------------------------------- 1 | asset1 2 | -------------------------------------------------------------------------------- /test/unit/protobuf-loop/assets/asset2.txt: -------------------------------------------------------------------------------- 1 | asset2 2 | -------------------------------------------------------------------------------- /test/unit/protobuf-loop2/assets/asset1.txt: -------------------------------------------------------------------------------- 1 | asset1 2 | -------------------------------------------------------------------------------- /test/unit/protobuf-loop2/assets/asset2.txt: -------------------------------------------------------------------------------- 1 | asset2 2 | -------------------------------------------------------------------------------- /test/unit/require-call/input.js: -------------------------------------------------------------------------------- 1 | require(call()); 2 | -------------------------------------------------------------------------------- /test/unit/tsx-input/dep.tsx: -------------------------------------------------------------------------------- 1 | export const dep = 'dep' -------------------------------------------------------------------------------- /test/unit/yarn-workspaces/input.js: -------------------------------------------------------------------------------- 1 | require('x'); 2 | -------------------------------------------------------------------------------- /test/unit/yarn-workspaces/node_modules/x: -------------------------------------------------------------------------------- 1 | ../packages/x -------------------------------------------------------------------------------- /test/integration/chromeless.js: -------------------------------------------------------------------------------- 1 | require('chromeless'); 2 | -------------------------------------------------------------------------------- /test/integration/fast-glob.js: -------------------------------------------------------------------------------- 1 | require('fast-glob'); 2 | -------------------------------------------------------------------------------- /test/integration/hot-shots.js: -------------------------------------------------------------------------------- 1 | require("hot-shots"); 2 | -------------------------------------------------------------------------------- /test/integration/jimp.js: -------------------------------------------------------------------------------- 1 | const jimp = require('jimp') 2 | -------------------------------------------------------------------------------- /test/integration/lighthouse.js: -------------------------------------------------------------------------------- 1 | require('lighthouse'); 2 | -------------------------------------------------------------------------------- /test/unit/asset-fs-extra/asset2.json: -------------------------------------------------------------------------------- 1 | "hello world" 2 | -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-babel/asset.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-enc-es/asset.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-shadow/asset.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-ts/asset.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/asset-fs-inlining-multi/asset.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/dot-dot/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'dot dot'; 2 | -------------------------------------------------------------------------------- /test/unit/esm-paths/esm-dep.js: -------------------------------------------------------------------------------- 1 | export var hello = 'world'; -------------------------------------------------------------------------------- /test/unit/exports-fallback/input.js: -------------------------------------------------------------------------------- 1 | require('pkg'); 2 | -------------------------------------------------------------------------------- /test/unit/exports-nomodule/no.js: -------------------------------------------------------------------------------- 1 | export var y = 'y'; 2 | -------------------------------------------------------------------------------- /test/unit/exports-nomodule/node.js: -------------------------------------------------------------------------------- 1 | export var x = 'x'; 2 | -------------------------------------------------------------------------------- /test/unit/exports-only/input.js: -------------------------------------------------------------------------------- 1 | require('pkg'); 2 | 3 | -------------------------------------------------------------------------------- /test/unit/exports-wildcard/no.js: -------------------------------------------------------------------------------- 1 | export var x = 'x'; 2 | -------------------------------------------------------------------------------- /test/unit/exports-wildcard/node.js: -------------------------------------------------------------------------------- 1 | export var y = 'y'; 2 | -------------------------------------------------------------------------------- /test/unit/ffmpeg-installer/ffmpeg.exe: -------------------------------------------------------------------------------- 1 | TOTALLY A BINARY 2 | -------------------------------------------------------------------------------- /test/unit/jsx-input/dep.jsx: -------------------------------------------------------------------------------- 1 | export const dep =

dep

-------------------------------------------------------------------------------- /test/unit/module-register/hook.mjs: -------------------------------------------------------------------------------- 1 | console.log('hook.mjs'); -------------------------------------------------------------------------------- /test/unit/resolve-from/dep.js: -------------------------------------------------------------------------------- 1 | module.exports = 'dep'; 2 | -------------------------------------------------------------------------------- /test/unit/resolve-hook/dep.js: -------------------------------------------------------------------------------- 1 | module.exports = 'dep'; 2 | -------------------------------------------------------------------------------- /test/unit/tsx-input/input.tsx: -------------------------------------------------------------------------------- 1 | import { dep } from './dep' -------------------------------------------------------------------------------- /test/unit/when-wrapper/dep.js: -------------------------------------------------------------------------------- 1 | module.exports = 'dep'; 2 | -------------------------------------------------------------------------------- /test/integration/azure-storage.js: -------------------------------------------------------------------------------- 1 | require("azure-storage"); 2 | -------------------------------------------------------------------------------- /test/integration/firebase-admin.js: -------------------------------------------------------------------------------- 1 | require("firebase-admin"); -------------------------------------------------------------------------------- /test/integration/path-platform.js: -------------------------------------------------------------------------------- 1 | require('path-platform'); 2 | -------------------------------------------------------------------------------- /test/unit/asset-fs-array-expr-node-prefix/asset1.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-enc-es-2/asset.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-enc-es-3/asset.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-enc-es-4/asset.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-enc-es-5/asset.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/basic-analysis-require/input.js: -------------------------------------------------------------------------------- 1 | require('./dep'); 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings/input.js: -------------------------------------------------------------------------------- 1 | require('pkg'); 2 | 3 | -------------------------------------------------------------------------------- /test/unit/browserify-uglify/dep1.js: -------------------------------------------------------------------------------- 1 | module.exports = 'dep1'; -------------------------------------------------------------------------------- /test/unit/browserify-uglify/dep2.js: -------------------------------------------------------------------------------- 1 | module.exports = 'dep2'; -------------------------------------------------------------------------------- /test/unit/dot-dot/input.js: -------------------------------------------------------------------------------- 1 | require('./dir/dot-dot-req.js'); 2 | -------------------------------------------------------------------------------- /test/unit/esm-dynamic-import/dep.js: -------------------------------------------------------------------------------- 1 | export const foo = 'foo'; -------------------------------------------------------------------------------- /test/unit/esm-export-wildcard/all.js: -------------------------------------------------------------------------------- 1 | export * from './week'; -------------------------------------------------------------------------------- /test/unit/import-assertions/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "foo": "bar" 3 | } -------------------------------------------------------------------------------- /test/unit/import-attributes/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "foo": "bar" 3 | } -------------------------------------------------------------------------------- /test/unit/module-register/hook2.mjs: -------------------------------------------------------------------------------- 1 | console.log('hook2.mjs'); -------------------------------------------------------------------------------- /test/unit/module-register/hook3.mjs: -------------------------------------------------------------------------------- 1 | console.log('hook3.mjs'); -------------------------------------------------------------------------------- /test/unit/module-require/dep.js: -------------------------------------------------------------------------------- 1 | module.exports = 'dep'; 2 | -------------------------------------------------------------------------------- /test/unit/multi-input/style.module.css: -------------------------------------------------------------------------------- 1 | body { color: green; } -------------------------------------------------------------------------------- /test/unit/processed-dependency/parent-1.js: -------------------------------------------------------------------------------- 1 | require('./child') -------------------------------------------------------------------------------- /test/unit/processed-dependency/parent-2.js: -------------------------------------------------------------------------------- 1 | require('./child') -------------------------------------------------------------------------------- /test/unit/require-symlink/input.js: -------------------------------------------------------------------------------- 1 | require('./symlink') 2 | -------------------------------------------------------------------------------- /test/unit/require-wrapper/dep.js: -------------------------------------------------------------------------------- 1 | module.exports = 'dep'; 2 | -------------------------------------------------------------------------------- /test/unit/require-wrapper2/dep.js: -------------------------------------------------------------------------------- 1 | module.exports = 'dep'; 2 | -------------------------------------------------------------------------------- /test/unit/require-wrapper3/dep.js: -------------------------------------------------------------------------------- 1 | module.exports = 'dep'; 2 | -------------------------------------------------------------------------------- /test/unit/string-concat/lib/dep.js: -------------------------------------------------------------------------------- 1 | export const hello = 'world'; -------------------------------------------------------------------------------- /test/unit/top-level-await/module.js: -------------------------------------------------------------------------------- 1 | export const dep = 'dep'; -------------------------------------------------------------------------------- /test/unit/ts-input-esm/dep2.ts: -------------------------------------------------------------------------------- 1 | export const dep2 = 'dep2'; 2 | -------------------------------------------------------------------------------- /test/unit/webpack-wrapper-dirname-inject/schema.prisma: -------------------------------------------------------------------------------- 1 | test 2 | -------------------------------------------------------------------------------- /test/unit/webpack-wrapper-name/input.js: -------------------------------------------------------------------------------- 1 | require('./mangled') -------------------------------------------------------------------------------- /test/unit/webpack-wrapper-null/input.js: -------------------------------------------------------------------------------- 1 | require('./mangled') -------------------------------------------------------------------------------- /test/integration/azure-cosmos.js: -------------------------------------------------------------------------------- 1 | require("@azure/cosmos"); 2 | 3 | -------------------------------------------------------------------------------- /test/integration/es-get-iterator.js: -------------------------------------------------------------------------------- 1 | require('es-get-iterator'); 2 | -------------------------------------------------------------------------------- /test/integration/express.js: -------------------------------------------------------------------------------- 1 | const app = require('express'); 2 | 3 | -------------------------------------------------------------------------------- /test/integration/fetch-h2.js: -------------------------------------------------------------------------------- 1 | const fetch = require("fetch-h2"); 2 | -------------------------------------------------------------------------------- /test/integration/ioredis.js: -------------------------------------------------------------------------------- 1 | const ioredis = require("ioredis"); 2 | -------------------------------------------------------------------------------- /test/integration/mailgun.js: -------------------------------------------------------------------------------- 1 | const mailgun = require('mailgun'); 2 | -------------------------------------------------------------------------------- /test/integration/stripe.js: -------------------------------------------------------------------------------- 1 | const stripe = require('stripe'); 2 | -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-ts-no-interop/asset.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/asset-node-require/input.js: -------------------------------------------------------------------------------- 1 | require('./mock.node'); 2 | -------------------------------------------------------------------------------- /test/unit/basic-analysis-require/dep.js: -------------------------------------------------------------------------------- 1 | module.exports = 'dep'; 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-false/input.js: -------------------------------------------------------------------------------- 1 | require('pkg'); 2 | 3 | -------------------------------------------------------------------------------- /test/unit/esm-paths-trailer/esm-dep.js: -------------------------------------------------------------------------------- 1 | export var hello = 'world'; -------------------------------------------------------------------------------- /test/unit/jsonc-parser-wrapper/dep.js: -------------------------------------------------------------------------------- 1 | module.exports = 'dep'; 2 | -------------------------------------------------------------------------------- /test/unit/node-modules-filter/sub/node_modules/pkg/noemit: -------------------------------------------------------------------------------- 1 | sdf 2 | -------------------------------------------------------------------------------- /test/unit/non-analyzable-requires/dep.js: -------------------------------------------------------------------------------- 1 | module.exports = 'dep'; 2 | -------------------------------------------------------------------------------- /test/unit/prisma-photon/input.js: -------------------------------------------------------------------------------- 1 | require('@generated/photon'); 2 | -------------------------------------------------------------------------------- /test/unit/require-dirname-tpl/dep.js: -------------------------------------------------------------------------------- 1 | module.exports = 'dep'; 2 | -------------------------------------------------------------------------------- /test/unit/require-dot/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'the index file'; -------------------------------------------------------------------------------- /test/unit/ts-filter/node_modules/pkg/index.ts: -------------------------------------------------------------------------------- 1 | import './dep'; 2 | -------------------------------------------------------------------------------- /test/unit/webpack-node/level1/a.b.js: -------------------------------------------------------------------------------- 1 | module.exports = 'hello' 2 | -------------------------------------------------------------------------------- /test/unit/webpack-node/level1/c.d.js: -------------------------------------------------------------------------------- 1 | module.exports = 'world' 2 | -------------------------------------------------------------------------------- /test/unit/yarn-workspaces/packages/x/dep.js: -------------------------------------------------------------------------------- 1 | module.exports = 42; 2 | -------------------------------------------------------------------------------- /test/fixtures/es-module.js: -------------------------------------------------------------------------------- 1 | export { p } from './es-module-dep.js'; 2 | -------------------------------------------------------------------------------- /test/integration/dogfood.js: -------------------------------------------------------------------------------- 1 | require('../../out/node-file-trace'); 2 | -------------------------------------------------------------------------------- /test/integration/firestore.js: -------------------------------------------------------------------------------- 1 | require("@google-cloud/firestore"); 2 | -------------------------------------------------------------------------------- /test/integration/sentry.js: -------------------------------------------------------------------------------- 1 | const sentry = require('@sentry/node'); 2 | -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-enc-es-node-prefix/asset.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /test/unit/asset-package-json/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "package": "json" 3 | } -------------------------------------------------------------------------------- /test/unit/browser-remappings-disabled/input.js: -------------------------------------------------------------------------------- 1 | require('pkg'); 2 | 3 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed/input.js: -------------------------------------------------------------------------------- 1 | require('pkg'); 2 | 3 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed2/input.js: -------------------------------------------------------------------------------- 1 | require('pkg'); 2 | 3 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-string/input.js: -------------------------------------------------------------------------------- 1 | require('pkg'); 2 | 3 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-undefined/input.js: -------------------------------------------------------------------------------- 1 | require('pkg'); 2 | 3 | -------------------------------------------------------------------------------- /test/unit/dot-dot/dir/dot-dot-req.js: -------------------------------------------------------------------------------- 1 | module.exports = require('..'); 2 | -------------------------------------------------------------------------------- /test/unit/file-folder-slash/input.js: -------------------------------------------------------------------------------- 1 | require('./file-folder/'); 2 | 3 | -------------------------------------------------------------------------------- /test/unit/module-create-require/lib.node: -------------------------------------------------------------------------------- 1 | // Native module for testing -------------------------------------------------------------------------------- /test/unit/mongoose/dir/connection.js: -------------------------------------------------------------------------------- 1 | module.exports = 'connection'; 2 | -------------------------------------------------------------------------------- /test/unit/multi-input/input-3.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('./child-3') -------------------------------------------------------------------------------- /test/unit/multi-input/input.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('./child-1') 3 | -------------------------------------------------------------------------------- /test/unit/require-dirname-tpl/input.js: -------------------------------------------------------------------------------- 1 | require(`${__dirname}/dep.js`); -------------------------------------------------------------------------------- /test/unit/require-dynamic-fallback/dep.js: -------------------------------------------------------------------------------- 1 | module.exports = 'dep'; 2 | -------------------------------------------------------------------------------- /test/unit/require-resolve/dep2.js: -------------------------------------------------------------------------------- 1 | module.exports = { dep2: 'dep2' } 2 | -------------------------------------------------------------------------------- /test/unit/ts-input-esm/input.ts: -------------------------------------------------------------------------------- 1 | import { dep1 } from './dep1.js'; 2 | -------------------------------------------------------------------------------- /test/unit/wildcard-require/modules/module1.js: -------------------------------------------------------------------------------- 1 | module.exports = 'module1'; -------------------------------------------------------------------------------- /test/unit/yarn-workspace-esm/node_modules/@example/web: -------------------------------------------------------------------------------- 1 | ../../packages/web -------------------------------------------------------------------------------- /test/integration/bindings-failure.js: -------------------------------------------------------------------------------- 1 | require('bindings')('not-found'); 2 | -------------------------------------------------------------------------------- /test/integration/datadog-pprof.js: -------------------------------------------------------------------------------- 1 | const dd = require('@datadog/pprof'); 2 | -------------------------------------------------------------------------------- /test/integration/paraphrase.js: -------------------------------------------------------------------------------- 1 | const paraphrase = require('paraphrase/percent') -------------------------------------------------------------------------------- /test/integration/tiny-json-http.js: -------------------------------------------------------------------------------- 1 | const tiny = require('tiny-json-http'); 2 | -------------------------------------------------------------------------------- /test/unit/file-folder-slash/file-folder.js: -------------------------------------------------------------------------------- 1 | module.exports = 'file'; 2 | 3 | -------------------------------------------------------------------------------- /test/unit/imports/input.js: -------------------------------------------------------------------------------- 1 | import { x } from '#x'; 2 | console.log(x); 3 | -------------------------------------------------------------------------------- /test/unit/mixed-esm-cjs/ecmascript-module.js: -------------------------------------------------------------------------------- 1 | export const dep2 = 'dep2'; 2 | -------------------------------------------------------------------------------- /test/unit/non-analyzable-requires/ignored.js: -------------------------------------------------------------------------------- 1 | module.exports = 'ignored'; 2 | -------------------------------------------------------------------------------- /test/unit/syntax-err/input.js: -------------------------------------------------------------------------------- 1 | // if (typeof __filename > 'undefine') { 2 | + -------------------------------------------------------------------------------- /test/unit/ts-filter/node_modules/pkg/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'main'; 2 | -------------------------------------------------------------------------------- /test/unit/webpack-wrapper-strs-namespaces-large/content/packages.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/unit/wildcard-require/modules/module2.js: -------------------------------------------------------------------------------- 1 | module.exports = 'module2'; 2 | -------------------------------------------------------------------------------- /test/unit/wildcard-require/modules/module3.js: -------------------------------------------------------------------------------- 1 | module.exports = 'module3'; 2 | -------------------------------------------------------------------------------- /test/unit/yarn-workspace-esm/node_modules/@example/common: -------------------------------------------------------------------------------- 1 | ../../packages/common -------------------------------------------------------------------------------- /test/integration/browserify-middleware.js: -------------------------------------------------------------------------------- 1 | require('browserify-middleware'); 2 | -------------------------------------------------------------------------------- /test/integration/ffmpeg.js: -------------------------------------------------------------------------------- 1 | let {path} = require('@ffmpeg-installer/ffmpeg'); 2 | -------------------------------------------------------------------------------- /test/integration/koa.js: -------------------------------------------------------------------------------- 1 | const Koa = require("koa"); 2 | 3 | new Koa(); 4 | 5 | -------------------------------------------------------------------------------- /test/integration/sparql-builder.js: -------------------------------------------------------------------------------- 1 | require('@tpluscode/sparql-builder'); 2 | 3 | -------------------------------------------------------------------------------- /test/unit/datadog-pprof-node-gyp/input.js: -------------------------------------------------------------------------------- 1 | const dd = require('@datadog/pprof'); 2 | -------------------------------------------------------------------------------- /test/unit/esm-paths/input.js: -------------------------------------------------------------------------------- 1 | import dep from 'dep'; 2 | console.log(dep.hello); 3 | -------------------------------------------------------------------------------- /test/unit/exports-nomodule/input.js: -------------------------------------------------------------------------------- 1 | import { x } from 'x'; 2 | console.log(x); 3 | -------------------------------------------------------------------------------- /test/unit/exports/node_modules/pkg/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'legacy index'; 2 | -------------------------------------------------------------------------------- /test/unit/exports/node_modules/pkg/subdir/package.json: -------------------------------------------------------------------------------- 1 | { "type": "module" } 2 | -------------------------------------------------------------------------------- /test/unit/mixed-esm-cjs/commonjs-module.js: -------------------------------------------------------------------------------- 1 | module.exports = { dep1: 'dep1' }; 2 | -------------------------------------------------------------------------------- /test/unit/require-dynamic-fallback/input.js: -------------------------------------------------------------------------------- 1 | require(dynamic || './dep.js'); 2 | -------------------------------------------------------------------------------- /test/unit/require-symlink/another.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('hello'); -------------------------------------------------------------------------------- /test/unit/require-var-branch/lib1/createsend.js: -------------------------------------------------------------------------------- 1 | module.exports = 'the index1 file'; -------------------------------------------------------------------------------- /test/unit/require-var-branch/lib2/createsend.js: -------------------------------------------------------------------------------- 1 | module.exports = 'the index2 file'; -------------------------------------------------------------------------------- /test/unit/webpack-5-wrapper-namespace/assets/dictionary.json: -------------------------------------------------------------------------------- 1 | { "word": "word" } 2 | -------------------------------------------------------------------------------- /test/unit/webpack-wrapper-strs-namespaces-large/content/guides/index.md: -------------------------------------------------------------------------------- 1 | # Test 2 | -------------------------------------------------------------------------------- /test/fixtures/img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShumCr/nft/HEAD/test/fixtures/img.jpg -------------------------------------------------------------------------------- /test/integration/aws-sdk.js: -------------------------------------------------------------------------------- 1 | const aws = require('aws-sdk'); 2 | 3 | new aws.S3(); 4 | -------------------------------------------------------------------------------- /test/integration/jugglingdb.js: -------------------------------------------------------------------------------- 1 | require("jugglingdb"); 2 | module.exports = () => {}; 3 | -------------------------------------------------------------------------------- /test/integration/zeromq.js: -------------------------------------------------------------------------------- 1 | const zmq = require("zeromq"); 2 | const sock = new zmq.Push; -------------------------------------------------------------------------------- /test/unit/browser-remappings/node_modules/pkg/subdir/package.json: -------------------------------------------------------------------------------- 1 | {"type": "module"} 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings/test-opts.json: -------------------------------------------------------------------------------- 1 | { 2 | "conditions": ["browser"] 3 | } 4 | -------------------------------------------------------------------------------- /test/unit/exports-fallback/node_modules/pkg/subdir/package.json: -------------------------------------------------------------------------------- 1 | { "type": "module" } 2 | -------------------------------------------------------------------------------- /test/unit/exports-only/node_modules/pkg/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'legacy index'; 2 | -------------------------------------------------------------------------------- /test/unit/exports-only/node_modules/pkg/subdir/package.json: -------------------------------------------------------------------------------- 1 | { "type": "module" } 2 | -------------------------------------------------------------------------------- /test/unit/exports-wildcard/input.js: -------------------------------------------------------------------------------- 1 | import { y } from 'y/no'; 2 | console.log(y); 3 | -------------------------------------------------------------------------------- /test/unit/file-folder-slash/file-folder/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'folder'; 2 | 3 | -------------------------------------------------------------------------------- /test/unit/pkginfo/input.js: -------------------------------------------------------------------------------- 1 | require('pkginfo')(module, 'version', 'dependencies'); 2 | -------------------------------------------------------------------------------- /test/unit/pkginfo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "x.y.z", 3 | "dependencies": {} 4 | } -------------------------------------------------------------------------------- /test/unit/processed-dependency/child-2.js: -------------------------------------------------------------------------------- 1 | console.log("I'm loaded by the other child") -------------------------------------------------------------------------------- /test/unit/processed-dependency/input-cached.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('./parent-2') -------------------------------------------------------------------------------- /test/unit/resolve-hook/input.js: -------------------------------------------------------------------------------- 1 | require('./local-dep'); 2 | require('external-dep'); 3 | -------------------------------------------------------------------------------- /test/unit/webpack-wrapper-strs-namespaces/assets/dictionary.json: -------------------------------------------------------------------------------- 1 | { "word": "word" } 2 | -------------------------------------------------------------------------------- /test/unit/yarn-workspaces/packages/x/main.ts: -------------------------------------------------------------------------------- 1 | module.exports = require('./dep.js'); 2 | -------------------------------------------------------------------------------- /test/unit/yarn-workspaces/packages/x/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "./main" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/test.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | exports.__esModule = true; 3 | exports.p = 5; 4 | -------------------------------------------------------------------------------- /test/integration/passport-trakt.js: -------------------------------------------------------------------------------- 1 | require('passport'); 2 | require('passport-trakt'); 3 | -------------------------------------------------------------------------------- /test/integration/pg.js: -------------------------------------------------------------------------------- 1 | const { Client } = require("pg"); 2 | const client = new Client(); 3 | -------------------------------------------------------------------------------- /test/integration/pug.js: -------------------------------------------------------------------------------- 1 | const pug = require('pug'); 2 | pug.compile('string of pug'); 3 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-disabled/test-opts.json: -------------------------------------------------------------------------------- 1 | { 2 | "conditions": ["node"] 3 | } 4 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-false/test-opts.json: -------------------------------------------------------------------------------- 1 | { 2 | "conditions": ["browser"] 3 | } 4 | -------------------------------------------------------------------------------- /test/unit/browser-remappings/node_modules/pkg/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'legacy index'; 2 | -------------------------------------------------------------------------------- /test/unit/exports-fallback/node_modules/pkg/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'legacy index'; 2 | -------------------------------------------------------------------------------- /test/unit/exports/node_modules/pkg/subdir/import-main.js: -------------------------------------------------------------------------------- 1 | export default 'import main'; 2 | -------------------------------------------------------------------------------- /test/unit/module-register/node_modules/test-pkg/index.mjs: -------------------------------------------------------------------------------- 1 | console.log('test-pkg/index.mjs'); -------------------------------------------------------------------------------- /test/unit/prisma-photon/node_modules/@generated/photon/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'asdf' 2 | -------------------------------------------------------------------------------- /test/unit/prisma-photon/node_modules/@generated/photon/runtime/query-engine-darwin: -------------------------------------------------------------------------------- 1 | asdf 2 | -------------------------------------------------------------------------------- /test/unit/ts-filter/node_modules/pkg/dep.js: -------------------------------------------------------------------------------- 1 | console.log('should not be traced'); 2 | 3 | -------------------------------------------------------------------------------- /test/unit/ts-input-esm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "type": "module" 4 | } 5 | -------------------------------------------------------------------------------- /test/unit/url-error/input.js: -------------------------------------------------------------------------------- 1 | const URLParser = typeof window === 'undefined' ? URL : 'b'; 2 | -------------------------------------------------------------------------------- /test/integration/bugsnag-js.js: -------------------------------------------------------------------------------- 1 | require("@bugsnag/js"); 2 | 3 | module.exports = () => {}; 4 | -------------------------------------------------------------------------------- /test/integration/core-js.js: -------------------------------------------------------------------------------- 1 | 2 | require("core-js").Array.prototype.map.call([], () => {}); 3 | -------------------------------------------------------------------------------- /test/integration/passport.js: -------------------------------------------------------------------------------- 1 | require('passport'); 2 | require('passport-google-oauth'); 3 | 4 | -------------------------------------------------------------------------------- /test/integration/redis.js: -------------------------------------------------------------------------------- 1 | const redis = require('redis'); 2 | 3 | redis.add_command('test'); 4 | -------------------------------------------------------------------------------- /test/integration/when.js: -------------------------------------------------------------------------------- 1 | var when = require('when'); 2 | 3 | var deferred = when.defer(); 4 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-disabled/node_modules/pkg/subdir/package.json: -------------------------------------------------------------------------------- 1 | {"type": "module"} 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed/node_modules/pkg/subdir/package.json: -------------------------------------------------------------------------------- 1 | {"type": "module"} 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed/test-opts.json: -------------------------------------------------------------------------------- 1 | { 2 | "conditions": ["browser"] 3 | } 4 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed2/test-opts.json: -------------------------------------------------------------------------------- 1 | { 2 | "conditions": ["browser"] 3 | } 4 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-string/test-opts.json: -------------------------------------------------------------------------------- 1 | { 2 | "conditions": ["browser"] 3 | } 4 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-undefined/node_modules/pkg/subdir/package.json: -------------------------------------------------------------------------------- 1 | {"type": "module"} 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-undefined/test-opts.json: -------------------------------------------------------------------------------- 1 | { 2 | "conditions": ["browser"] 3 | } 4 | -------------------------------------------------------------------------------- /test/unit/browser-remappings/.gitignore: -------------------------------------------------------------------------------- 1 | # include node_modules for testing 2 | !node_modules 3 | -------------------------------------------------------------------------------- /test/unit/esm-dynamic-import/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "type": "module" 4 | } -------------------------------------------------------------------------------- /test/unit/exports-fallback/node_modules/pkg/require-main.cjs: -------------------------------------------------------------------------------- 1 | module.exports = 'require main'; 2 | -------------------------------------------------------------------------------- /test/unit/exports-only/node_modules/pkg/subdir/import-main.js: -------------------------------------------------------------------------------- 1 | export default 'import main'; 2 | -------------------------------------------------------------------------------- /test/unit/ffmpeg-installer/input.js: -------------------------------------------------------------------------------- 1 | let { path } = require('./ffmpeg.js'); 2 | console.log(path); -------------------------------------------------------------------------------- /test/unit/multi-input/input-2.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('./child-1') 3 | require('./child-2') -------------------------------------------------------------------------------- /test/unit/null-destructure/input.js: -------------------------------------------------------------------------------- 1 | Object.define 2 | const a = null; 3 | const { b } = a; 4 | -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/node_modules/.pnpm/node_modules/parse5: -------------------------------------------------------------------------------- 1 | ../parse5@6.0.1/node_modules/parse5 -------------------------------------------------------------------------------- /test/unit/require-resolve/dep1.js: -------------------------------------------------------------------------------- 1 | require('./dep2') 2 | 3 | module.exports = { dep1: 'dep1' } 4 | -------------------------------------------------------------------------------- /test/unit/syntax-err/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/syntax-err/input.js" 4 | ] -------------------------------------------------------------------------------- /test/unit/url-error/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/url-error/input.js" 4 | ] -------------------------------------------------------------------------------- /test/unit/zeromq-node-gyp/input.js: -------------------------------------------------------------------------------- 1 | const zeromq = require('zeromq'); 2 | const sock = new zmq.Push; -------------------------------------------------------------------------------- /test/integration/vm2.js: -------------------------------------------------------------------------------- 1 | const {VM} = require('vm2'); 2 | new VM().run('console.log("HELLO WORLD")'); -------------------------------------------------------------------------------- /test/unit/amd-disable/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/amd-disable/input.js" 4 | ] -------------------------------------------------------------------------------- /test/unit/array-holes/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/array-holes/input.js" 4 | ] -------------------------------------------------------------------------------- /test/unit/browser-remappings-disabled/node_modules/pkg/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'legacy index'; 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-false/.gitignore: -------------------------------------------------------------------------------- 1 | # include node_modules for testing 2 | !node_modules 3 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-false/node_modules/pkg/browser.js: -------------------------------------------------------------------------------- 1 | module.exports = 'browser code'; 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed/node_modules/pkg/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'legacy index'; 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed2/node_modules/pkg/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'legacy index'; 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed2/node_modules/pkg/subdir/package.json: -------------------------------------------------------------------------------- 1 | {"type": "module"} 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-string/node_modules/pkg/browser.js: -------------------------------------------------------------------------------- 1 | module.exports = 'browser code'; 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-undefined/node_modules/pkg/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'legacy index'; 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings/node_modules/pkg/subdir/import-main.js: -------------------------------------------------------------------------------- 1 | export default 'import main'; 2 | -------------------------------------------------------------------------------- /test/unit/dirname-len/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/dirname-len/input.js" 4 | ] -------------------------------------------------------------------------------- /test/unit/esm-paths-trailer/input.js: -------------------------------------------------------------------------------- 1 | import dep from 'dep/esm-dep'; 2 | console.log(dep.hello); 3 | -------------------------------------------------------------------------------- /test/unit/esm/input.js: -------------------------------------------------------------------------------- 1 | require = require('esm')(module); 2 | 3 | require('./esm-dep.js').hello; 4 | -------------------------------------------------------------------------------- /test/unit/exports-fallback/node_modules/pkg/subdir/import-main.js: -------------------------------------------------------------------------------- 1 | export default 'import main'; 2 | -------------------------------------------------------------------------------- /test/unit/exports-path/node_modules/apollo-upload-client/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'legacy index'; 2 | -------------------------------------------------------------------------------- /test/unit/require-call/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/require-call/input.js" 4 | ] -------------------------------------------------------------------------------- /test/unit/require-empty/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/require-empty/input.js" 4 | ] -------------------------------------------------------------------------------- /test/unit/return-emission/input.js: -------------------------------------------------------------------------------- 1 | function f () { 2 | return __dirname + '/asset.txt'; 3 | } 4 | -------------------------------------------------------------------------------- /test/unit/yarn-workspaces/.gitignore: -------------------------------------------------------------------------------- 1 | # include node_modules to test the symlinks 2 | !node_modules 3 | -------------------------------------------------------------------------------- /release.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | branches: ['main'], 3 | tagFormat: '${version}', 4 | }; 5 | -------------------------------------------------------------------------------- /test/integration/argon2.js: -------------------------------------------------------------------------------- 1 | const argon2 = require('argon2'); 2 | console.log('argon is ' + typeof argon2); -------------------------------------------------------------------------------- /test/integration/saslprep.js: -------------------------------------------------------------------------------- 1 | const saslprep = require("saslprep"); 2 | 3 | saslprep("password\u00AD"); 4 | -------------------------------------------------------------------------------- /test/integration/serialport.js: -------------------------------------------------------------------------------- 1 | const { SerialPort} = require('serialport'); 2 | 3 | SerialPort.list(); 4 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-disabled/.gitignore: -------------------------------------------------------------------------------- 1 | # include node_modules for testing 2 | !node_modules 3 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed/.gitignore: -------------------------------------------------------------------------------- 1 | # include node_modules for testing 2 | !node_modules 3 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed2/.gitignore: -------------------------------------------------------------------------------- 1 | # include node_modules for testing 2 | !node_modules 3 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-string/.gitignore: -------------------------------------------------------------------------------- 1 | # include node_modules for testing 2 | !node_modules 3 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-undefined/.gitignore: -------------------------------------------------------------------------------- 1 | # include node_modules for testing 2 | !node_modules 3 | -------------------------------------------------------------------------------- /test/unit/process-env/input.js: -------------------------------------------------------------------------------- 1 | require(process.env.NODE_ENV === 'production' ? './a.js' : './b.js'); 2 | -------------------------------------------------------------------------------- /test/unit/processed-dependency/child.js: -------------------------------------------------------------------------------- 1 | require('./child-2') 2 | console.log("I'm loaded by two parents") -------------------------------------------------------------------------------- /test/unit/processed-dependency/input.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('./parent-1') 3 | require('./parent-2') -------------------------------------------------------------------------------- /test/unit/yarn-workspace-esm/.gitignore: -------------------------------------------------------------------------------- 1 | # include node_modules to test the symlinks 2 | !node_modules 3 | -------------------------------------------------------------------------------- /test/unit/yarn-workspace-esm/input.js: -------------------------------------------------------------------------------- 1 | import handler from '@example/web'; 2 | console.log(handler()); 3 | -------------------------------------------------------------------------------- /test/integration/env-var.js: -------------------------------------------------------------------------------- 1 | const env = process.env.NODE_ENV = 'development' 2 | 3 | module.exports = env; 4 | -------------------------------------------------------------------------------- /test/integration/leveldown.js: -------------------------------------------------------------------------------- 1 | const leveldown = require('leveldown'); 2 | const db = leveldown('tmp/db'); 3 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-disabled/node_modules/pkg/subdir/import-main.js: -------------------------------------------------------------------------------- 1 | export default 'import main'; 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed/node_modules/pkg/subdir/import-main.js: -------------------------------------------------------------------------------- 1 | export default 'import main'; 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed2/node_modules/pkg/subdir/import-main.js: -------------------------------------------------------------------------------- 1 | export default 'import main'; 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-undefined/node_modules/pkg/subdir/import-main.js: -------------------------------------------------------------------------------- 1 | export default 'import main'; 2 | -------------------------------------------------------------------------------- /test/unit/exports/node_modules/pkg/require-main.cjs: -------------------------------------------------------------------------------- 1 | import('pkg/asdf'); 2 | module.exports = 'require main'; 3 | -------------------------------------------------------------------------------- /test/unit/filter-asset-base/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/filter-asset-base/input.js" 4 | ] -------------------------------------------------------------------------------- /test/unit/jsx-input/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "test/unit/jsx-input/dep.jsx", 3 | "test/unit/jsx-input/input.jsx" 4 | ] -------------------------------------------------------------------------------- /test/unit/multi-input/input-4.js: -------------------------------------------------------------------------------- 1 | import style from './style.module.css'; 2 | 3 | import child4 from './child-4'; -------------------------------------------------------------------------------- /test/unit/null-destructure/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/null-destructure/input.js" 4 | ] -------------------------------------------------------------------------------- /test/unit/tsx-input/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "test/unit/tsx-input/dep.tsx", 3 | "test/unit/tsx-input/input.tsx" 4 | ] -------------------------------------------------------------------------------- /test/unit/yarn-workspace-esm/packages/common/hello.js: -------------------------------------------------------------------------------- 1 | export function hello(name) { return 'Hello, ' + name } 2 | -------------------------------------------------------------------------------- /test/integration/memcached.js: -------------------------------------------------------------------------------- 1 | const Memcached = require('memcached'); 2 | Memcached.config.poolSize = 25; 3 | 4 | -------------------------------------------------------------------------------- /test/unit/browser-remappings/node_modules/pkg/subdir/import-main-browser.js: -------------------------------------------------------------------------------- 1 | export default 'import main browser'; 2 | -------------------------------------------------------------------------------- /test/unit/esm-export-wildcard/input.js: -------------------------------------------------------------------------------- 1 | import {mon, wed, fri} from './all'; 2 | 3 | console.log(mon, wed, fri); 4 | -------------------------------------------------------------------------------- /test/unit/exports-only/node_modules/pkg/require-main.cjs: -------------------------------------------------------------------------------- 1 | import('pkg/asdf'); 2 | module.exports = 'require main'; 3 | -------------------------------------------------------------------------------- /test/unit/exports-path/input.js: -------------------------------------------------------------------------------- 1 | const ReactNativeFile = require('apollo-upload-client/public/ReactNativeFile') 2 | -------------------------------------------------------------------------------- /test/unit/exports-path/node_modules/extract-files/public/ReactNativeFile.js: -------------------------------------------------------------------------------- 1 | module.exports = 'React Native File'; 2 | -------------------------------------------------------------------------------- /test/unit/jsx-input/input.jsx: -------------------------------------------------------------------------------- 1 | import { readFileSync } from 'fs'; 2 | 3 | readFileSync(__dirname + '/dep.jsx'); 4 | -------------------------------------------------------------------------------- /test/unit/node-modules-filter/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/node-modules-filter/input.js" 4 | ] -------------------------------------------------------------------------------- /test/unit/top-level-await/input.js: -------------------------------------------------------------------------------- 1 | import {dep} from './module'; 2 | 3 | await Promise.resolve(console.log(dep)); 4 | -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-tpl/input.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | console.log(fs.readFileSync(`${__dirname}/asset.txt`)); -------------------------------------------------------------------------------- /test/unit/asset-fs-inlining/input.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | console.log(fs.readFileSync(__dirname + '/asset.txt')); -------------------------------------------------------------------------------- /test/unit/browser-remappings-false/node_modules/pkg/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'legacy index'; 2 | require("./browser") 3 | -------------------------------------------------------------------------------- /test/unit/browser-remappings/node_modules/pkg/require-main.cjs: -------------------------------------------------------------------------------- 1 | import('pkg/asdf'); 2 | module.exports = 'require main'; 3 | -------------------------------------------------------------------------------- /test/unit/import-meta-bad-url/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/import-meta-bad-url/input.js" 4 | ] 5 | -------------------------------------------------------------------------------- /test/unit/node-modules-filter/input.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | fs.readFileSync(__dirname + '/sub/' + unknown); 3 | -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/input.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const adapter = require('parse5-htmlparser2-tree-adapter'); 4 | -------------------------------------------------------------------------------- /test/integration/analytics-node.js: -------------------------------------------------------------------------------- 1 | const Analytics = require("analytics-node"); 2 | 3 | new Analytics("YOUR_WRITE_KEY"); 4 | -------------------------------------------------------------------------------- /test/integration/geo-tz.js: -------------------------------------------------------------------------------- 1 | const { find } = require('geo-tz') 2 | const timezones = find(-21.2377437, 55.48997639438238) 3 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-disabled/node_modules/pkg/subdir/import-main-browser.js: -------------------------------------------------------------------------------- 1 | export default 'import main browser'; 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed/node_modules/pkg/subdir/import-main-browser.js: -------------------------------------------------------------------------------- 1 | export default 'import main browser'; 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed2/node_modules/pkg/subdir/import-main-browser.js: -------------------------------------------------------------------------------- 1 | export default 'import main browser'; 2 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-string/node_modules/pkg/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'legacy index'; 2 | require("pkg/browser") 3 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-undefined/node_modules/pkg/subdir/import-main-browser.js: -------------------------------------------------------------------------------- 1 | export default 'import main browser'; 2 | -------------------------------------------------------------------------------- /test/unit/filter-asset-base/input.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | fs.readFileSync(__dirname + '/../../../package.json'); 3 | -------------------------------------------------------------------------------- /test/unit/require-empty/input.js: -------------------------------------------------------------------------------- 1 | try { 2 | typescriptPath = ''; 3 | ts = require(typescriptPath); 4 | } catch (_) {} 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | out 4 | coverage 5 | test/**/dist 6 | test/**/actual.js 7 | yarn.lock 8 | pnpm-lock.yaml 9 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-disabled/node_modules/pkg/require-main.cjs: -------------------------------------------------------------------------------- 1 | import('pkg/asdf'); 2 | module.exports = 'require main'; 3 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed/node_modules/pkg/require-main.cjs: -------------------------------------------------------------------------------- 1 | import('pkg/asdf'); 2 | module.exports = 'require main'; 3 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-undefined/node_modules/pkg/require-main.cjs: -------------------------------------------------------------------------------- 1 | import('pkg/asdf'); 2 | module.exports = 'require main'; 3 | -------------------------------------------------------------------------------- /test/unit/dirname-emit/input.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const files = fs.readdirSync(__dirname); 3 | console.log(files); 4 | -------------------------------------------------------------------------------- /test/unit/path-sep/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/path-sep/asset.txt", 4 | "test/unit/path-sep/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/string-concat/input.js: -------------------------------------------------------------------------------- 1 | ['dep.js'].map(file => { 2 | const m = require('./lib/'.concat(file)); 3 | console.log(m); 4 | }) -------------------------------------------------------------------------------- /test/integration/fluent-ffmpeg.js: -------------------------------------------------------------------------------- 1 | const ffmpeg = require('fluent-ffmpeg'); 2 | const proc = new ffmpeg({ source: 'wat', nolog: true }); -------------------------------------------------------------------------------- /test/integration/geoip-lite.js: -------------------------------------------------------------------------------- 1 | const geoip = require('geoip-lite'); 2 | 3 | const ip = "207.97.227.239"; 4 | const geo = geoip.lookup(ip); -------------------------------------------------------------------------------- /test/integration/otel-api.js: -------------------------------------------------------------------------------- 1 | const { trace } = require('@opentelemetry/api'); 2 | 3 | void trace.getTracer('test').startSpan('test'); 4 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed2/node_modules/pkg/require-main.cjs: -------------------------------------------------------------------------------- 1 | import('pkg/asdf'); 2 | module.exports = 'require main'; 3 | -------------------------------------------------------------------------------- /test/unit/esm-dynamic-import/input.js: -------------------------------------------------------------------------------- 1 | async function main() { 2 | const { foo } = await import('./dep.js'); 3 | console.log(foo); 4 | } -------------------------------------------------------------------------------- /test/unit/esm-paths/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/esm-paths/esm-dep.js", 4 | "test/unit/esm-paths/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/import-meta-url/input.js: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | console.log(fs.readFileSync(new URL('./asset.txt', import.meta.url))); 3 | -------------------------------------------------------------------------------- /test/unit/microtime-node-gyp/input.js: -------------------------------------------------------------------------------- 1 | const microtime = require('microtime'); 2 | console.log('type of microtime is ' + typeof microtime); -------------------------------------------------------------------------------- /test/unit/path-sep/input.js: -------------------------------------------------------------------------------- 1 | const { sep } = require('path'); 2 | 3 | const X = sep; 4 | 5 | fs.readFileSync(__dirname + X + 'asset.txt'); -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/node_modules/.pnpm/parse5-htmlparser2-tree-adapter@6.0.1/node_modules/parse5: -------------------------------------------------------------------------------- 1 | ../../parse5@6.0.1/node_modules/parse5 -------------------------------------------------------------------------------- /test/integration/pixelmatch.js: -------------------------------------------------------------------------------- 1 | const pixelmatch = require('pixelmatch'); 2 | 3 | pixelmatch(new Uint8Array(), new Uint8Array(), null, 0, 0); -------------------------------------------------------------------------------- /test/unit/asset-package-json/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "test/unit/asset-package-json/input.js", 3 | "test/unit/asset-package-json/package.json" 4 | ] -------------------------------------------------------------------------------- /test/unit/class-static/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/class-static/asset.txt", 4 | "test/unit/class-static/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/mongoose/input.js: -------------------------------------------------------------------------------- 1 | const driver = global.MONGOOSE_DRIVER_PATH || './dir'; 2 | 3 | const Connection = require(driver + '/connection'); -------------------------------------------------------------------------------- /test/unit/mongoose/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/mongoose/dir/connection.js", 4 | "test/unit/mongoose/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/pixelmatch/input.js: -------------------------------------------------------------------------------- 1 | const pixelmatch = require('pixelmatch'); 2 | 3 | pixelmatch(new Uint8Array(), new Uint8Array(), null, 0, 0); -------------------------------------------------------------------------------- /test/unit/require-dot/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/require-dot/index.js", 4 | "test/unit/require-dot/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/resolve-from/input.js: -------------------------------------------------------------------------------- 1 | var resolveFrom = require('resolve-from'); 2 | var x = resolveFrom(__dirname, './dep.js'); 3 | require(x); 4 | -------------------------------------------------------------------------------- /test/unit/ts-path-join/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/ts-path-join/file.txt", 4 | "test/unit/ts-path-join/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/when-wrapper/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/when-wrapper/dep.js", 4 | "test/unit/when-wrapper/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/wildcard2/input.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | fs.readFileSync(path.join(__dirname, unknown) + '/asset1.txt'); 4 | 5 | -------------------------------------------------------------------------------- /test/unit/wildcard2/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/wildcard2/assets/asset1.txt", 4 | "test/unit/wildcard2/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/yarn-workspace-esm/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/integration/bcrypt.js: -------------------------------------------------------------------------------- 1 | const bcrypt = require('bcrypt'); 2 | bcrypt.hash('pass', 10).then(function(hash) { 3 | console.log(hash); 4 | }); 5 | -------------------------------------------------------------------------------- /test/unit/asset-fs-logical/input.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | console.log(fs.readFileSync(`${__dirname}/asset${unknown ? '1' : '2'}.txt`)); 3 | -------------------------------------------------------------------------------- /test/unit/asset-symlink/input.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | let moduleJsPath = path.join( 3 | __dirname, 4 | ".", 5 | "asset.txt" 6 | ); -------------------------------------------------------------------------------- /test/unit/dirname-len/input.js: -------------------------------------------------------------------------------- 1 | console.log(function (a, b) { 2 | return b.filter(function (c) { 3 | return __dirname.length; 4 | }); 5 | }); -------------------------------------------------------------------------------- /test/unit/import-assertions/input.js: -------------------------------------------------------------------------------- 1 | import foo from "./foo" 2 | import info from "./info.json" assert { type: "json" } 3 | 4 | export default info -------------------------------------------------------------------------------- /test/unit/import-attributes/input.js: -------------------------------------------------------------------------------- 1 | import foo from "./foo" 2 | import info from "./info.json" with { type: "json" } 3 | 4 | export default info -------------------------------------------------------------------------------- /test/unit/imports/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "test/unit/imports/input.js", 3 | "test/unit/imports/node.js", 4 | "test/unit/imports/package.json" 5 | ] -------------------------------------------------------------------------------- /test/unit/module-require/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/module-require/dep.js", 4 | "test/unit/module-require/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/string-concat/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/string-concat/input.js", 4 | "test/unit/string-concat/lib/dep.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/tsx/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/tsx/dep.tsx", 4 | "test/unit/tsx/input.js", 5 | "test/unit/tsx/lib.ts" 6 | ] -------------------------------------------------------------------------------- /test/unit/exports-path/node_modules/apollo-upload-client/public/ReactNativeFile.js: -------------------------------------------------------------------------------- 1 | module.exports = require('extract-files/public/ReactNativeFile'); 2 | -------------------------------------------------------------------------------- /test/unit/multi-input/child-3.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | const { join } = require('path') 3 | 4 | fs.readFileSync(join(__dirname, 'asset.txt')) 5 | -------------------------------------------------------------------------------- /test/unit/phantomjs-prebuilt/input.js: -------------------------------------------------------------------------------- 1 | const phantom = require('phantomjs-prebuilt'); 2 | console.log('type of phantomjs-prebuilt is ' + typeof phantom); -------------------------------------------------------------------------------- /test/unit/require-wrapper/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/require-wrapper/dep.js", 4 | "test/unit/require-wrapper/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/require-wrapper2/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/require-wrapper2/dep.js", 4 | "test/unit/require-wrapper2/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/require-wrapper3/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/require-wrapper3/dep.js", 4 | "test/unit/require-wrapper3/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/return-emission/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/return-emission/asset.txt", 4 | "test/unit/return-emission/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/top-level-await/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/top-level-await/input.js", 4 | "test/unit/top-level-await/module.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/webpack-wrapper/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/webpack-wrapper/asset.txt", 4 | "test/unit/webpack-wrapper/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/asset-fs-inlining/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-fs-inlining/asset.txt", 4 | "test/unit/asset-fs-inlining/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/browser-remappings-string/node_modules/pkg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pkg", 3 | "main": "index.js", 4 | "browser": "./browser.js" 5 | } 6 | -------------------------------------------------------------------------------- /test/unit/import-meta-url/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/import-meta-url/asset.txt", 4 | "test/unit/import-meta-url/input.js" 5 | ] 6 | -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/node_modules/parse5-htmlparser2-tree-adapter: -------------------------------------------------------------------------------- 1 | .pnpm/parse5-htmlparser2-tree-adapter@6.0.1/node_modules/parse5-htmlparser2-tree-adapter -------------------------------------------------------------------------------- /test/unit/webpack-node/input.js: -------------------------------------------------------------------------------- 1 | const page = require('./level1/level2/level3/page') 2 | 3 | console.log(`${page.getChunk('a')} ${page.getChunk('c')}`) 4 | -------------------------------------------------------------------------------- /test/unit/wildcard-require/input.js: -------------------------------------------------------------------------------- 1 | const num = Math.ceil(Math.random() * 3, 0); 2 | 3 | const m = require(`./modules/module${num}`); 4 | console.log(m); 5 | -------------------------------------------------------------------------------- /test/integration/esm.js: -------------------------------------------------------------------------------- 1 | require = require('esm')(module); 2 | const assert = require('assert'); 3 | assert.equal(require('../fixtures/es-module.js').p, 5); 4 | -------------------------------------------------------------------------------- /test/unit/asset-node-require/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-node-require/input.js", 4 | "test/unit/asset-node-require/mock.node" 5 | ] -------------------------------------------------------------------------------- /test/unit/esm-paths-trailer/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/esm-paths-trailer/esm-dep.js", 4 | "test/unit/esm-paths-trailer/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/multi-input/child-4.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | const { join } = require('path') 3 | 4 | fs.readFileSync(join(__dirname, 'style.module.css')) 5 | -------------------------------------------------------------------------------- /test/unit/require-dirname-tpl/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/require-dirname-tpl/dep.js", 4 | "test/unit/require-dirname-tpl/input.js" 5 | ] -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Documentation 2 | # https://help.github.com/en/articles/about-code-owners 3 | 4 | * @ijjk @styfle @vercel/vercel-cli-admins 5 | -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-tpl/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-fs-inline-tpl/asset.txt", 4 | "test/unit/asset-fs-inline-tpl/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/dirname-emit-concat/input.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | fs.promises.readdir(__dirname + '/assets').then(files => { 3 | console.log(files); 4 | }) 5 | -------------------------------------------------------------------------------- /test/unit/jsonc-parser-wrapper/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/jsonc-parser-wrapper/dep.js", 4 | "test/unit/jsonc-parser-wrapper/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/webpack-wrapper-name/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/webpack-wrapper-name/input.js", 4 | "test/unit/webpack-wrapper-name/mangled.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/webpack-wrapper-null/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/webpack-wrapper-null/input.js", 4 | "test/unit/webpack-wrapper-null/mangled.js" 5 | ] -------------------------------------------------------------------------------- /test/integration/google-bigquery.js: -------------------------------------------------------------------------------- 1 | const {BigQuery} = require('@google-cloud/bigquery'); 2 | 3 | const bigquery = new BigQuery({ 4 | projectId: 'PROJECT_ID', 5 | }); 6 | -------------------------------------------------------------------------------- /test/unit/asset-fs-array-expr/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-fs-array-expr/asset1.txt", 4 | "test/unit/asset-fs-array-expr/input.js" 5 | ] 6 | -------------------------------------------------------------------------------- /test/unit/asset-package-json/input.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | 3 | var binding_path = 4 | binary.find(path.resolve(path.join(__dirname, './package.json'))); -------------------------------------------------------------------------------- /test/unit/basic-analysis-require/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/basic-analysis-require/dep.js", 4 | "test/unit/basic-analysis-require/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/browserify/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/browserify/dep1.js", 4 | "test/unit/browserify/dep2.js", 5 | "test/unit/browserify/input.js" 6 | ] -------------------------------------------------------------------------------- /test/unit/dirname-emit-concat/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/dirname-emit-concat/assets/file.txt", 4 | "test/unit/dirname-emit-concat/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/dot-dot/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/dot-dot/dir/dot-dot-req.js", 4 | "test/unit/dot-dot/index.js", 5 | "test/unit/dot-dot/input.js" 6 | ] -------------------------------------------------------------------------------- /test/unit/file-folder-slash/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/file-folder-slash/file-folder/index.js", 4 | "test/unit/file-folder-slash/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/module-create-require/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/module-create-require/input.js", 4 | "test/unit/module-create-require/lib.node" 5 | ] -------------------------------------------------------------------------------- /test/unit/non-analyzable-requires/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/non-analyzable-requires/dep.js", 4 | "test/unit/non-analyzable-requires/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/process-env/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/process-env/a.js", 4 | "test/unit/process-env/b.js", 5 | "test/unit/process-env/input.js" 6 | ] -------------------------------------------------------------------------------- /test/unit/require-var-branch/input.js: -------------------------------------------------------------------------------- 1 | var libPath = process.env['CREATESEND_NODE_COV'] ? './lib1' : './lib2'; 2 | 3 | module.exports = require(libPath + '/createsend'); 4 | -------------------------------------------------------------------------------- /test/unit/webpack-wrapper-multi/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/webpack-wrapper-multi/asset.txt", 4 | "test/unit/webpack-wrapper-multi/input.js" 5 | ] -------------------------------------------------------------------------------- /test/integration/sequelize.js: -------------------------------------------------------------------------------- 1 | const Sequelize = require('sequelize'); 2 | 3 | const db = new Sequelize({ 4 | dialect: 'mariadb', 5 | dialectModule: require('mariadb') 6 | }); -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-enc-es-3/input.js: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | import { join } from 'path'; 3 | 4 | console.log(fs.readFileSync(join(__dirname, 'asset.txt'), 'utf8')); -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-ts/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-fs-inline-path-ts/asset.txt", 4 | "test/unit/asset-fs-inline-path-ts/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/module-create-require/input.js: -------------------------------------------------------------------------------- 1 | import * as module from 'node:module'; 2 | 3 | const req = module.createRequire(import.meta.url); 4 | const lib = req('./lib.node'); -------------------------------------------------------------------------------- /test/unit/require-dynamic-fallback/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/require-dynamic-fallback/dep.js", 4 | "test/unit/require-dynamic-fallback/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/yarn-workspace-esm/packages/common/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@example/common", 3 | "version": "1.0.0", 4 | "main": "hello.js", 5 | "type": "module" 6 | } 7 | -------------------------------------------------------------------------------- /test/unit/asset-conditional/input.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | let moduleJsPath = path.join( 3 | __dirname, 4 | ".", 5 | isHarmony ? "asset1.txt" : "asset2.txt" 6 | ); -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-enc-es-2/input.js: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | import path from 'path'; 3 | 4 | console.log(fs.readFileSync(path.join(__dirname, 'asset.txt'), 'utf8')); -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-enc-es-5/input.js: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | import { join } from 'path'; 3 | 4 | console.log(fs.readFileSync(join(__dirname, 'asset.txt'), 'utf8')); 5 | -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-enc-es/input.js: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | import * as path from 'path'; 3 | 4 | console.log(fs.readFileSync(path.join(__dirname, 'asset.txt'), 'utf8')); -------------------------------------------------------------------------------- /test/unit/browser-remappings-false/node_modules/pkg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pkg", 3 | "main": "index.js", 4 | "browser": { 5 | "./browser.js": false 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/unit/esm-export-wildcard/week.js: -------------------------------------------------------------------------------- 1 | export const mon = 'mon'; 2 | export const tue = 'tues'; 3 | export const wed = 'wed'; 4 | export const thu = 'thu'; 5 | export const fri = 'fri'; -------------------------------------------------------------------------------- /test/unit/exports-nomodule/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "test/unit/exports-nomodule/input.js", 3 | "test/unit/exports-nomodule/node.js", 4 | "test/unit/exports-nomodule/package.json" 5 | ] -------------------------------------------------------------------------------- /test/unit/exports-wildcard/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "test/unit/exports-wildcard/input.js", 3 | "test/unit/exports-wildcard/node.js", 4 | "test/unit/exports-wildcard/package.json" 5 | ] -------------------------------------------------------------------------------- /test/unit/fs-emission/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/fs-emission/asset2.txt", 4 | "test/unit/fs-emission/asset3.txt", 5 | "test/unit/fs-emission/input.js" 6 | ] -------------------------------------------------------------------------------- /test/unit/multi-input/child-1.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | const { join } = require('path') 3 | 4 | require('./input-2') 5 | 6 | fs.readFileSync(join(__dirname, 'asset.txt')) 7 | -------------------------------------------------------------------------------- /test/unit/resolve-hook/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "custom-resolution-./local-dep", 3 | "custom-resolution-external-dep", 4 | "package.json", 5 | "test/unit/resolve-hook/input.js" 6 | ] -------------------------------------------------------------------------------- /test/unit/yarn-workspace-esm/packages/web/index.js: -------------------------------------------------------------------------------- 1 | import { hello } from '@example/common'; 2 | 3 | export default function handler() { 4 | console.log(hello('world')); 5 | } 6 | -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-babel/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-fs-inline-path-babel/asset.txt", 4 | "test/unit/asset-fs-inline-path-babel/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-enc-es/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-fs-inline-path-enc-es/asset.txt", 4 | "test/unit/asset-fs-inline-path-enc-es/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-shadow/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-fs-inline-path-shadow/asset.txt", 4 | "test/unit/asset-fs-inline-path-shadow/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/esm-dynamic-import/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "test/unit/esm-dynamic-import/dep.js", 3 | "test/unit/esm-dynamic-import/input.js", 4 | "test/unit/esm-dynamic-import/package.json" 5 | ] -------------------------------------------------------------------------------- /test/unit/module-register/node_modules/test-pkg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-pkg", 3 | "main": "./index.mjs", 4 | "exports":{ 5 | ".": "./index.mjs" 6 | } 7 | } -------------------------------------------------------------------------------- /test/unit/asset-fs-inlining-multi/input.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | console.log(fs.readFileSync(__dirname + '/asset.txt')); 3 | console.log(fs.readFileSync(__dirname + '/sub/asset.txt')); -------------------------------------------------------------------------------- /test/unit/asset-symlink/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-symlink/asset.txt", 4 | "test/unit/asset-symlink/asset1.txt", 5 | "test/unit/asset-symlink/input.js" 6 | ] -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-enc-es-2/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-fs-inline-path-enc-es-2/asset.txt", 4 | "test/unit/asset-fs-inline-path-enc-es-2/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-enc-es-3/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-fs-inline-path-enc-es-3/asset.txt", 4 | "test/unit/asset-fs-inline-path-enc-es-3/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-enc-es-4/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-fs-inline-path-enc-es-4/asset.txt", 4 | "test/unit/asset-fs-inline-path-enc-es-4/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-enc-es-5/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-fs-inline-path-enc-es-5/asset.txt", 4 | "test/unit/asset-fs-inline-path-enc-es-5/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-enc-es-node-prefix/input.js: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | import * as path from 'path'; 3 | 4 | console.log(fs.readFileSync(path.join(__dirname, 'asset.txt'), 'utf8')); -------------------------------------------------------------------------------- /test/unit/module-require/input.js: -------------------------------------------------------------------------------- 1 | function x (module) { 2 | } 3 | 4 | exports.asdf = 'asdf'; 5 | console.log(module.require('./dep.js')); 6 | 7 | if (module.require) 8 | console.log("yes"); 9 | -------------------------------------------------------------------------------- /test/unit/pkginfo/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "node_modules/pkginfo/lib/pkginfo.js", 3 | "node_modules/pkginfo/package.json", 4 | "test/unit/pkginfo/input.js", 5 | "test/unit/pkginfo/package.json" 6 | ] -------------------------------------------------------------------------------- /test/unit/process-cwd/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/process-cwd/_posts/first.md", 4 | "test/unit/process-cwd/_posts/second.md", 5 | "test/unit/process-cwd/input.js" 6 | ] -------------------------------------------------------------------------------- /test/unit/require-symlink/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/require-symlink/another.js", 4 | "test/unit/require-symlink/input.js", 5 | "test/unit/require-symlink/symlink" 6 | ] -------------------------------------------------------------------------------- /test/unit/ts-input-esm/dep1.ts: -------------------------------------------------------------------------------- 1 | async function start() { 2 | const { dep2 } = await import('./dep2.js'); 3 | return dep2; 4 | } 5 | 6 | start(); 7 | 8 | export const dep1 = 'dep1'; 9 | -------------------------------------------------------------------------------- /test/unit/yarn-workspace-esm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "type": "module", 4 | "workspaces": { 5 | "packages": [ 6 | "packages/*" 7 | ] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './types'; 2 | export { nodeFileTrace } from './node-file-trace'; 3 | import resolveDependency from './resolve-dependency'; 4 | export { resolveDependency as resolve }; 5 | -------------------------------------------------------------------------------- /test/integration/pdfkit.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const PDFDocument = require("pdfkit"); 3 | 4 | const doc = new PDFDocument(); 5 | doc.fontSize(15).text("Hi there", 50, 50); 6 | doc.end(); 7 | -------------------------------------------------------------------------------- /test/unit/asset-fs-logical/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-fs-logical/asset1.txt", 4 | "test/unit/asset-fs-logical/asset2.txt", 5 | "test/unit/asset-fs-logical/input.js" 6 | ] -------------------------------------------------------------------------------- /test/unit/browserify-minify/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "node_modules/acorn/dist/acorn.js", 3 | "node_modules/acorn/package.json", 4 | "package.json", 5 | "test/unit/browserify-minify/input.js" 6 | ] 7 | -------------------------------------------------------------------------------- /test/unit/browserify-uglify/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/browserify-uglify/dep1.js", 4 | "test/unit/browserify-uglify/dep2.js", 5 | "test/unit/browserify-uglify/input.js" 6 | ] -------------------------------------------------------------------------------- /test/unit/ffmpeg-installer/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/ffmpeg-installer/ffmpeg.exe", 4 | "test/unit/ffmpeg-installer/ffmpeg.js", 5 | "test/unit/ffmpeg-installer/input.js" 6 | ] -------------------------------------------------------------------------------- /test/unit/webpack-5-wrapper-namespace/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/webpack-5-wrapper-namespace/assets/dictionary.json", 4 | "test/unit/webpack-5-wrapper-namespace/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/webpack-wrapper-dirname-inject/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/webpack-wrapper-dirname-inject/input.js", 4 | "test/unit/webpack-wrapper-dirname-inject/schema.prisma" 5 | ] -------------------------------------------------------------------------------- /test/unit/wildcard3/input.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | const num = Math.ceil(Math.random() * 3); 4 | 5 | fs.readFileSync(path.join(__dirname, 'assets', 'asset') + num + '.txt'); 6 | 7 | -------------------------------------------------------------------------------- /test/integration/uglify.js: -------------------------------------------------------------------------------- 1 | const UglifyJS = require('uglify-js') 2 | const code = 'function add(first, second) { return first + second; }' 3 | const result = UglifyJS.minify(code) 4 | console.log(result) 5 | -------------------------------------------------------------------------------- /test/unit/array-emission/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/array-emission/input.js", 4 | "test/unit/array-emission/renderer/dom.js", 5 | "test/unit/array-emission/renderer/util.js" 6 | ] -------------------------------------------------------------------------------- /test/unit/asset-conditional/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-conditional/asset1.txt", 4 | "test/unit/asset-conditional/asset2.txt", 5 | "test/unit/asset-conditional/input.js" 6 | ] -------------------------------------------------------------------------------- /test/unit/asset-fs-array-expr-node-prefix/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-fs-array-expr-node-prefix/asset1.txt", 4 | "test/unit/asset-fs-array-expr-node-prefix/input.js" 5 | ] 6 | -------------------------------------------------------------------------------- /test/unit/asset-fs-extra/input.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs-extra"); 2 | 3 | console.log(fs.readFileSync(`${process.cwd()}/asset1.txt`)); 4 | console.log(fs.readJsonSync(process.cwd() + "/asset2.json")); 5 | -------------------------------------------------------------------------------- /test/unit/esm-export-wildcard/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/esm-export-wildcard/all.js", 4 | "test/unit/esm-export-wildcard/input.js", 5 | "test/unit/esm-export-wildcard/week.js" 6 | ] -------------------------------------------------------------------------------- /test/unit/import-assertions/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/import-assertions/foo.js", 4 | "test/unit/import-assertions/info.json", 5 | "test/unit/import-assertions/input.js" 6 | ] 7 | -------------------------------------------------------------------------------- /test/unit/import-attributes/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/import-attributes/foo.js", 4 | "test/unit/import-attributes/info.json", 5 | "test/unit/import-attributes/input.js" 6 | ] 7 | -------------------------------------------------------------------------------- /test/unit/multi-input/child-2.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | const { join } = require('path') 3 | 4 | fs.readFileSync(join(__dirname, 'asset.txt')) 5 | fs.readFileSync(join(__dirname, 'asset-2.txt')) 6 | -------------------------------------------------------------------------------- /test/unit/protobuf-loop/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/protobuf-loop/assets/asset1.txt", 4 | "test/unit/protobuf-loop/assets/asset2.txt", 5 | "test/unit/protobuf-loop/input.js" 6 | ] -------------------------------------------------------------------------------- /test/unit/ts-filter/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/ts-filter/input.js", 4 | "test/unit/ts-filter/node_modules/pkg/index.js", 5 | "test/unit/ts-filter/node_modules/pkg/index.ts" 6 | ] -------------------------------------------------------------------------------- /test/integration/mysql.js: -------------------------------------------------------------------------------- 1 | const mysql = require("mysql"); 2 | 3 | var connection = mysql.createConnection({ 4 | host: "localhost", 5 | user: "me", 6 | password: "secret", 7 | database: "my_db" 8 | }); 9 | -------------------------------------------------------------------------------- /test/integration/twilio.js: -------------------------------------------------------------------------------- 1 | const twilio = require("twilio"); 2 | try { 3 | twilio(); 4 | } catch (err) { 5 | if (!/username is required/.test(err.message)) { 6 | throw err; 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-enc-es-4/input.js: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | import * as path from 'path'; 3 | 4 | const join = path.join; 5 | 6 | console.log(fs.readFileSync(join(__dirname, 'asset.txt'), 'utf8')); -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-ts-no-interop/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-fs-inline-path-ts-no-interop/asset.txt", 4 | "test/unit/asset-fs-inline-path-ts-no-interop/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/asset-graceful-fs/input.js: -------------------------------------------------------------------------------- 1 | const fs = require("graceful-fs"); 2 | 3 | console.log(fs.readFileSync(`${process.cwd()}/asset.txt`)); 4 | console.log(fs.readFileSync(process.cwd() + "/sub/asset.txt")); 5 | -------------------------------------------------------------------------------- /test/unit/mixed-esm-cjs/input.js: -------------------------------------------------------------------------------- 1 | const { dep1 } = require('./commonjs-module'); 2 | import { dep2 } from './ecmascript-module'; 3 | 4 | if (dep1 && dep2) { 5 | console.log(dep1); 6 | console.log(dep2); 7 | } -------------------------------------------------------------------------------- /test/unit/mixed-esm-cjs/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/mixed-esm-cjs/commonjs-module.js", 4 | "test/unit/mixed-esm-cjs/ecmascript-module.js", 5 | "test/unit/mixed-esm-cjs/input.js" 6 | ] -------------------------------------------------------------------------------- /test/unit/non-analyzable-requires/input.js: -------------------------------------------------------------------------------- 1 | // analyzable: 2 | require('./dep'); 3 | 4 | // non-analyzable: 5 | var s = { 6 | require 7 | }; 8 | s.require('./ignored.js'); 9 | require(escaped); 10 | -------------------------------------------------------------------------------- /test/unit/protobuf-loop2/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/protobuf-loop2/assets/asset1.txt", 4 | "test/unit/protobuf-loop2/assets/asset2.txt", 5 | "test/unit/protobuf-loop2/input.js" 6 | ] -------------------------------------------------------------------------------- /test/unit/ts-input-esm/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "test/unit/ts-input-esm/dep1.ts", 3 | "test/unit/ts-input-esm/dep2.ts", 4 | "test/unit/ts-input-esm/input.ts", 5 | "test/unit/ts-input-esm/package.json" 6 | ] 7 | -------------------------------------------------------------------------------- /test/unit/webpack-wrapper-strs-namespaces/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/webpack-wrapper-strs-namespaces/assets/dictionary.json", 4 | "test/unit/webpack-wrapper-strs-namespaces/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/wildcard/input.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | fs.readFileSync(path.join(__dirname, 'assets', unknown) + '.txt'); 4 | fs.readFileSync(path.join(__dirname, 'assets', ...unknown) + '.txt'); 5 | -------------------------------------------------------------------------------- /test/unit/yarn-workspace-esm/packages/web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@example/web", 3 | "version": "2.0.0", 4 | "type": "module", 5 | "dependencies": { 6 | "@example/common": "1.0.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/unit/asset-fs-array-expr/input.js: -------------------------------------------------------------------------------- 1 | const { spawn } = require('child_process'); 2 | const { join } = require('path'); 3 | 4 | const child = spawn('gifsicle', ['--colors', '256', join(__dirname, './asset1.txt')]); 5 | -------------------------------------------------------------------------------- /test/unit/import-meta-tpl-cnd/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/import-meta-tpl-cnd/asset1.txt", 4 | "test/unit/import-meta-tpl-cnd/asset2.txt", 5 | "test/unit/import-meta-tpl-cnd/input.js" 6 | ] 7 | -------------------------------------------------------------------------------- /test/integration/semver.js: -------------------------------------------------------------------------------- 1 | const semver = require('semver'); 2 | 3 | const v1 = '1.0.0'; 4 | const v2 = '2.0.0'; 5 | 6 | semver.gt(v1, v2); 7 | semver.lt(v1, v2); 8 | semver.eq(v1, v2); 9 | semver.coerce(v1); 10 | -------------------------------------------------------------------------------- /test/unit/amd-disable/input.js: -------------------------------------------------------------------------------- 1 | if (typeof define === 'function' && define.amd) 2 | define(function (require) { 3 | require('amd'); 4 | require('deps'); 5 | require('shouldnt'); 6 | require('detect'); 7 | }); -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-enc-es-node-prefix/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-fs-inline-path-enc-es-node-prefix/asset.txt", 4 | "test/unit/asset-fs-inline-path-enc-es-node-prefix/input.js" 5 | ] -------------------------------------------------------------------------------- /test/unit/require-var-branch/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/require-var-branch/input.js", 4 | "test/unit/require-var-branch/lib1/createsend.js", 5 | "test/unit/require-var-branch/lib2/createsend.js" 6 | ] -------------------------------------------------------------------------------- /test/integration/highlights.js: -------------------------------------------------------------------------------- 1 | const Highlights = require('highlights'); 2 | const highlighter = new Highlights(); 3 | highlighter.highlightSync({ 4 | fileContents: 'var hello = "world";', 5 | scopeName: 'source.js' 6 | }); 7 | -------------------------------------------------------------------------------- /test/unit/asset-fs-inlining-multi/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/asset-fs-inlining-multi/asset.txt", 4 | "test/unit/asset-fs-inlining-multi/input.js", 5 | "test/unit/asset-fs-inlining-multi/sub/asset.txt" 6 | ] -------------------------------------------------------------------------------- /test/unit/dirname-emit/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/dirname-emit/asset.txt", 4 | "test/unit/dirname-emit/input.js", 5 | "test/unit/dirname-emit/output.js", 6 | "test/unit/dirname-emit/subdir/file.txt" 7 | ] -------------------------------------------------------------------------------- /test/unit/esm/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "node_modules/esm/esm.js", 3 | "node_modules/esm/esm/loader.js", 4 | "node_modules/esm/package.json", 5 | "package.json", 6 | "test/unit/esm/esm-dep.js", 7 | "test/unit/esm/input.js" 8 | ] -------------------------------------------------------------------------------- /test/unit/resolve-from/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "node_modules/resolve-from/index.js", 3 | "node_modules/resolve-from/package.json", 4 | "package.json", 5 | "test/unit/resolve-from/dep.js", 6 | "test/unit/resolve-from/input.js" 7 | ] -------------------------------------------------------------------------------- /test/unit/wildcard/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/wildcard/assets/asset1.txt", 4 | "test/unit/wildcard/assets/asset2.txt", 5 | "test/unit/wildcard/assets/asset3.txt", 6 | "test/unit/wildcard/input.js" 7 | ] -------------------------------------------------------------------------------- /test/unit/wildcard3/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/wildcard3/assets/asset1.txt", 4 | "test/unit/wildcard3/assets/asset2.txt", 5 | "test/unit/wildcard3/assets/asset3.txt", 6 | "test/unit/wildcard3/input.js" 7 | ] -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | out 3 | dist 4 | coverage 5 | test/**/dist 6 | test/**/actual.js 7 | test/ecmascript 8 | test/fixtures 9 | test/integration 10 | test/unit 11 | package-lock.json 12 | yarn.lock 13 | pnpm-lock.yaml 14 | -------------------------------------------------------------------------------- /test/integration/cowsay.js: -------------------------------------------------------------------------------- 1 | const { say } = require("cowsay"); 2 | 3 | const nate = say({ text: "nate" }); 4 | if (!(nate.indexOf("nate") > 0)) { 5 | throw new Error('cowsay did not work. String "nate" not found in: ' + nate); 6 | } 7 | 8 | -------------------------------------------------------------------------------- /test/unit/asset-fs-array-expr-node-prefix/input.js: -------------------------------------------------------------------------------- 1 | const { spawn } = require('node:child_process'); 2 | const { join } = require('node:path'); 3 | 4 | const child = spawn('gifsicle', ['--colors', '256', join(__dirname, './asset1.txt')]); 5 | -------------------------------------------------------------------------------- /test/unit/glob-dot/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/glob-dot/input.js", 4 | "test/unit/glob-dot/output.js", 5 | "test/unit/glob-dot/with-dot/.dot/first.txt", 6 | "test/unit/glob-dot/without-dot/normal/first.txt" 7 | ] -------------------------------------------------------------------------------- /test/unit/import-meta-tpl-cnd/input.js: -------------------------------------------------------------------------------- 1 | import { readFileSync } from 'fs'; 2 | import { fileURLToPath } from 'url'; 3 | 4 | console.log(readFileSync(fileURLToPath(`${import.meta.url}/../${unknown ? 'asset1.txt' : 'asset2.txt'}`)).toString()); -------------------------------------------------------------------------------- /test/unit/imports/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "x", 3 | "type": "module", 4 | "imports": { 5 | "#x": { 6 | "module": "./no.js", 7 | "default": { 8 | "node": "./node.js" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/unit/exports-nomodule/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "x", 3 | "type": "module", 4 | "exports": { 5 | ".": { 6 | "module": "./no.js", 7 | "default": { 8 | "node": "./node.js" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/unit/exports-wildcard/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "y", 3 | "type": "module", 4 | "exports": { 5 | "./*": { 6 | "module": "./*.js", 7 | "default": { 8 | "node": "./*de.js" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/unit/ts-filter/input.js: -------------------------------------------------------------------------------- 1 | const { join } = require('path'); 2 | require('pkg'); 3 | 4 | // asset reference to ts file in node_modules 5 | // should not cause ts file to be compiled 6 | fs.readFileSync(join(__dirname, 'node_modules', 'pkg', 'index.ts')); -------------------------------------------------------------------------------- /test/unit/webpack-node/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/webpack-node/input.js", 4 | "test/unit/webpack-node/level1/a.b.js", 5 | "test/unit/webpack-node/level1/c.d.js", 6 | "test/unit/webpack-node/level1/level2/level3/page.js" 7 | ] -------------------------------------------------------------------------------- /test/integration/pdf2json.js: -------------------------------------------------------------------------------- 1 | const { parse } = require('url') 2 | const PDFParser = require('pdf2json') 3 | 4 | module.exports = (req, res) => { 5 | const { query } = parse(req.url, true) 6 | const { name = 'World' } = query 7 | res.end(`Hello ${name}!`) 8 | } -------------------------------------------------------------------------------- /test/integration/socket.io.js: -------------------------------------------------------------------------------- 1 | const http = require('http') 2 | const io = require('socket.io') 3 | const opts = { port: 3000 } 4 | const server = http.createServer((req, res) => {}); 5 | server.listen(opts.port) 6 | setTimeout(() => { 7 | process.exit(); 8 | }, 100); -------------------------------------------------------------------------------- /test/unit/prisma-photon/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/prisma-photon/input.js", 4 | "test/unit/prisma-photon/node_modules/@generated/photon/index.js", 5 | "test/unit/prisma-photon/node_modules/@generated/photon/runtime/query-engine-darwin" 6 | ] -------------------------------------------------------------------------------- /test/unit/array-emission/input.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const fs = require('fs'); 4 | 5 | const REPORT_JAVASCRIPT = [ 6 | fs.readFileSync(__dirname + '/renderer/util.js', 'utf8'), 7 | fs.readFileSync(__dirname + '/renderer/dom.js', 'utf8'), 8 | ].join(';\n'); 9 | -------------------------------------------------------------------------------- /test/unit/ts-input-esm/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "module": "esnext", 5 | "lib": ["esnext"], 6 | "moduleResolution": "node", 7 | "esModuleInterop": true, 8 | "strict": true 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/integration/remark-prism.mjs: -------------------------------------------------------------------------------- 1 | import { unified } from 'unified'; 2 | import parse from 'remark-parse'; 3 | import prism from 'remark-prism'; 4 | 5 | const engine = unified().use(parse).use(prism); 6 | const ast = engine.parse('# markdown'); 7 | engine.runSync(ast); 8 | -------------------------------------------------------------------------------- /test/unit/when-wrapper/input.js: -------------------------------------------------------------------------------- 1 | (function (define) { 2 | 'use strict'; 3 | define(function (require) { 4 | require('./dep.js'); 5 | }); 6 | }) 7 | (typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }) 8 | -------------------------------------------------------------------------------- /test/unit/wildcard-require/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/wildcard-require/input.js", 4 | "test/unit/wildcard-require/modules/module1.js", 5 | "test/unit/wildcard-require/modules/module2.js", 6 | "test/unit/wildcard-require/modules/module3.js" 7 | ] -------------------------------------------------------------------------------- /test/integration/auth0.js: -------------------------------------------------------------------------------- 1 | const ManagementClient = require("auth0").ManagementClient; 2 | 3 | try { 4 | new ManagementClient(); 5 | } catch (err) { 6 | if (!/Management API SDK options must be an object/.test(err.message)) { 7 | throw err; 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /test/unit/processed-dependency/output-cached.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/processed-dependency/child-2.js", 4 | "test/unit/processed-dependency/child.js", 5 | "test/unit/processed-dependency/input-cached.js", 6 | "test/unit/processed-dependency/parent-2.js" 7 | ] -------------------------------------------------------------------------------- /test/integration/sharp.js: -------------------------------------------------------------------------------- 1 | const sharp = require('sharp'); 2 | 3 | const roundedCorners = Buffer.from( 4 | '' 5 | ); 6 | 7 | sharp(roundedCorners) 8 | .resize(200, 200) 9 | .png().toBuffer(); 10 | -------------------------------------------------------------------------------- /test/unit/class-static/input.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | 3 | class X extends Object { 4 | constructor() { 5 | } 6 | static(patterns, options) { 7 | } 8 | static realStatic () { 9 | 10 | } 11 | } 12 | 13 | fs.readFileSync(__dirname + '/asset.txt'); 14 | -------------------------------------------------------------------------------- /test/unit/fs-emission/input.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | 3 | fs.readFile('./asset1.txt') 4 | 5 | fs.readFile(require.resolve('./asset2.txt')) 6 | 7 | const _basePath = __dirname; 8 | const asset3 = 'asset3.txt'; 9 | fs.readFileSync(_basePath + '/' + asset3, 'utf8'); 10 | -------------------------------------------------------------------------------- /test/unit/require-wrapper/input.js: -------------------------------------------------------------------------------- 1 | const reaction = name => { 2 | const res = require(name); 3 | res.name = name.split('/').pop(); 4 | return res; 5 | }; 6 | 7 | const reactions = { 8 | repository: { 9 | publicized: reaction('./dep') 10 | } 11 | }; 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/integration/react.js: -------------------------------------------------------------------------------- 1 | const React = require("react"); 2 | const { renderToString } = require("react-dom/server"); 3 | 4 | const html = renderToString(React.createElement("h1")); 5 | if (html !== '

') { 6 | throw new Error("Bad react SSR: " + html); 7 | } 8 | -------------------------------------------------------------------------------- /test/integration/sharp-pnpm.js: -------------------------------------------------------------------------------- 1 | const sharp = require('sharp'); 2 | 3 | const roundedCorners = Buffer.from( 4 | '' 5 | ); 6 | 7 | sharp(roundedCorners) 8 | .resize(200, 200) 9 | .png().toBuffer(); 10 | -------------------------------------------------------------------------------- /test/integration/vue.js: -------------------------------------------------------------------------------- 1 | const Vue = require("vue"); 2 | const renderer = require("vue-server-renderer").createRenderer(); 3 | 4 | const app = new Vue({ 5 | data: () => ({ date: Date.now() }), 6 | template: `
Hello World {{ date }}
` 7 | }); 8 | renderer.renderToString(app); 9 | -------------------------------------------------------------------------------- /test/unit/require-wrapper2/input.js: -------------------------------------------------------------------------------- 1 | function reaction (name) { 2 | const res = require(name); 3 | res.name = name.split('/').pop(); 4 | return res; 5 | }; 6 | 7 | const reactions = { 8 | repository: { 9 | publicized: reaction('./dep') 10 | } 11 | }; 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/unit/require-wrapper3/input.js: -------------------------------------------------------------------------------- 1 | const reaction = (name) => { 2 | const res = require(name); 3 | res.name = name.split('/').pop(); 4 | return res; 5 | }; 6 | 7 | const reactions = { 8 | repository: { 9 | publicized: reaction('./dep') 10 | } 11 | }; 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/integration/axios.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | 3 | (async () => { 4 | const { status } = await axios({ 5 | url: "https://example.vercel.sh" 6 | }); 7 | if (status !== 200) { 8 | throw new Error("Unexpected response: " + JSON.stringify(data)); 9 | } 10 | })(); 11 | -------------------------------------------------------------------------------- /test/unit/exports-fallback/node_modules/pkg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pkg", 3 | "exports": { 4 | ".": ["in:valid", { 5 | "node": { 6 | "import": "./subdir/import-main.js", 7 | "require": "./require-main.cjs" 8 | } 9 | }, "./index.js"] 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/unit/exports-fallback/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/exports-fallback/input.js", 4 | "test/unit/exports-fallback/node_modules/pkg/index.js", 5 | "test/unit/exports-fallback/node_modules/pkg/package.json", 6 | "test/unit/exports-fallback/node_modules/pkg/require-main.cjs" 7 | ] -------------------------------------------------------------------------------- /test/integration/rxjs.js: -------------------------------------------------------------------------------- 1 | const { Observable, Subject, ReplaySubject, from, of, range } = require("rxjs"); 2 | const { map, filter, switchMap } = require("rxjs/operators"); 3 | 4 | range(1, 200) 5 | .pipe( 6 | filter(x => x % 2 === 1), 7 | map(x => x + x) 8 | ) 9 | .subscribe(x => x); 10 | -------------------------------------------------------------------------------- /test/unit/glob-dot/input.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | 3 | const dotFiles = fs.readdirSync( 4 | __dirname, 5 | 'with-dot' 6 | ) 7 | 8 | const nonDotFiles = fs.readdirSync( 9 | __dirname, 10 | 'without-dot' 11 | ) 12 | 13 | console.log({ 14 | dotFiles, 15 | nonDotFiles 16 | }); 17 | -------------------------------------------------------------------------------- /test/unit/processed-dependency/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/processed-dependency/child-2.js", 4 | "test/unit/processed-dependency/child.js", 5 | "test/unit/processed-dependency/input.js", 6 | "test/unit/processed-dependency/parent-1.js", 7 | "test/unit/processed-dependency/parent-2.js" 8 | ] -------------------------------------------------------------------------------- /test/unit/yarn-workspaces/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/yarn-workspaces/input.js", 4 | "test/unit/yarn-workspaces/node_modules/x", 5 | "test/unit/yarn-workspaces/packages/x/dep.js", 6 | "test/unit/yarn-workspaces/packages/x/main.ts", 7 | "test/unit/yarn-workspaces/packages/x/package.json" 8 | ] -------------------------------------------------------------------------------- /test/integration/playwright-core.js: -------------------------------------------------------------------------------- 1 | const playwright = require('playwright-core') 2 | 3 | if (playwright.chromium.name() !== 'chromium') 4 | throw new Error('playwright-core: could not get name') 5 | 6 | if (!playwright.chromium.executablePath()) 7 | throw new Error('playwright-core: could not get executablePath') 8 | -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-shadow/input.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const { join } = require('path'); 3 | 4 | console.log(fs.readFileSync(join(__dirname, 'asset.txt'), 'utf8')); 5 | 6 | (function () { 7 | var join = () => 'nope'; 8 | console.log(fs.readFileSync(join(__dirname, 'asset.txt'), 'utf8')); 9 | })(); -------------------------------------------------------------------------------- /test/unit/module-register/input-esm.mjs: -------------------------------------------------------------------------------- 1 | import { register } from 'module'; 2 | 3 | // Load relative to the current file 4 | register('./hook.mjs', import.meta.url); 5 | // Load from a bare specifier 6 | register('test-pkg'); 7 | // Load with parentURL in options object 8 | register('./hook.mjs', { parentURL: import.meta.url }); -------------------------------------------------------------------------------- /test/unit/require-resolve/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/require-resolve/asset1.txt", 4 | "test/unit/require-resolve/asset2.txt", 5 | "test/unit/require-resolve/asset3.txt", 6 | "test/unit/require-resolve/dep1.js", 7 | "test/unit/require-resolve/dep2.js", 8 | "test/unit/require-resolve/input.js" 9 | ] -------------------------------------------------------------------------------- /test/unit/shiki/input.js: -------------------------------------------------------------------------------- 1 | const { getHighlighter } = require('shiki') 2 | 3 | async function main() { 4 | const { codeToThemedTokens } = await getHighlighter({ theme: 'nord', langs: ['javascript'] }) 5 | const result = codeToThemedTokens('let n=1', 'javascript'); 6 | Array.isArray(result); 7 | } 8 | 9 | main(); 10 | -------------------------------------------------------------------------------- /test/unit/webpack-node/level1/level2/level3/page.js: -------------------------------------------------------------------------------- 1 | function getChunk(chunkId) { 2 | var chunk = require('../../' + 3 | ({}[chunkId] || chunkId) + 4 | '.' + 5 | { 6 | a: 'b', 7 | c: 'd', 8 | }[chunkId] + 9 | '.js') 10 | return chunk 11 | } 12 | 13 | module.exports = { getChunk } 14 | -------------------------------------------------------------------------------- /test/integration/shiki.js: -------------------------------------------------------------------------------- 1 | const { getHighlighter } = require('shiki') 2 | 3 | async function main() { 4 | const { codeToThemedTokens } = await getHighlighter({ theme: 'nord', langs: ['javascript'] }) 5 | const result = codeToThemedTokens('let n=1', 'javascript'); 6 | Array.isArray(result); 7 | } 8 | 9 | main(); 10 | -------------------------------------------------------------------------------- /test/unit/require-resolve/input.js: -------------------------------------------------------------------------------- 1 | const asset1 = require.resolve('./asset1.txt'); 2 | 3 | function loader () {} 4 | loader(require.resolve('./asset2.txt')); 5 | 6 | unknown(require.resolve('./input.js') + '/../asset1.txt'); 7 | 8 | const thing = asdf(require.resolve('./asset3.txt')); 9 | 10 | require.resolve('./dep1.js') -------------------------------------------------------------------------------- /test/integration/esbuild.js: -------------------------------------------------------------------------------- 1 | const { buildSync } = require('esbuild'); 2 | const { join } = require('path'); 3 | 4 | const entry = join(__dirname, '..', '..', 'package.json') 5 | 6 | const result = buildSync({ 7 | entryPoints: [entry], 8 | write: false, 9 | }); 10 | 11 | if (!result) { 12 | throw new Error('esbuild failed') 13 | } -------------------------------------------------------------------------------- /test/integration/isomorphic-unfetch.js: -------------------------------------------------------------------------------- 1 | const fetch = require("isomorphic-unfetch"); 2 | 3 | (async () => { 4 | const res = await fetch("https://dog.ceo/api/breeds/image/random"); 5 | const data = await res.json() 6 | if (data.status !== "success") { 7 | throw new Error("Unexpected response: " + JSON.stringify(data)); 8 | } 9 | })(); -------------------------------------------------------------------------------- /test/unit/browser-remappings-false/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/browser-remappings-false/input.js", 4 | "test/unit/browser-remappings-false/node_modules/pkg/browser.js", 5 | "test/unit/browser-remappings-false/node_modules/pkg/index.js", 6 | "test/unit/browser-remappings-false/node_modules/pkg/package.json" 7 | ] 8 | -------------------------------------------------------------------------------- /test/integration/express-template.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const path = require("path"); 3 | 4 | const app = express(); 5 | 6 | app.set("view engine", "pug"); 7 | app.set("views", path.join(__dirname, "views")); 8 | 9 | app.get("*", (req, res) => { 10 | res.render("index"); 11 | }); 12 | 13 | module.exports = app; 14 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-string/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/browser-remappings-string/input.js", 4 | "test/unit/browser-remappings-string/node_modules/pkg/browser.js", 5 | "test/unit/browser-remappings-string/node_modules/pkg/index.js", 6 | "test/unit/browser-remappings-string/node_modules/pkg/package.json" 7 | ] 8 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-undefined/node_modules/pkg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pkg", 3 | "main": "index.js", 4 | "exports": { 5 | ".": { 6 | "import": "./subdir/import-main.js", 7 | "require": "./require-main.cjs" 8 | }, 9 | "./asdf": { 10 | "import": "./subdir/import-main.js" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/unit/exports-path/node_modules/extract-files/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "extract-files", 3 | "exports": { 4 | ".": { 5 | "import": "./public/index.mjs", 6 | "require": "./public/index.js" 7 | }, 8 | "./public/": "./public/", 9 | "./package": "./package.json", 10 | "./package.json": "./package.json" 11 | } 12 | } -------------------------------------------------------------------------------- /test/unit/microtime-node-gyp/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "node_modules/microtime/index.js", 3 | "node_modules/microtime/package.json", 4 | "node_modules/node-gyp-build/index.js", 5 | "node_modules/node-gyp-build/node-gyp-build.js", 6 | "node_modules/node-gyp-build/package.json", 7 | "package.json", 8 | "test/unit/microtime-node-gyp/input.js" 9 | ] 10 | -------------------------------------------------------------------------------- /test/unit/process-cwd/input.js: -------------------------------------------------------------------------------- 1 | const { resolve } = require('path'); 2 | const fs = require('fs'); 3 | const { readdir } = fs.promises; 4 | 5 | async function getPosts() { 6 | const postsDirectory = resolve(process.cwd(), '_posts'); 7 | const postFiles = await readdir(postsDirectory); 8 | return postFiles; 9 | } 10 | 11 | getPosts().catch(console.error); -------------------------------------------------------------------------------- /test/unit/exports-only/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/exports-only/input.js", 4 | "test/unit/exports-only/node_modules/pkg/package.json", 5 | "test/unit/exports-only/node_modules/pkg/require-main.cjs", 6 | "test/unit/exports-only/node_modules/pkg/subdir/import-main.js", 7 | "test/unit/exports-only/node_modules/pkg/subdir/package.json" 8 | ] 9 | -------------------------------------------------------------------------------- /test/integration/polyfill-library.js: -------------------------------------------------------------------------------- 1 | const polyfill = require('polyfill-library') 2 | 3 | async function handler() { 4 | const script = await polyfill.getPolyfillString({ 5 | minify: false, 6 | features: { 'es6': { flags: ['gated'] } } 7 | }) 8 | return script 9 | } 10 | 11 | handler().then(script => console.log(typeof script)).catch(console.error) 12 | 13 | -------------------------------------------------------------------------------- /test/unit/exports-path/node_modules/apollo-upload-client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "apollo-upload-client", 3 | "exports": { 4 | ".": { 5 | "import": "./public/index.mjs", 6 | "require": "./public/index.js" 7 | }, 8 | "./public/": "./public/", 9 | "./package": "./package.json", 10 | "./package.json": "./package.json" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/unit/exports/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/exports/input.js", 4 | "test/unit/exports/node_modules/pkg/index.js", 5 | "test/unit/exports/node_modules/pkg/package.json", 6 | "test/unit/exports/node_modules/pkg/require-main.cjs", 7 | "test/unit/exports/node_modules/pkg/subdir/import-main.js", 8 | "test/unit/exports/node_modules/pkg/subdir/package.json" 9 | ] -------------------------------------------------------------------------------- /test/unit/module-register/input.js: -------------------------------------------------------------------------------- 1 | const { register } = require('module'); 2 | const { pathToFileURL } = require('url'); 3 | 4 | import('./input-esm.mjs') 5 | 6 | // Load relative to the current file 7 | register('./hook2.mjs', pathToFileURL(__filename)); 8 | // Load relative to the current working directory 9 | register('./test/unit/module-register/hook3.mjs', pathToFileURL('./')); 10 | 11 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | collectCoverageFrom: ['out/**/*.js'], 3 | coverageReporters: ['html', 'lcov'], 4 | coverageThreshold: { 5 | global: { 6 | branches: 87.25, 7 | functions: 96.25, 8 | lines: 90.85, 9 | statements: -249, 10 | }, 11 | }, 12 | testEnvironment: 'node', 13 | testMatch: ['/test/*(*.)@(spec|test).js?(x)'], 14 | }; 15 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed/node_modules/pkg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pkg", 3 | "main": "index.js", 4 | "exports": { 5 | ".": { 6 | "import": "./subdir/import-main.js", 7 | "require": "./require-main.cjs" 8 | }, 9 | "./asdf": { 10 | "import": "./subdir/import-main.js" 11 | } 12 | }, 13 | "browser": "./subdir/import-main-browser.js" 14 | } 15 | -------------------------------------------------------------------------------- /test/unit/exports/node_modules/pkg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pkg", 3 | "main": "index.js", 4 | "exports": { 5 | ".": { 6 | "node": { 7 | "import": "./subdir/import-main.js", 8 | "require": "./require-main.cjs" 9 | } 10 | }, 11 | "./asdf": { 12 | "node": { 13 | "import": "./subdir/import-main.js" 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pnpm-symlinks", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "actual.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "parse5-htmlparser2-tree-adapter": "^6.0.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/integration/mongoose.js: -------------------------------------------------------------------------------- 1 | const mongoose = require("mongoose"); 2 | const Schema = mongoose.Schema; 3 | 4 | const blogSchema = new Schema({ 5 | title: String, 6 | author: String, 7 | body: String, 8 | comments: [{ body: String, date: Date }], 9 | date: { type: Date, default: Date.now }, 10 | hidden: Boolean, 11 | meta: { 12 | votes: Number, 13 | favs: Number 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /test/unit/exports-only/node_modules/pkg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pkg", 3 | "main": "index.js", 4 | "exports": { 5 | ".": { 6 | "node": { 7 | "import": "./subdir/import-main.js", 8 | "require": "./require-main.cjs" 9 | } 10 | }, 11 | "./asdf": { 12 | "node": { 13 | "import": "./subdir/import-main.js" 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/unit/ts-path-join/input.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const path_1 = require("path"); 4 | // See https://devblogs.microsoft.com/typescript/announcing-typescript-4-4/#more-compliant-indirect-calls-for-imported-functions 5 | // Also https://2ality.com/2015/12/references.html 6 | const file = (0, path_1.join)(__dirname, 'file.txt'); 7 | console.log(file); -------------------------------------------------------------------------------- /test/unit/exports-path/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/exports-path/input.js", 4 | "test/unit/exports-path/node_modules/apollo-upload-client/package.json", 5 | "test/unit/exports-path/node_modules/apollo-upload-client/public/ReactNativeFile.js", 6 | "test/unit/exports-path/node_modules/extract-files/package.json", 7 | "test/unit/exports-path/node_modules/extract-files/public/ReactNativeFile.js" 8 | ] -------------------------------------------------------------------------------- /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | # All revisions specified in the `.git-blame-ignore-revs` file, are hidden from the blame 2 | # when running `git blame --ignore-revs-file .git-blame-ignore-revs`. 3 | # https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view 4 | 5 | # chore(format): add `@vercel/style-guide` and run `prettier` #393 6 | c16e7945c3f3221616567356d9abc2e824bf38cd 7 | -------------------------------------------------------------------------------- /.github/workflows/pr.yml: -------------------------------------------------------------------------------- 1 | name: PR 2 | on: 3 | pull_request: 4 | types: [opened, edited, synchronize] 5 | pull_request_target: 6 | types: [opened, edited, synchronize] 7 | 8 | jobs: 9 | lint: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: amannn/action-semantic-pull-request@0b14f54ac155d88e12522156e52cb6e397745cfd 13 | env: 14 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 15 | -------------------------------------------------------------------------------- /test/ecmascript/README.md: -------------------------------------------------------------------------------- 1 | ## About this test suite 2 | 3 | These tests came from [kangax compat table](https://github.com/kangax/compat-table) which tests for specific ES features. 4 | 5 | In our case, we only need to test parsing and not actually execute the tests. 6 | 7 | ## Updating 8 | 9 | You can run the following script from this directory to update this test suite. 10 | 11 | ```sh 12 | node update-all-data.mjs 13 | ``` -------------------------------------------------------------------------------- /test/unit/module-register/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/module-register/hook.mjs", 4 | "test/unit/module-register/hook2.mjs", 5 | "test/unit/module-register/hook3.mjs", 6 | "test/unit/module-register/input-esm.mjs", 7 | "test/unit/module-register/input.js", 8 | "test/unit/module-register/node_modules/test-pkg/index.mjs", 9 | "test/unit/module-register/node_modules/test-pkg/package.json" 10 | ] 11 | -------------------------------------------------------------------------------- /.kodiak.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [merge] 4 | automerge_label = "automerge" 5 | blacklist_title_regex = "^WIP.*" 6 | blacklist_labels = ["work in progress"] 7 | method = "squash" 8 | delete_branch_on_merge = true 9 | block_on_reviews_requested = false 10 | notify_on_conflict = true 11 | optimistic_updates = true 12 | 13 | [merge.message] 14 | title = "pull_request_title" 15 | include_pr_number = true 16 | body_type = "markdown" 17 | -------------------------------------------------------------------------------- /test/unit/phantomjs-prebuilt/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "node_modules/es6-promise/dist/es6-promise.js", 3 | "node_modules/es6-promise/package.json", 4 | "node_modules/phantomjs-prebuilt/bin/phantomjs", 5 | "node_modules/phantomjs-prebuilt/lib/location.js", 6 | "node_modules/phantomjs-prebuilt/lib/phantomjs.js", 7 | "node_modules/phantomjs-prebuilt/package.json", 8 | "package.json", 9 | "test/unit/phantomjs-prebuilt/input.js" 10 | ] -------------------------------------------------------------------------------- /test/unit/zeromq-node-gyp/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "node_modules/@aminya/node-gyp-build/index.js", 3 | "node_modules/@aminya/node-gyp-build/package.json", 4 | "node_modules/zeromq/lib/draft.js", 5 | "node_modules/zeromq/lib/index.js", 6 | "node_modules/zeromq/lib/native.js", 7 | "node_modules/zeromq/lib/util.js", 8 | "node_modules/zeromq/package.json", 9 | "package.json", 10 | "test/unit/zeromq-node-gyp/input.js" 11 | ] 12 | -------------------------------------------------------------------------------- /test/integration/express-template-engine.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const path = require("path"); 3 | 4 | const app = express(); 5 | 6 | function customImplementation () {} 7 | 8 | app.engine('pug', customImplementation); 9 | app.set("view engine", "pug"); 10 | app.set("views", path.join(__dirname, "views")); 11 | 12 | app.get("*", (req, res) => { 13 | res.render("index"); 14 | }); 15 | 16 | module.exports = app; 17 | -------------------------------------------------------------------------------- /test/unit/yarn-workspace-esm/node_modules/.yarn-integrity: -------------------------------------------------------------------------------- 1 | { 2 | "systemParams": "darwin-x64-72", 3 | "modulesFolders": [ 4 | "node_modules", 5 | "node_modules" 6 | ], 7 | "flags": [], 8 | "linkedModules": [], 9 | "topLevelPatterns": [ 10 | "@example/common@1.0.0", 11 | "@example/common@1.0.0", 12 | "@example/web@2.0.0" 13 | ], 14 | "lockfileEntries": {}, 15 | "files": [], 16 | "artifacts": {} 17 | } -------------------------------------------------------------------------------- /test/unit/browser-remappings-disabled/node_modules/pkg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pkg", 3 | "main": "index.js", 4 | "exports": { 5 | ".": { 6 | "import": "./subdir/import-main.js", 7 | "require": "./require-main.cjs" 8 | }, 9 | "./asdf": { 10 | "import": "./subdir/import-main.js" 11 | } 12 | }, 13 | "browser": { 14 | "./subdir/import-main.js": "./subdir/import-main-browser.js" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/unit/asset-graceful-fs/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "node_modules/graceful-fs/clone.js", 3 | "node_modules/graceful-fs/graceful-fs.js", 4 | "node_modules/graceful-fs/legacy-streams.js", 5 | "node_modules/graceful-fs/package.json", 6 | "node_modules/graceful-fs/polyfills.js", 7 | "package.json", 8 | "test/unit/asset-graceful-fs/asset.txt", 9 | "test/unit/asset-graceful-fs/input.js", 10 | "test/unit/asset-graceful-fs/sub/asset.txt" 11 | ] 12 | -------------------------------------------------------------------------------- /test/unit/browser-remappings/node_modules/pkg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pkg", 3 | "main": "index.js", 4 | "exports": { 5 | ".": { 6 | "import": "./subdir/import-main.js", 7 | "require": "./require-main.cjs" 8 | }, 9 | "./asdf": { 10 | "import": "./subdir/import-main.js" 11 | } 12 | }, 13 | "browser": { 14 | "./subdir/import-main.js": "./subdir/import-main-browser.js", 15 | "./unknown.js": "./invalid.js" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/integration/request.js: -------------------------------------------------------------------------------- 1 | const request = require("request"); 2 | const url = "https://dog.ceo/api/breeds/image/random"; 3 | 4 | (async () => { 5 | await new Promise((resolve, reject) => { 6 | request.get(url, { json: true }, (err, resp, body) => { 7 | if (err) return reject(err); 8 | if (body.status != "success") { 9 | return reject(new Error("Bad api response: " + JSON.stringify(body))); 10 | } 11 | resolve(); 12 | }); 13 | }); 14 | })(); -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/node_modules/.pnpm/parse5@6.0.1/node_modules/parse5/lib/utils/merge-options.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function mergeOptions(defaults, options) { 4 | options = options || Object.create(null); 5 | 6 | return [defaults, options].reduce((merged, optObj) => { 7 | Object.keys(optObj).forEach(key => { 8 | merged[key] = optObj[key]; 9 | }); 10 | 11 | return merged; 12 | }, Object.create(null)); 13 | }; 14 | -------------------------------------------------------------------------------- /test/unit/jsonc-parser-wrapper/input.js: -------------------------------------------------------------------------------- 1 | (function (factory) { 2 | if (typeof module === "object" && typeof module.exports === "object") { 3 | var v = factory(require, exports); 4 | if (v !== undefined) module.exports = v; 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | define(["require", "exports", "./impl/format", "./impl/edit", "./impl/scanner", "./impl/parser"], factory); 8 | } 9 | })(function (require, exports) { 10 | require('./dep.js'); 11 | }); -------------------------------------------------------------------------------- /test/ecmascript/update-all-data.mjs: -------------------------------------------------------------------------------- 1 | import { readdir, writeFile } from 'fs/promises'; 2 | 3 | const dir = new URL('./', import.meta.url); 4 | const files = await readdir(dir); 5 | 6 | for (const file of files.filter(f => f.startsWith('data-'))) { 7 | const url = `https://raw.githubusercontent.com/kangax/compat-table/gh-pages/${file}`; 8 | const res = await fetch(url); 9 | const text = await res.text(); 10 | await writeFile(new URL(file, dir), text); 11 | } 12 | 13 | console.log('Update complete!') 14 | -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-ts-no-interop/input.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const fs_1 = require("fs"); 4 | const path = require("path"); 5 | console.log(fs_1.default.readFileSync(path.join(__dirname, 'asset.txt'), 'utf8')); 6 | 7 | /* Input source (with modules: 'commonjs', no esModuleInterop): 8 | import fs from 'fs'; 9 | import * as path from 'path'; 10 | 11 | console.log(fs.readFileSync(path.join(__dirname, 'asset.txt'), 'utf8')); 12 | */ 13 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-disabled/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/browser-remappings-disabled/input.js", 4 | "test/unit/browser-remappings-disabled/node_modules/pkg/index.js", 5 | "test/unit/browser-remappings-disabled/node_modules/pkg/package.json", 6 | "test/unit/browser-remappings-disabled/node_modules/pkg/require-main.cjs", 7 | "test/unit/browser-remappings-disabled/node_modules/pkg/subdir/import-main.js", 8 | "test/unit/browser-remappings-disabled/node_modules/pkg/subdir/package.json" 9 | ] -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/browser-remappings-malformed/input.js", 4 | "test/unit/browser-remappings-malformed/node_modules/pkg/index.js", 5 | "test/unit/browser-remappings-malformed/node_modules/pkg/package.json", 6 | "test/unit/browser-remappings-malformed/node_modules/pkg/require-main.cjs", 7 | "test/unit/browser-remappings-malformed/node_modules/pkg/subdir/import-main.js", 8 | "test/unit/browser-remappings-malformed/node_modules/pkg/subdir/package.json" 9 | ] -------------------------------------------------------------------------------- /test/unit/multi-input/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/multi-input/asset-2.txt", 4 | "test/unit/multi-input/asset.txt", 5 | "test/unit/multi-input/child-1.js", 6 | "test/unit/multi-input/child-2.js", 7 | "test/unit/multi-input/child-3.js", 8 | "test/unit/multi-input/child-4.js", 9 | "test/unit/multi-input/input-2.js", 10 | "test/unit/multi-input/input-3.js", 11 | "test/unit/multi-input/input-4.js", 12 | "test/unit/multi-input/input.js", 13 | "test/unit/multi-input/style.module.css" 14 | ] -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed2/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/browser-remappings-malformed2/input.js", 4 | "test/unit/browser-remappings-malformed2/node_modules/pkg/index.js", 5 | "test/unit/browser-remappings-malformed2/node_modules/pkg/package.json", 6 | "test/unit/browser-remappings-malformed2/node_modules/pkg/require-main.cjs", 7 | "test/unit/browser-remappings-malformed2/node_modules/pkg/subdir/import-main.js", 8 | "test/unit/browser-remappings-malformed2/node_modules/pkg/subdir/package.json" 9 | ] -------------------------------------------------------------------------------- /test/unit/browser-remappings-undefined/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/browser-remappings-undefined/input.js", 4 | "test/unit/browser-remappings-undefined/node_modules/pkg/index.js", 5 | "test/unit/browser-remappings-undefined/node_modules/pkg/package.json", 6 | "test/unit/browser-remappings-undefined/node_modules/pkg/require-main.cjs", 7 | "test/unit/browser-remappings-undefined/node_modules/pkg/subdir/import-main.js", 8 | "test/unit/browser-remappings-undefined/node_modules/pkg/subdir/package.json" 9 | ] 10 | -------------------------------------------------------------------------------- /test/unit/yarn-workspace-esm/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "test/unit/yarn-workspace-esm/input.js", 3 | "test/unit/yarn-workspace-esm/node_modules/@example/common", 4 | "test/unit/yarn-workspace-esm/node_modules/@example/web", 5 | "test/unit/yarn-workspace-esm/package.json", 6 | "test/unit/yarn-workspace-esm/packages/common/hello.js", 7 | "test/unit/yarn-workspace-esm/packages/common/package.json", 8 | "test/unit/yarn-workspace-esm/packages/web/index.js", 9 | "test/unit/yarn-workspace-esm/packages/web/package.json" 10 | ] 11 | -------------------------------------------------------------------------------- /test/unit/browser-remappings/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "package.json", 3 | "test/unit/browser-remappings/input.js", 4 | "test/unit/browser-remappings/node_modules/pkg/index.js", 5 | "test/unit/browser-remappings/node_modules/pkg/package.json", 6 | "test/unit/browser-remappings/node_modules/pkg/require-main.cjs", 7 | "test/unit/browser-remappings/node_modules/pkg/subdir/import-main-browser.js", 8 | "test/unit/browser-remappings/node_modules/pkg/subdir/import-main.js", 9 | "test/unit/browser-remappings/node_modules/pkg/subdir/package.json" 10 | ] 11 | -------------------------------------------------------------------------------- /test/integration/express-consolidate.js: -------------------------------------------------------------------------------- 1 | const assert = require('assert'); 2 | var express = require('express') 3 | , cons = require('consolidate') 4 | , app = express(); 5 | 6 | // assign the swig engine to .html files 7 | app.engine('html', cons.swig); 8 | 9 | // set .html as the default extension 10 | app.set('view engine', 'html'); 11 | app.set('views', __dirname + '/../fixtures'); 12 | 13 | app.render('index', { 14 | title: 'Consolidate.js' 15 | }, function (err, rendered) { 16 | assert.ok(rendered.startsWith('

Consolidate.js

')); 17 | }); 18 | -------------------------------------------------------------------------------- /test/integration/apollo.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const { ApolloServer, gql } = require("apollo-server-express"); 3 | 4 | // Construct a schema, using GraphQL schema language 5 | const typeDefs = gql` 6 | type Query { 7 | hello: String 8 | } 9 | `; 10 | 11 | // Provide resolver functions for your schema fields 12 | const resolvers = { 13 | Query: { 14 | hello: () => "Hello world!" 15 | } 16 | }; 17 | 18 | 19 | const server = new ApolloServer({ typeDefs, resolvers }); 20 | const app = express(); 21 | server.applyMiddleware({ app }); 22 | -------------------------------------------------------------------------------- /test/integration/bull.js: -------------------------------------------------------------------------------- 1 | const { BULL_REDIS_CONNECTION } = process.env; 2 | 3 | if (!BULL_REDIS_CONNECTION) { 4 | console.log('Skipping bull integration test'); 5 | console.log('Create cache on redislabs.com and export BULL_REDIS_CONNECTION="redis://:password@hostname:port"'); 6 | return; 7 | } 8 | 9 | const Queue = require('bull'); 10 | const pdfQueue = new Queue('pdf transcoding', BULL_REDIS_CONNECTION); 11 | 12 | pdfQueue.process(function(job, done) { 13 | job.progress(42); 14 | done(); 15 | pdfQueue.close(); 16 | }); 17 | 18 | pdfQueue.add({ pdf: 'http://example.com/file.pdf' }); 19 | -------------------------------------------------------------------------------- /src/utils/types.ts: -------------------------------------------------------------------------------- 1 | import { Node as ESTreeNode } from 'estree'; 2 | export type Ast = { body: ESTreeNode[] }; 3 | 4 | export interface StaticValue { 5 | value: any; 6 | wildcards?: string[]; 7 | } 8 | 9 | export interface ConditionalValue { 10 | test: string; 11 | ifTrue: any; 12 | else: any; 13 | } 14 | 15 | export type EvaluatedValue = StaticValue | ConditionalValue | undefined; 16 | 17 | /** 18 | * A more lax version of the 'estree' Node type 19 | */ 20 | export interface Node { 21 | start: number; 22 | end: number; 23 | type: ESTreeNode['type']; 24 | [propName: string]: any; 25 | } 26 | -------------------------------------------------------------------------------- /test/unit/browser-remappings-malformed2/node_modules/pkg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pkg", 3 | "main": "index.js", 4 | "exports": { 5 | ".": { 6 | "import": "./subdir/import-main.js", 7 | "require": "./require-main.cjs" 8 | }, 9 | "./asdf": { 10 | "import": "./subdir/import-main.js" 11 | } 12 | }, 13 | "browser": { 14 | "./subdir/import-main.js": "./invalid.js", 15 | "./require-main.cjs": "invalid.js", 16 | "./invalid.js": "./subdir/import-main-browser.js", 17 | "invalid.js": "./subdir/import-main-browser.js", 18 | "invalid2.js": "unknown.js" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/unit/import-meta-bad-url/input.js: -------------------------------------------------------------------------------- 1 | import { readFileSync } from 'fs'; 2 | 3 | console.log(readFileSync(new URL(unknown ? './asset1.txt' : './asset2.txt', 'not-a-url'))); 4 | console.log(readFileSync(new URL(unknown ? 'a--b' : './asset2.txt'))); 5 | console.log(readFileSync(new URL(unknown ? './asset1.txt' : 'a--b'))); 6 | console.log(readFileSync(new URL('file:///none'))); 7 | console.log(readFileSync(new URL('--'))); 8 | console.log(readFileSync(new URL('--', '--'))); 9 | console.log(readFileSync(new URL())); 10 | console.log(readFileSync(new URL('./test', unknown))); 11 | console.log(readFileSync(new URL(unknown))); 12 | -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/node_modules/.modules.yaml: -------------------------------------------------------------------------------- 1 | hoistPattern: 2 | - '*' 3 | hoistedDependencies: 4 | /parse5/6.0.1: 5 | parse5: private 6 | included: 7 | dependencies: true 8 | devDependencies: true 9 | optionalDependencies: true 10 | layoutVersion: 5 11 | packageManager: pnpm@6.16.1 12 | pendingBuilds: [] 13 | prunedAt: Sat, 09 Oct 2021 00:18:26 GMT 14 | publicHoistPattern: 15 | - '*types*' 16 | - '*eslint*' 17 | - '@prettier/plugin-*' 18 | - '*prettier-plugin-*' 19 | registries: 20 | default: https://registry.npmjs.org/ 21 | skipped: [] 22 | storeDir: /Users/jj/.pnpm-store/v3 23 | virtualStoreDir: .pnpm 24 | -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/pnpm-lock.yaml: -------------------------------------------------------------------------------- 1 | lockfileVersion: 5.3 2 | 3 | specifiers: 4 | parse5-htmlparser2-tree-adapter: ^6.0.1 5 | 6 | dependencies: 7 | parse5-htmlparser2-tree-adapter: 6.0.1 8 | 9 | packages: 10 | 11 | /parse5-htmlparser2-tree-adapter/6.0.1: 12 | resolution: {integrity: sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==} 13 | dependencies: 14 | parse5: 6.0.1 15 | dev: false 16 | 17 | /parse5/6.0.1: 18 | resolution: {integrity: sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==} 19 | dev: false 20 | -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/node_modules/.pnpm/lock.yaml: -------------------------------------------------------------------------------- 1 | lockfileVersion: 5.3 2 | 3 | specifiers: 4 | parse5-htmlparser2-tree-adapter: ^6.0.1 5 | 6 | dependencies: 7 | parse5-htmlparser2-tree-adapter: 6.0.1 8 | 9 | packages: 10 | 11 | /parse5-htmlparser2-tree-adapter/6.0.1: 12 | resolution: {integrity: sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==} 13 | dependencies: 14 | parse5: 6.0.1 15 | dev: false 16 | 17 | /parse5/6.0.1: 18 | resolution: {integrity: sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==} 19 | dev: false 20 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "esModuleInterop": true, 5 | "forceConsistentCasingInFileNames": true, 6 | "incremental": true, 7 | "lib": ["esnext"], 8 | "module": "commonjs", 9 | "moduleResolution": "node", 10 | "noEmitOnError": true, 11 | "noFallthroughCasesInSwitch": true, 12 | "noImplicitReturns": true, 13 | "noUnusedLocals": true, 14 | "noUnusedParameters": true, 15 | "noImplicitThis": true, 16 | "outDir": "out", 17 | "target": "es2022", 18 | "types": ["node"], 19 | "skipLibCheck": true, 20 | "strict": true 21 | }, 22 | "include": ["src/**/*"], 23 | "exclude": ["node_modules", "test/**/*"] 24 | } 25 | -------------------------------------------------------------------------------- /src/utils/interop-require.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | export function normalizeDefaultRequire(obj: any) { 4 | if (obj && obj.__esModule) return obj; 5 | return { default: obj }; 6 | } 7 | 8 | const hasOwnProperty = Object.prototype.hasOwnProperty; 9 | export function normalizeWildcardRequire(obj: any) { 10 | if (obj && obj.__esModule) return obj; 11 | // Note: This implements only value properties and doesn't preserve getters. 12 | // This follows the simpler helpers generated by TypeScript. 13 | const out: { [key: string]: string } = {}; 14 | for (const key in obj) { 15 | if (!hasOwnProperty.call(obj, key)) continue; 16 | out[key] = obj[key]; 17 | } 18 | out['default'] = obj; 19 | return out; 20 | } 21 | -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/node_modules/.pnpm/parse5@6.0.1/node_modules/parse5/lib/extensions/error-reporting/tokenizer-mixin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const ErrorReportingMixinBase = require('./mixin-base'); 4 | const ErrorReportingPreprocessorMixin = require('./preprocessor-mixin'); 5 | const Mixin = require('../../utils/mixin'); 6 | 7 | class ErrorReportingTokenizerMixin extends ErrorReportingMixinBase { 8 | constructor(tokenizer, opts) { 9 | super(tokenizer, opts); 10 | 11 | const preprocessorMixin = Mixin.install(tokenizer.preprocessor, ErrorReportingPreprocessorMixin, opts); 12 | 13 | this.posTracker = preprocessorMixin.posTracker; 14 | } 15 | } 16 | 17 | module.exports = ErrorReportingTokenizerMixin; 18 | -------------------------------------------------------------------------------- /test/integration/typescript.js: -------------------------------------------------------------------------------- 1 | const { spawn } = require('child_process'); 2 | const tsc = require.resolve('typescript/bin/tsc'); 3 | const tscjs = require.resolve('typescript/lib/tsc.js'); 4 | const cwd = __dirname; 5 | 6 | if (!tsc.endsWith('tsc')) { 7 | throw new Error('Expected tsc cli but found ' + tsc); 8 | } 9 | 10 | if (!tscjs.endsWith('tsc.js')) { 11 | throw new Error('Expected tsc.js but found ' + tscjs); 12 | } 13 | 14 | const child = spawn('node', [tscjs, '--version'], { cwd }); 15 | child.stdout.on('data', data => { 16 | if (!data || data.toString().length === 0) { 17 | throw new Error('Expected stdout output but found none'); 18 | } 19 | }); 20 | child.stderr.on('data', data => { 21 | throw new Error('Unexpected stderr output: ' + data.toString()); 22 | }); 23 | -------------------------------------------------------------------------------- /test/unit/protobuf-loop2/input.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | const path = require('path'); 3 | // Load Google's well-known proto files that aren't exposed by Protobuf.js. 4 | { 5 | // Protobuf.js exposes: any, duration, empty, field_mask, struct, timestamp, 6 | // and wrappers. compiler/plugin is excluded in Protobuf.js and here. 7 | var wellKnownProtos = ['asset1', 'asset2']; 8 | var sourceDir = path.join(__dirname, 'assets'); 9 | var _i; 10 | for (_i = 0; _i < wellKnownProtos_1.length; _i++) { 11 | var proto = wellKnownProtos[_i]; 12 | var file = path.join(sourceDir, proto + ".txt"); 13 | var descriptor_1 = Protobuf.loadSync(file).toJSON(); 14 | // @ts-ignore 15 | Protobuf.common(proto, descriptor_1.nested.google.nested); 16 | } 17 | } 18 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /test/integration/bullmq.js: -------------------------------------------------------------------------------- 1 | const { BULL_REDIS_CONNECTION } = process.env; 2 | 3 | if (!BULL_REDIS_CONNECTION) { 4 | console.log('Skipping bullmq integration test'); 5 | console.log('Create cache on redislabs.com and export BULL_REDIS_CONNECTION="redis://:password@hostname:port"'); 6 | return; 7 | } 8 | 9 | const url = new URL(BULL_REDIS_CONNECTION); 10 | const connection = { 11 | username: url.username, 12 | password: url.password, 13 | host: url.hostname, 14 | port: Number(url.port), 15 | } 16 | 17 | const { Queue } = require('bullmq'); 18 | 19 | async function main() { 20 | const queue = new Queue('foo', { connection }); 21 | await queue.add('job', { id: 'one' }); 22 | await queue.add('job', { id: 'two' }); 23 | await queue.close(); 24 | } 25 | 26 | main().then(() => console.log('bullmq success')).catch(console.error); 27 | -------------------------------------------------------------------------------- /test/unit/protobuf-loop/input.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | const path = require('path'); 3 | // Load Google's well-known proto files that aren't exposed by Protobuf.js. 4 | { 5 | // Protobuf.js exposes: any, duration, empty, field_mask, struct, timestamp, 6 | // and wrappers. compiler/plugin is excluded in Protobuf.js and here. 7 | var wellKnownProtos = ['asset1', 'asset2']; 8 | var sourceDir = path.join(__dirname, 'assets'); 9 | for (var _i = 0, wellKnownProtos_1 = wellKnownProtos; _i < wellKnownProtos_1.length; _i++) { 10 | var proto = wellKnownProtos_1[_i]; 11 | var file = path.join(sourceDir, proto + ".txt"); 12 | var descriptor_1 = Protobuf.loadSync(file).toJSON(); 13 | // @ts-ignore 14 | Protobuf.common(proto, descriptor_1.nested.google.nested); 15 | } 16 | } 17 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/node_modules/.pnpm/parse5@6.0.1/node_modules/parse5/lib/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Parser = require('./parser'); 4 | const Serializer = require('./serializer'); 5 | 6 | // Shorthands 7 | exports.parse = function parse(html, options) { 8 | const parser = new Parser(options); 9 | 10 | return parser.parse(html); 11 | }; 12 | 13 | exports.parseFragment = function parseFragment(fragmentContext, html, options) { 14 | if (typeof fragmentContext === 'string') { 15 | options = html; 16 | html = fragmentContext; 17 | fragmentContext = null; 18 | } 19 | 20 | const parser = new Parser(options); 21 | 22 | return parser.parseFragment(html, fragmentContext); 23 | }; 24 | 25 | exports.serialize = function(node, options) { 26 | const serializer = new Serializer(node, options); 27 | 28 | return serializer.serialize(); 29 | }; 30 | -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "test/unit/pnpm-symlinks/input.js", 3 | "test/unit/pnpm-symlinks/node_modules/.pnpm/parse5-htmlparser2-tree-adapter@6.0.1/node_modules/parse5", 4 | "test/unit/pnpm-symlinks/node_modules/.pnpm/parse5-htmlparser2-tree-adapter@6.0.1/node_modules/parse5-htmlparser2-tree-adapter/lib/index.js", 5 | "test/unit/pnpm-symlinks/node_modules/.pnpm/parse5-htmlparser2-tree-adapter@6.0.1/node_modules/parse5-htmlparser2-tree-adapter/package.json", 6 | "test/unit/pnpm-symlinks/node_modules/.pnpm/parse5@6.0.1/node_modules/parse5/lib/common/doctype.js", 7 | "test/unit/pnpm-symlinks/node_modules/.pnpm/parse5@6.0.1/node_modules/parse5/lib/common/html.js", 8 | "test/unit/pnpm-symlinks/node_modules/.pnpm/parse5@6.0.1/node_modules/parse5/package.json", 9 | "test/unit/pnpm-symlinks/node_modules/parse5-htmlparser2-tree-adapter", 10 | "test/unit/pnpm-symlinks/package.json" 11 | ] -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-ts/input.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __importDefault = (this && this.__importDefault) || function (mod) { 3 | return (mod && mod.__esModule) ? mod : { "default": mod }; 4 | }; 5 | var __importStar = (this && this.__importStar) || function (mod) { 6 | if (mod && mod.__esModule) return mod; 7 | var result = {}; 8 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 9 | result["default"] = mod; 10 | return result; 11 | }; 12 | Object.defineProperty(exports, "__esModule", { value: true }); 13 | const fs_1 = __importDefault(require("fs")); 14 | const path = __importStar(require("path")); 15 | console.log(fs_1.default.readFileSync(path.join(__dirname, 'asset.txt'), 'utf8')); 16 | 17 | /* Input source (with modules: 'commonjs'): 18 | import fs from 'fs'; 19 | import * as path from 'path'; 20 | 21 | console.log(fs.readFileSync(path.join(__dirname, 'asset.txt'), 'utf8')); 22 | */ 23 | -------------------------------------------------------------------------------- /test/unit/browserify/input.js: -------------------------------------------------------------------------------- 1 | (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 (https://github.com/inikulin)", 6 | "contributors": "https://github.com/inikulin/parse5/graphs/contributors", 7 | "homepage": "https://github.com/inikulin/parse5", 8 | "keywords": [ 9 | "parse5", 10 | "parser", 11 | "tree adapter", 12 | "htmlparser2" 13 | ], 14 | "license": "MIT", 15 | "main": "./lib/index.js", 16 | "dependencies": { 17 | "parse5": "^6.0.1" 18 | }, 19 | "repository": { 20 | "type": "git", 21 | "url": "git://github.com/inikulin/parse5.git" 22 | }, 23 | "files": [ 24 | "lib" 25 | ], 26 | "gitHead": "37227a3429584903cbd1799dade995266fc2dbe6" 27 | } 28 | -------------------------------------------------------------------------------- /test/unit/browserify-uglify/input.js: -------------------------------------------------------------------------------- 1 | !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 0; i--) { 21 | mxn.onItemPop(this.items[i]); 22 | } 23 | 24 | orig.popAllUpToHtmlElement.call(this); 25 | }, 26 | 27 | remove(element) { 28 | mxn.onItemPop(this.current); 29 | orig.remove.call(this, element); 30 | } 31 | }; 32 | } 33 | } 34 | 35 | module.exports = LocationInfoOpenElementStackMixin; 36 | -------------------------------------------------------------------------------- /src/utils/sharedlib-emit.ts: -------------------------------------------------------------------------------- 1 | import os from 'os'; 2 | import glob from 'glob'; 3 | import { getPackageBase } from './get-package-base'; 4 | import { Job } from '../node-file-trace'; 5 | 6 | let sharedlibGlob = ''; 7 | switch (os.platform()) { 8 | case 'darwin': 9 | sharedlibGlob = '/**/*.@(dylib|so?(.*))'; 10 | break; 11 | case 'win32': 12 | sharedlibGlob = '/**/*.dll'; 13 | break; 14 | default: 15 | sharedlibGlob = '/**/*.so?(.*)'; 16 | } 17 | 18 | // helper for emitting the associated shared libraries when a binary is emitted 19 | export async function sharedLibEmit(path: string, job: Job) { 20 | // console.log('Emitting shared libs for ' + path); 21 | const pkgPath = getPackageBase(path); 22 | if (!pkgPath) return; 23 | 24 | const files = await new Promise((resolve, reject) => 25 | glob( 26 | pkgPath + sharedlibGlob, 27 | { ignore: pkgPath + '/**/node_modules/**/*', dot: true }, 28 | (err, files) => (err ? reject(err) : resolve(files)), 29 | ), 30 | ); 31 | await Promise.all(files.map((file) => job.emitFile(file, 'sharedlib', path))); 32 | } 33 | -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/node_modules/.pnpm/parse5@6.0.1/node_modules/parse5/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "parse5", 3 | "description": "HTML parser and serializer.", 4 | "version": "6.0.1", 5 | "author": "Ivan Nikulin (https://github.com/inikulin)", 6 | "contributors": "https://github.com/inikulin/parse5/graphs/contributors", 7 | "homepage": "https://github.com/inikulin/parse5", 8 | "keywords": [ 9 | "html", 10 | "parser", 11 | "html5", 12 | "WHATWG", 13 | "specification", 14 | "fast", 15 | "html parser", 16 | "html5 parser", 17 | "htmlparser", 18 | "parse5", 19 | "serializer", 20 | "html serializer", 21 | "htmlserializer", 22 | "parse", 23 | "serialize" 24 | ], 25 | "license": "MIT", 26 | "main": "./lib/index.js", 27 | "repository": { 28 | "type": "git", 29 | "url": "git://github.com/inikulin/parse5.git" 30 | }, 31 | "files": [ 32 | "lib" 33 | ], 34 | "gitHead": "37227a3429584903cbd1799dade995266fc2dbe6" 35 | } 36 | -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/node_modules/.pnpm/parse5@6.0.1/node_modules/parse5/lib/utils/mixin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | class Mixin { 4 | constructor(host) { 5 | const originalMethods = {}; 6 | const overriddenMethods = this._getOverriddenMethods(this, originalMethods); 7 | 8 | for (const key of Object.keys(overriddenMethods)) { 9 | if (typeof overriddenMethods[key] === 'function') { 10 | originalMethods[key] = host[key]; 11 | host[key] = overriddenMethods[key]; 12 | } 13 | } 14 | } 15 | 16 | _getOverriddenMethods() { 17 | throw new Error('Not implemented'); 18 | } 19 | } 20 | 21 | Mixin.install = function(host, Ctor, opts) { 22 | if (!host.__mixins) { 23 | host.__mixins = []; 24 | } 25 | 26 | for (let i = 0; i < host.__mixins.length; i++) { 27 | if (host.__mixins[i].constructor === Ctor) { 28 | return host.__mixins[i]; 29 | } 30 | } 31 | 32 | const mixin = new Ctor(host, opts); 33 | 34 | host.__mixins.push(mixin); 35 | 36 | return mixin; 37 | }; 38 | 39 | module.exports = Mixin; 40 | -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/node_modules/.pnpm/parse5@6.0.1/node_modules/parse5/README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | parse5 4 | 5 |

6 | 7 |
8 |

parse5

9 | HTML parser and serializer. 10 |
11 |
12 | 13 |
14 | npm install --save parse5 15 |
16 |
17 | 18 |

19 | 📖 Documentation 📖 20 |

21 | 22 | --- 23 | 24 |

25 | List of parse5 toolset packages 26 |

27 | 28 |

29 | GitHub 30 |

31 | 32 |

33 | Online playground 34 |

35 | 36 |

37 | Version history 38 |

39 | -------------------------------------------------------------------------------- /test/unit/ffmpeg-installer/ffmpeg.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var os = require('os'); 4 | var fs = require('fs'); 5 | var path = require('path'); 6 | 7 | var verifyFile; 8 | 9 | var platform = (os.platform() + '-' + os.arch()) && '.'; 10 | 11 | var packageName = '@ffmpeg-installer/' + platform; 12 | 13 | var binary = os.platform() === 'win32' ? 'ffmpeg.exe' : 'ffmpeg.exe'; 14 | 15 | // var npm3Path = path.resolve(__dirname, '..', platform); 16 | var npm2Path = path.resolve(__dirname, '.', platform); 17 | 18 | var npm3Binary = path.join(npm3Path, binary); 19 | var npm2Binary = path.join(npm2Path, binary); 20 | 21 | var npm3Package = path.join(npm3Path, 'package.json'); 22 | var npm2Package = path.join(npm2Path, 'package.json'); 23 | 24 | var ffmpegPath, packageJson; 25 | 26 | if (verifyFile(npm3Binary)) { 27 | ffmpegPath = npm3Binary; 28 | } else if (verifyFile(npm2Binary)) { 29 | ffmpegPath = npm2Binary; 30 | } else { 31 | throw 'Could not find ffmpeg executable, tried "' + npm3Binary + '" and "' + npm2Binary + '"'; 32 | } 33 | 34 | var version = packageJson.ffmpeg || packageJson.version; 35 | var url = packageJson.homepage; 36 | 37 | module.exports = { 38 | path: ffmpegPath, 39 | version: version, 40 | url: url 41 | }; -------------------------------------------------------------------------------- /src/utils/get-package-base.ts: -------------------------------------------------------------------------------- 1 | // returns the base-level package folder based on detecting "node_modules" 2 | // package name boundaries 3 | const pkgNameRegEx = /^(@[^\\\/]+[\\\/])?[^\\\/]+/; 4 | 5 | export function getPackageBase(id: string): string | undefined { 6 | const pkgIndex = id.lastIndexOf('node_modules'); 7 | if ( 8 | pkgIndex !== -1 && 9 | (id[pkgIndex - 1] === '/' || id[pkgIndex - 1] === '\\') && 10 | (id[pkgIndex + 12] === '/' || id[pkgIndex + 12] === '\\') 11 | ) { 12 | const pkgNameMatch = id.slice(pkgIndex + 13).match(pkgNameRegEx); 13 | if (pkgNameMatch) 14 | return id.slice(0, pkgIndex + 13 + pkgNameMatch[0].length); 15 | } 16 | return undefined; 17 | } 18 | 19 | export function getPackageName(id: string): string | undefined { 20 | const pkgIndex = id.lastIndexOf('node_modules'); 21 | if ( 22 | pkgIndex !== -1 && 23 | (id[pkgIndex - 1] === '/' || id[pkgIndex - 1] === '\\') && 24 | (id[pkgIndex + 12] === '/' || id[pkgIndex + 12] === '\\') 25 | ) { 26 | const pkgNameMatch = id.slice(pkgIndex + 13).match(pkgNameRegEx); 27 | if (pkgNameMatch && pkgNameMatch.length > 0) { 28 | return pkgNameMatch[0].replace(/\\/g, '/'); 29 | } 30 | } 31 | return undefined; 32 | } 33 | -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/node_modules/.pnpm/parse5@6.0.1/node_modules/parse5/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2019 Ivan Nikulin (ifaaan@gmail.com, https://github.com/inikulin) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /test/unit/webpack-wrapper-strs-namespaces-large/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "node_modules/object-assign/index.js", 3 | "node_modules/object-assign/package.json", 4 | "node_modules/prop-types/checkPropTypes.js", 5 | "node_modules/prop-types/factoryWithThrowingShims.js", 6 | "node_modules/prop-types/factoryWithTypeCheckers.js", 7 | "node_modules/prop-types/index.js", 8 | "node_modules/prop-types/lib/ReactPropTypesSecret.js", 9 | "node_modules/prop-types/lib/has.js", 10 | "node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js", 11 | "node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js", 12 | "node_modules/prop-types/node_modules/react-is/index.js", 13 | "node_modules/prop-types/node_modules/react-is/package.json", 14 | "node_modules/prop-types/package.json", 15 | "node_modules/react/cjs/react.development.js", 16 | "node_modules/react/cjs/react.production.min.js", 17 | "node_modules/react/index.js", 18 | "node_modules/react/package.json", 19 | "package.json", 20 | "test/unit/webpack-wrapper-strs-namespaces-large/content/guides/index.md", 21 | "test/unit/webpack-wrapper-strs-namespaces-large/content/packages.json", 22 | "test/unit/webpack-wrapper-strs-namespaces-large/input.js" 23 | ] 24 | -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/node_modules/.pnpm/parse5@6.0.1/node_modules/parse5/lib/extensions/error-reporting/mixin-base.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Mixin = require('../../utils/mixin'); 4 | 5 | class ErrorReportingMixinBase extends Mixin { 6 | constructor(host, opts) { 7 | super(host); 8 | 9 | this.posTracker = null; 10 | this.onParseError = opts.onParseError; 11 | } 12 | 13 | _setErrorLocation(err) { 14 | err.startLine = err.endLine = this.posTracker.line; 15 | err.startCol = err.endCol = this.posTracker.col; 16 | err.startOffset = err.endOffset = this.posTracker.offset; 17 | } 18 | 19 | _reportError(code) { 20 | const err = { 21 | code: code, 22 | startLine: -1, 23 | startCol: -1, 24 | startOffset: -1, 25 | endLine: -1, 26 | endCol: -1, 27 | endOffset: -1 28 | }; 29 | 30 | this._setErrorLocation(err); 31 | this.onParseError(err); 32 | } 33 | 34 | _getOverriddenMethods(mxn) { 35 | return { 36 | _err(code) { 37 | mxn._reportError(code); 38 | } 39 | }; 40 | } 41 | } 42 | 43 | module.exports = ErrorReportingMixinBase; 44 | -------------------------------------------------------------------------------- /test/unit/browserify-minify/input.js: -------------------------------------------------------------------------------- 1 | ! function (e) { 2 | "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() 3 | }(function () { 4 | return function r(l, u, o) { 5 | function s(t, e) { 6 | if (!u[t]) { 7 | if (!l[t]) { 8 | var i = "function" == typeof require && require; 9 | if (!e && i) return i(t, !0); 10 | if (c) return c(t, !0); 11 | var n = new Error("Cannot find module '" + t + "'"); 12 | throw n.code = "MODULE_NOT_FOUND", n 13 | } 14 | var a = u[t] = { 15 | exports: {} 16 | }; 17 | l[t][0].call(a.exports, function (e) { 18 | return s(l[t][1][e] || e) 19 | }, a, a.exports, r, l, u, o) 20 | } 21 | return u[t].exports 22 | } 23 | for (var c = "function" == typeof require && require, e = 0; e < o.length; e++) s(o[e]); 24 | return s 25 | }({ 26 | 1: [function (s, e, t) { 27 | "use strict"; 28 | var ee = s("acorn"); 29 | }, { 30 | acorn: void 0 31 | }] 32 | }, {}, [1])(1) 33 | }); -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/node_modules/.pnpm/parse5-htmlparser2-tree-adapter@6.0.1/node_modules/parse5-htmlparser2-tree-adapter/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2019 Ivan Nikulin (ifaaan@gmail.com, https://github.com/inikulin) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/node_modules/.pnpm/parse5-htmlparser2-tree-adapter@6.0.1/node_modules/parse5-htmlparser2-tree-adapter/README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | parse5 4 | 5 |

6 | 7 |
8 |

parse5-htmlparser2-tree-adapter

9 | htmlparser2 tree adapter for parse5. 10 |
11 |
12 | 13 |
14 | npm install --save parse5-htmlparser2-tree-adapter 15 |
16 |
17 | 18 |

19 | 📖 Documentation 📖 20 |

21 | 22 | --- 23 | 24 |

25 | List of parse5 toolset packages 26 |

27 | 28 |

29 | GitHub 30 |

31 | 32 |

33 | Version history 34 |

35 | -------------------------------------------------------------------------------- /test/unit/pixelmatch/output.js: -------------------------------------------------------------------------------- 1 | [ 2 | "node_modules/pixelmatch/bin/pixelmatch", 3 | "node_modules/pixelmatch/index.js", 4 | "node_modules/pixelmatch/package.json", 5 | "node_modules/pngjs/lib/bitmapper.js", 6 | "node_modules/pngjs/lib/bitpacker.js", 7 | "node_modules/pngjs/lib/chunkstream.js", 8 | "node_modules/pngjs/lib/constants.js", 9 | "node_modules/pngjs/lib/crc.js", 10 | "node_modules/pngjs/lib/filter-pack.js", 11 | "node_modules/pngjs/lib/filter-parse-async.js", 12 | "node_modules/pngjs/lib/filter-parse-sync.js", 13 | "node_modules/pngjs/lib/filter-parse.js", 14 | "node_modules/pngjs/lib/format-normaliser.js", 15 | "node_modules/pngjs/lib/interlace.js", 16 | "node_modules/pngjs/lib/packer-async.js", 17 | "node_modules/pngjs/lib/packer-sync.js", 18 | "node_modules/pngjs/lib/packer.js", 19 | "node_modules/pngjs/lib/paeth-predictor.js", 20 | "node_modules/pngjs/lib/parser-async.js", 21 | "node_modules/pngjs/lib/parser-sync.js", 22 | "node_modules/pngjs/lib/parser.js", 23 | "node_modules/pngjs/lib/png-sync.js", 24 | "node_modules/pngjs/lib/png.js", 25 | "node_modules/pngjs/lib/sync-inflate.js", 26 | "node_modules/pngjs/lib/sync-reader.js", 27 | "node_modules/pngjs/package.json", 28 | "package.json", 29 | "test/unit/pixelmatch/input.js" 30 | ] -------------------------------------------------------------------------------- /test/integration/firebase.js: -------------------------------------------------------------------------------- 1 | const firebase = require('firebase/app') 2 | require('firebase/firestore') 3 | require('firebase/database') 4 | 5 | firebase.initializeApp({ projectId: 'noop' }) 6 | const store = firebase.firestore() 7 | 8 | store 9 | .collection('users') 10 | .get() 11 | .then( 12 | () => { 13 | process.exit(0) 14 | }, 15 | e => { 16 | /* 17 | Error: unresolvable extensions: 'extend google.protobuf.MethodOptions' in .google.api 18 | at Root.resolveAll (/private/var/folders/c3/vytj6_h56b77f_g72smntm3m0000gn/T/node_modules/protobufjs/src/root.js:243:1) 19 | at Object.loadSync (/private/var/folders/c3/vytj6_h56b77f_g72smntm3m0000gn/T/a707d6b7ee4afe5b484993180e617e2d/index.js:43406:16) 20 | at loadProtos (/private/var/folders/c3/vytj6_h56b77f_g72smntm3m0000gn/T/a707d6b7ee4afe5b484993180e617e2d/index.js:16778:41) 21 | at NodePlatform.module.exports.278.NodePlatform.loadConnection (/private/var/folders/c3/vytj6_h56b77f_g72smntm3m0000gn/T/a707d6b7ee4afe5b484993180e617e2d/index.js:16815:22) 22 | at FirestoreClient.module.exports.278.FirestoreClient.initializeRest (/private/var/folders/c3/vytj6_h56b77f_g72smntm3m0000gn/T/a707d6b7ee4afe5b484993180e617e2d/index.js:28414:14) 23 | at /private/var/folders/c3/vytj6_h56b77f_g72smntm3m0000gn/T/a707d6b7ee4afe5b484993180e617e2d/index.js:28239:64 24 | */ 25 | console.error(e) 26 | process.exit(1) 27 | } 28 | ) 29 | -------------------------------------------------------------------------------- /src/utils/ast-helpers.ts: -------------------------------------------------------------------------------- 1 | import { Node } from './types'; 2 | 3 | export function isIdentifierRead(node: Node, parent: Node) { 4 | switch (parent.type) { 5 | case 'ObjectPattern': 6 | case 'ArrayPattern': 7 | // Note: default values not currently supported 8 | return false; 9 | // disregard `bar` in `bar = thing()` 10 | case 'AssignmentExpression': 11 | return parent.right === node; 12 | case 'MemberExpression': 13 | return parent.computed || node === parent.object; 14 | // disregard the `bar` in `{ bar: foo }` 15 | case 'Property': 16 | return node === parent.value; 17 | // disregard the `bar` in `class Foo { bar () {...} }` 18 | case 'MethodDefinition': 19 | return false; 20 | // disregard the `bar` in var bar = asdf 21 | case 'VariableDeclarator': 22 | return parent.id !== node; 23 | // disregard the `bar` in `export { foo as bar }` 24 | case 'ExportSpecifier': 25 | return false; 26 | // disregard the `bar` in `function (bar) {}` 27 | case 'FunctionExpression': 28 | case 'FunctionDeclaration': 29 | case 'ArrowFunctionExpression': 30 | return false; 31 | default: 32 | return true; 33 | } 34 | } 35 | 36 | export function isVarLoop(node: Node) { 37 | return ( 38 | node.type === 'ForStatement' || 39 | node.type === 'ForInStatement' || 40 | node.type === 'ForOfStatement' 41 | ); 42 | } 43 | 44 | export function isLoop(node: Node) { 45 | return ( 46 | node.type === 'ForStatement' || 47 | node.type === 'ForInStatement' || 48 | node.type === 'ForOfStatement' || 49 | node.type === 'WhileStatement' || 50 | node.type === 'DoWhileStatement' 51 | ); 52 | } 53 | -------------------------------------------------------------------------------- /test/unit/asset-fs-inline-path-babel/input.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | 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); } 4 | 5 | var _fs = _interopRequireDefault(require("fs")); 6 | 7 | var path = _interopRequireWildcard(require("path")); 8 | 9 | function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } 10 | 11 | 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; } 12 | 13 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 14 | 15 | console.log(_fs["default"].readFileSync(path.join(__dirname, 'asset.txt'), 'utf8')); 16 | 17 | /* Input source: 18 | import fs from 'fs'; 19 | import * as path from 'path'; 20 | 21 | console.log(fs.readFileSync(path.join(__dirname, 'asset.txt'), 'utf8')); 22 | */ 23 | -------------------------------------------------------------------------------- /test/unit/webpack-5-wrapper-namespace/input.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var exports = {}; 3 | exports.id = 223; 4 | exports.ids = [223]; 5 | exports.modules = { 6 | 7 | /***/ 0: 8 | /***/ (function(module, exports, __webpack_require__) { 9 | 10 | module.exports = __webpack_require__("PicC"); 11 | 12 | 13 | /***/ }), 14 | 15 | /***/ "PicC": 16 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 17 | 18 | "use strict"; 19 | __webpack_require__.r(__webpack_exports__); 20 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return handler; }); 21 | /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = require('path'); 22 | /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__); 23 | /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = require('fs'); 24 | /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__); 25 | 26 | f(__webpack_require__("oyvS")); 27 | 28 | 29 | function handler(req, res) { 30 | const dictionaryPath = path__WEBPACK_IMPORTED_MODULE_0___default().join(process.cwd(), "assets", "dictionary.json"); 31 | const content = fs__WEBPACK_IMPORTED_MODULE_1___default().readFileSync(dictionaryPath, "utf-8"); 32 | res.json(content); 33 | } 34 | 35 | /***/ }), 36 | 37 | /***/ "mw/K": 38 | /***/ (function(module, exports) { 39 | 40 | module.exports = require("fs"); 41 | 42 | /***/ }), 43 | 44 | /***/ "oyvS": 45 | /***/ (function(module, exports) { 46 | 47 | module.exports = require("path"); 48 | 49 | /***/ }) 50 | 51 | /******/ }; 52 | 53 | // load runtime 54 | var __webpack_require__ = require("../../webpack-runtime.js"); 55 | __webpack_require__.C(exports); 56 | var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); } 57 | var __webpack_exports__ = (__webpack_exec__(277)); 58 | module.exports = __webpack_exports__; 59 | 60 | })(); 61 | -------------------------------------------------------------------------------- /test/unit/webpack-wrapper/input.js: -------------------------------------------------------------------------------- 1 | !(function(e) { 2 | var t = {}; 3 | function r(n) { 4 | if (t[n]) return t[n].exports; 5 | var o = (t[n] = { i: n, l: !1, exports: {} }); 6 | return e[n].call(o.exports, o, o.exports, r), (o.l = !0), o.exports; 7 | } 8 | (r.m = e), 9 | (r.c = t), 10 | (r.d = function(e, t, n) { 11 | r.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: n }); 12 | }), 13 | (r.r = function(e) { 14 | "undefined" != typeof Symbol && 15 | Symbol.toStringTag && 16 | Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), 17 | Object.defineProperty(e, "__esModule", { value: !0 }); 18 | }), 19 | (r.t = function(e, t) { 20 | if ((1 & t && (e = r(e)), 8 & t)) return e; 21 | if (4 & t && "object" == typeof e && e && e.__esModule) return e; 22 | var n = Object.create(null); 23 | if ( 24 | (r.r(n), 25 | Object.defineProperty(n, "default", { enumerable: !0, value: e }), 26 | 2 & t && "string" != typeof e) 27 | ) 28 | for (var o in e) 29 | r.d( 30 | n, 31 | o, 32 | function(t) { 33 | return e[t]; 34 | }.bind(null, o) 35 | ); 36 | return n; 37 | }), 38 | (r.n = function(e) { 39 | var t = 40 | e && e.__esModule 41 | ? function() { 42 | return e.default; 43 | } 44 | : function() { 45 | return e; 46 | }; 47 | return r.d(t, "a", t), t; 48 | }), 49 | (r.o = function(e, t) { 50 | return Object.prototype.hasOwnProperty.call(e, t); 51 | }), 52 | (r.p = ""), 53 | r((r.s = 2)); 54 | })([ 55 | function(e, t) { 56 | e.exports = require("fs"); 57 | }, 58 | function(e, t) { 59 | e.exports = require("path"); 60 | }, 61 | function(e, t, r) { 62 | const n = r(0), 63 | o = r(1); 64 | console.log(n.readFileSync(o.resolve(__dirname, "./asset.txt"))); 65 | } 66 | ]); -------------------------------------------------------------------------------- /test/unit/pnpm-symlinks/node_modules/.pnpm/parse5@6.0.1/node_modules/parse5/lib/extensions/error-reporting/parser-mixin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const ErrorReportingMixinBase = require('./mixin-base'); 4 | const ErrorReportingTokenizerMixin = require('./tokenizer-mixin'); 5 | const LocationInfoTokenizerMixin = require('../location-info/tokenizer-mixin'); 6 | const Mixin = require('../../utils/mixin'); 7 | 8 | class ErrorReportingParserMixin extends ErrorReportingMixinBase { 9 | constructor(parser, opts) { 10 | super(parser, opts); 11 | 12 | this.opts = opts; 13 | this.ctLoc = null; 14 | this.locBeforeToken = false; 15 | } 16 | 17 | _setErrorLocation(err) { 18 | if (this.ctLoc) { 19 | err.startLine = this.ctLoc.startLine; 20 | err.startCol = this.ctLoc.startCol; 21 | err.startOffset = this.ctLoc.startOffset; 22 | 23 | err.endLine = this.locBeforeToken ? this.ctLoc.startLine : this.ctLoc.endLine; 24 | err.endCol = this.locBeforeToken ? this.ctLoc.startCol : this.ctLoc.endCol; 25 | err.endOffset = this.locBeforeToken ? this.ctLoc.startOffset : this.ctLoc.endOffset; 26 | } 27 | } 28 | 29 | _getOverriddenMethods(mxn, orig) { 30 | return { 31 | _bootstrap(document, fragmentContext) { 32 | orig._bootstrap.call(this, document, fragmentContext); 33 | 34 | Mixin.install(this.tokenizer, ErrorReportingTokenizerMixin, mxn.opts); 35 | Mixin.install(this.tokenizer, LocationInfoTokenizerMixin); 36 | }, 37 | 38 | _processInputToken(token) { 39 | mxn.ctLoc = token.location; 40 | 41 | orig._processInputToken.call(this, token); 42 | }, 43 | 44 | _err(code, options) { 45 | mxn.locBeforeToken = options && options.beforeToken; 46 | mxn._reportError(code); 47 | } 48 | }; 49 | } 50 | } 51 | 52 | module.exports = ErrorReportingParserMixin; 53 | --------------------------------------------------------------------------------