New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bundle-require

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bundle-require - npm Package Compare versions

Comparing version 5.0.0 to 5.1.0

14

dist/index.d.ts

@@ -22,2 +22,3 @@ import { BuildFailure, BuildResult, BuildOptions, TsconfigRaw, Plugin } from 'esbuild';

type RebuildCallback = (error: Pick<BuildFailure, "errors" | "warnings"> | null, result: BuildResult | null) => void;
type ReadFile = (filepath: string) => string;
interface Options {

@@ -38,5 +39,7 @@ cwd?: string;

*
* @deprecated `esbuildOptions.watch` is deprecated, use `onRebuild` instead
*/
esbuildOptions?: BuildOptions & {
/**
* @deprecated `esbuildOptions.watch` is deprecated, use `onRebuild` instead
*/
watch?: boolean | {

@@ -73,3 +76,3 @@ onRebuild?: RebuildCallback;

* Or provide a `TsconfigRaw` object
*/
*/
tsconfig?: string | TsconfigRaw | false;

@@ -86,2 +89,3 @@ /**

format?: "cjs" | "esm";
readFile?: ReadFile;
}

@@ -99,3 +103,5 @@

}) => Plugin;
declare const injectFileScopePlugin: () => Plugin;
declare const injectFileScopePlugin: ({ readFile, }?: {
readFile?: ReadFile | undefined;
}) => Plugin;
declare function bundleRequire<T = any>(options: Options): Promise<{

@@ -106,2 +112,2 @@ mod: T;

export { GetOutputFile, JS_EXT_RE, Options, RebuildCallback, RequireFunction, bundleRequire, dynamicImport, externalPlugin, injectFileScopePlugin, match, tsconfigPathsToRegExp };
export { GetOutputFile, JS_EXT_RE, Options, ReadFile, RebuildCallback, RequireFunction, bundleRequire, dynamicImport, externalPlugin, injectFileScopePlugin, match, tsconfigPathsToRegExp };

@@ -60,2 +60,3 @@ // src/index.ts

}
var defaultReadFile = (filepath) => fs2.readFileSync(filepath, "utf-8");
var defaultGetOutputFile = (filepath, format) => filepath.replace(

@@ -114,3 +115,5 @@ JS_EXT_RE,

};
var injectFileScopePlugin = () => {
var injectFileScopePlugin = ({
readFile = defaultReadFile
} = {}) => {
return {

@@ -125,4 +128,4 @@ name: "bundle-require:inject-file-scope",

};
ctx.onLoad({ filter: JS_EXT_RE }, async (args) => {
const contents = await fs2.promises.readFile(args.path, "utf-8");
ctx.onLoad({ filter: JS_EXT_RE }, (args) => {
const contents = readFile(args.path);
const injectLines = [

@@ -200,9 +203,8 @@ `const ${FILENAME_VAR_NAME} = ${JSON.stringify(args.path)};`,

external: options.external,
notExternal: [
...options.notExternal || [],
...resolvePaths
],
notExternal: [...options.notExternal || [], ...resolvePaths],
externalNodeModules: (_e = options.externalNodeModules) != null ? _e : !options.filepath.match(PATH_NODE_MODULES_RE)
}),
injectFileScopePlugin()
injectFileScopePlugin({
readFile: options.readFile
})
]

@@ -209,0 +211,0 @@ };

{
"name": "bundle-require",
"version": "5.0.0",
"version": "5.1.0",
"description": "bundle and require a file",

@@ -5,0 +5,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc