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

@rsbuild/shared

Package Overview
Dependencies
Maintainers
3
Versions
193
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rsbuild/shared - npm Package Compare versions

Comparing version 0.2.18 to 0.3.0

2

dist/chain.d.ts

@@ -5,3 +5,3 @@ import type { BundlerChain, RspackConfig, RsbuildConfig, RsbuildContext, CreateAsyncHook, BundlerChainRule, NormalizedConfig, RsbuildPluginAPI, ModifyBundlerChainFn, ModifyBundlerChainUtils } from './types';

hooks: {
modifyBundlerChainHook: CreateAsyncHook<ModifyBundlerChainFn>;
modifyBundlerChain: CreateAsyncHook<ModifyBundlerChainFn>;
};

@@ -8,0 +8,0 @@ config: Readonly<RsbuildConfig>;

@@ -55,3 +55,6 @@ "use strict";

const bundlerChain = await getBundlerChain();
const [modifiedBundlerChain] = await context.hooks.modifyBundlerChainHook.call(bundlerChain, utils);
const [modifiedBundlerChain] = await context.hooks.modifyBundlerChain.call(
bundlerChain,
utils
);
if (context.config.tools?.bundlerChain) {

@@ -282,3 +285,3 @@ (0, import_utils2.castArray)(context.config.tools.bundlerChain).forEach((item) => {

if (hostname === import_constants.DEFAULT_DEV_HOST) {
const localHostname = `localhost`;
const localHostname = "localhost";
publicPath = `${protocol}://${localHostname}:${port}/`;

@@ -304,3 +307,3 @@ } else {

const serverPath = (0, import_fs.getDistPath)(config, "server");
const filename = import_path.posix.join(serverPath, `[name].js`);
const filename = import_path.posix.join(serverPath, "[name].js");
chain.output.filename(filename).chunkFilename(filename).libraryTarget("commonjs2");

@@ -310,3 +313,3 @@ }

const workerPath = (0, import_fs.getDistPath)(config, "worker");
const filename = import_path.posix.join(workerPath, `[name].js`);
const filename = import_path.posix.join(workerPath, "[name].js");
chain.output.filename(filename).chunkFilename(filename);

@@ -313,0 +316,0 @@ }

@@ -14,3 +14,3 @@ import type { RsbuildTarget } from './types';

export declare const HTML_DIST_DIR = "/";
export declare const SERVER_DIST_DIR = "bundles";
export declare const SERVER_DIST_DIR = "server";
export declare const SERVER_WORKER_DIST_DIR = "worker";

@@ -17,0 +17,0 @@ export declare const JS_DIST_DIR = "static/js";

@@ -71,7 +71,7 @@ "use strict";

"service-worker": DEFAULT_WEB_BROWSERSLIST,
node: ["node >= 14"]
node: ["node >= 16"]
};
const ROOT_DIST_DIR = "dist";
const HTML_DIST_DIR = "/";
const SERVER_DIST_DIR = "bundles";
const SERVER_DIST_DIR = "server";
const SERVER_WORKER_DIST_DIR = "worker";

@@ -78,0 +78,0 @@ const JS_DIST_DIR = "static/js";

@@ -36,6 +36,6 @@ "use strict";

const title = import_utils.color.bold(
import_utils.color.red(isTerserError ? `Minify error: ` : `Compile error: `)
import_utils.color.red(isTerserError ? "Minify error: " : "Compile error: ")
);
const tip = import_utils.color.yellow(
isTerserError ? `Failed to minify with terser, check for syntax errors.` : "Failed to compile, check the errors for troubleshooting."
isTerserError ? "Failed to minify with terser, check for syntax errors." : "Failed to compile, check the errors for troubleshooting."
);

@@ -50,4 +50,3 @@ return {

if (warnings.length && (showWarnings || process.stdout.isTTY)) {
const title = import_utils.color.bold(import_utils.color.yellow(`Compile Warning:
`));
const title = import_utils.color.bold(import_utils.color.yellow("Compile Warning: \n"));
return {

@@ -54,0 +53,0 @@ message: `${title}${`${warnings.join("\n\n")}

@@ -80,5 +80,4 @@ "use strict";

return text.replace(/\r\n/g, "\n");
} else {
return text;
}
return text;
};

@@ -107,9 +106,10 @@ const compareText = (contentA, contentB) => {

const keyRegex = /"([^\\"]+)":/g;
let match;
const cssModuleKeys = [];
const localExports = extractLocalExports(content);
while (match = keyRegex.exec(localExports)) {
let match = keyRegex.exec(localExports);
while (match !== null) {
if (cssModuleKeys.indexOf(match[1]) < 0) {
cssModuleKeys.push(match[1]);
}
match = keyRegex.exec(localExports);
}

@@ -116,0 +116,0 @@ return cssModuleKeys;

@@ -1,2 +0,2 @@

import { ChainedConfig, ChainedConfigWithUtils, ChainedConfigCombineUtils, Falsy } from './types';
import type { Falsy, ChainedConfig, ChainedConfigWithUtils, ChainedConfigCombineUtils } from './types';
export declare function mergeChainedOptions<T, U = unknown, F = Falsy>(params: {

@@ -3,0 +3,0 @@ defaults: T;

@@ -48,3 +48,4 @@ "use strict";

return isFalsy(ret) ? defaults : ret;
} else if (Array.isArray(options)) {
}
if (Array.isArray(options)) {
return options.reduce(

@@ -51,0 +52,0 @@ (defaults2, options2) => mergeChainedOptions({

import type { NormalizedConfig, TerserPluginOptions } from './types';
import { SwcJsMinimizerRspackPluginOptions } from '@rspack/core';
export declare function getTerserMinifyOptions(config: NormalizedConfig): Promise<TerserPluginOptions>;
export declare const getSwcMinimizerOptions: (config: NormalizedConfig) => import("@rspack/core").SwcJsMinimizerRspackPluginOptions;
export declare const getSwcMinimizerOptions: (config: NormalizedConfig) => SwcJsMinimizerRspackPluginOptions;

@@ -77,3 +77,4 @@ "use strict";

);
} else if (!silent) {
}
if (!silent) {
import_logger.logger.info(

@@ -80,0 +81,0 @@ `Port ${original} is in use, ${import_utils.color.yellow(`using port ${port}.`)}

import type { RspackConfig } from '../rspack';
import type { RsbuildTarget } from '../rsbuild';
import type { Builtins, Externals } from '@rspack/core';
import type { CopyRspackPluginOptions, Externals } from '@rspack/core';
export type DistPathConfig = {

@@ -25,3 +25,3 @@ /** The root directory of all files. */

server?: string;
/** The output directory of server bundles when target is `service-worker`. */
/** The output directory of service worker bundles when target is `service-worker`. */
worker?: string;

@@ -70,3 +70,3 @@ };

};
export type CopyPluginOptions = NonNullable<Builtins['copy']>;
export type CopyPluginOptions = CopyRspackPluginOptions;
export type InlineChunkTestFunction = (params: {

@@ -73,0 +73,0 @@ size: number;

@@ -58,4 +58,2 @@ import type { Falsy, WebpackChain } from './utils';

cache: PluginsFn;
yaml: PluginsFn;
toml: PluginsFn;
splitChunks: PluginsFn;

@@ -62,0 +60,0 @@ inlineChunk: PluginsFn;

@@ -6,4 +6,2 @@ import type { PluginStore, Plugins, RsbuildPluginAPI } from './plugin';

import type { StartServerResult, DevServerAPIs } from './server';
import type { AddressUrl } from '../url';
import type { Logger } from '../logger';
import type { NormalizedConfig } from './config';

@@ -19,17 +17,5 @@ import type { WebpackConfig } from './thirdParty';

getPortSilently?: boolean;
/**
* @deprecated use `logger.override()` instead
*/
logger?: Logger;
/**
* @deprecated use `server.printUrls` instead
*/
printURLs?: boolean | ((urls: AddressUrl[]) => AddressUrl[]);
};
export type PreviewServerOptions = {
getPortSilently?: boolean;
/**
* @deprecated use `server.printUrls` instead
*/
printURLs?: boolean | ((urls: AddressUrl[]) => AddressUrl[]);
};

@@ -62,2 +48,3 @@ export type BuildOptions = {

}) => Promise<ProviderInstance<B>>;
export type CreateCompiler = <C = Compiler | MultiCompiler>(options?: CreateCompilerOptions) => Promise<C>;
export type ProviderInstance<B extends 'rspack' | 'webpack' = 'rspack'> = {

@@ -68,3 +55,3 @@ readonly bundler: Bundler;

applyDefaultPlugins: (pluginStore: PluginStore) => Promise<void>;
createCompiler: (options?: CreateCompilerOptions) => Promise<Compiler | MultiCompiler>;
createCompiler: CreateCompiler;
/**

@@ -75,3 +62,3 @@ * This API is not stable

*/
getServerAPIs: (options?: Omit<StartDevServerOptions, 'printURLs'>) => Promise<DevServerAPIs>;
getServerAPIs: (options?: StartDevServerOptions) => Promise<DevServerAPIs>;
startDevServer: (options?: StartDevServerOptions) => Promise<StartServerResult>;

@@ -78,0 +65,0 @@ preview: (options?: PreviewServerOptions) => Promise<StartServerResult>;

@@ -16,3 +16,3 @@ import type * as Rspack from '@rspack/core';

export type RspackPluginInstance = GetElementType<NonNullable<RspackConfig['plugins']>>;
export type RspackBuiltinsConfig = Omit<BuiltinsOptions, 'html' | 'react' | 'pluginImport' | 'decorator' | 'presetEnv' | 'emotion' | 'relay'>;
export type RspackBuiltinsConfig = BuiltinsOptions;
export declare type JscTarget = 'es3' | 'es5' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022';

@@ -91,4 +91,31 @@ export declare type ParserConfig = TsParserConfig | EsParserConfig;

};
rspackExperiments?: Pick<BuiltinsOptions, 'react' | 'decorator' | 'presetEnv' | 'emotion' | 'relay'> & {
import?: BuiltinsOptions['pluginImport'];
rspackExperiments?: {
relay?: boolean | {
artifactDirectory?: string;
language: 'javascript' | 'typescript' | 'flow';
};
emotion?: boolean | {
sourceMap?: boolean;
autoLabel?: 'never' | 'dev-only' | 'always';
labelFormat?: string;
importMap?: {
[packageName: string]: {
[exportName: string]: {
canonicalImport?: [string, string];
};
};
};
};
import?: {
libraryName: string;
libraryDirectory?: string;
customName?: string;
customStyleName?: string;
style?: string | boolean;
styleLibraryDirectory?: string;
camelToDashComponentName?: boolean;
transformToDefaultImport?: boolean;
ignoreEsComponent?: Array<string>;
ignoreStyleComponent?: Array<string>;
}[];
styledComponents?: {

@@ -95,0 +122,0 @@ displayName?: boolean;

@@ -7,5 +7,9 @@ export declare const normalizeUrl: (url: string) => string;

};
export declare const getAddressUrls: (protocol: string | undefined, port: number, host?: string) => {
export declare const getAddressUrls: ({ protocol, port, host, }: {
protocol?: string | undefined;
port: number;
host?: string | undefined;
}) => {
label: string;
url: string;
}[];

@@ -59,4 +59,3 @@ "use strict";

if (base.startsWith("//")) {
base = `https:${base}`;
return urlJoin(base, str).replace("https:", "");
return urlJoin(`https:${base}`, str).replace("https:", "");
}

@@ -93,3 +92,7 @@ return import_path.posix.join(base, str);

}) => `${protocol}://${host}:${port}`;
const getAddressUrls = (protocol = "http", port, host) => {
const getAddressUrls = ({
protocol = "http",
port,
host
}) => {
const LOCAL_LABEL = "Local: ";

@@ -96,0 +99,0 @@ const NETWORK_LABEL = "Network: ";

{
"name": "@rsbuild/shared",
"version": "0.2.18",
"version": "0.3.0",
"description": "The internal shared modules and dependencies of Rsbuild.",

@@ -114,3 +114,3 @@ "homepage": "https://rsbuild.dev",

"dependencies": {
"@rspack/core": "0.4.5",
"@rspack/core": "0.5.0",
"caniuse-lite": "^1.0.30001559",

@@ -117,0 +117,0 @@ "lodash": "^4.17.21",

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