Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rspack/core

Package Overview
Dependencies
Maintainers
1
Versions
1097
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rspack/core - npm Package Compare versions

Comparing version 0.0.0-20221029021419 to 0.0.0-20221101015140

28

dist/compiler.js

@@ -220,3 +220,3 @@ "use strict";

let stats = await util_1.default.promisify(this.unsafe_build.bind(this))();
console.log("build success, time cost", Date.now() - begin);
console.log("build success, time cost", Date.now() - begin, "ms");
let pendingChangedFilepaths = new Set();

@@ -258,10 +258,30 @@ let isBuildFinished = true;

if (ws) {
const data = JSON.stringify({
const data = {
uri: relativePath,
content: stats.content
});
};
if (/\.[less|css|sass|scss]$/.test(data.uri)) {
const cssOutput = fs_1.default
.readFileSync(path_1.default.resolve(this.options.output.path, "main.css"))
.toString("utf-8");
// TODO: need support more
data.content = [
`var cssStyleTag = document.querySelector("style[id='hot-css']")`,
`if (cssStyleTag) {`,
` cssStyleTag.innerText = \`${cssOutput}\``,
`} else {`,
` var newCSStyleTag = document.createElement('style')`,
` newCSStyleTag.setAttribute('id', 'hot-css')`,
` newCSStyleTag.innerText = \`${cssOutput}\``,
` document.head.appendChild(newCSStyleTag)`,
`}`,
``,
`var outdataCSSLinkTag = document.querySelector("link[href='main.css']")`,
`outdataCSSLinkTag && outdataCSSLinkTag.parentNode && outdataCSSLinkTag.parentNode.removeChild(outdataCSSLinkTag)`
].join("\n");
}
for (const client of ws.clients) {
// the type of "ok" means rebuild success.
// the data should deleted after we had hash in stats.
client.send(JSON.stringify({ type: "ok", data }));
client.send(JSON.stringify({ type: "ok", data: JSON.stringify(data) }));
}

@@ -268,0 +288,0 @@ }

6

dist/config/devServer.d.ts
import type { WatchOptions } from "chokidar";
import type { ResolvedEntry } from "./entry";
export interface WebSocketServerOptions {

@@ -33,6 +34,3 @@ protocol?: string;

}
export declare function getAdditionDevEntry(): {
"rspack-dev-client": string;
"rspack-hot-update": string;
};
export declare function getAdditionDevEntry(): ResolvedEntry;
interface ResolveDevOptionContext {

@@ -39,0 +37,0 @@ context: string;

@@ -12,6 +12,5 @@ "use strict";

const additionalEntry = {
"rspack-dev-client": devClientEntryPath,
"rspack-hot-update": require.resolve("@rspack/dev-client/devServer")
"rspack-dev-client": [devClientEntryPath],
"rspack-hot-update": [require.resolve("@rspack/dev-client/devServer")]
};
// console.log(additionalEntry);
return additionalEntry;

@@ -18,0 +17,0 @@ }

@@ -1,10 +0,9 @@

export declare type Entry = Record<string, string>;
export declare type ResolvedEntry = Record<string, string>;
export declare function resolveEntryOptions(entry: Record<string, string> | string, options: {
export declare type Entry = string | string[] | Record<string, string | string[]>;
export declare type ResolvedEntry = Record<string, string[]>;
interface ResolveEntryContext {
context: string;
dev: boolean;
}): {
"rspack-dev-client"?: string;
"rspack-hot-update"?: string;
};
}
export declare function resolveEntryOptions(options: Entry, context: ResolveEntryContext): ResolvedEntry;
export {};
//# sourceMappingURL=entry.d.ts.map

@@ -8,16 +8,52 @@ "use strict";

const devServer_1 = require("./devServer");
const utils_1 = require("../utils");
const path_1 = __importDefault(require("path"));
function resolveEntryOptions(entry, options) {
if (typeof entry === "string") {
entry = {
main: entry
function resolveEntryOptions(options, context) {
const additionDevEntry = context.dev ? (0, devServer_1.getAdditionDevEntry)() : {};
if (typeof options === "undefined" || options === null) {
return {
main: [path_1.default.resolve(context.context, "src", "index.js")],
...additionDevEntry
};
}
return {
...(0, utils_1.mapValues)(entry, item => path_1.default.resolve(options.context, item)),
...(options.dev ? (0, devServer_1.getAdditionDevEntry)() : {})
};
else if (typeof options === "string") {
return {
main: [options],
...additionDevEntry
};
}
else if (Array.isArray(options)) {
return {
main: options,
...additionDevEntry
};
}
else if (typeof options === "object") {
return Object.fromEntries(Object.entries({ ...options, ...additionDevEntry }).map(([key, value]) => {
if (Array.isArray(value)) {
return [key, value];
}
else {
return [key, [value]];
}
}));
}
else {
return {};
}
}
exports.resolveEntryOptions = resolveEntryOptions;
// export function resolveEntryOptions(
// entry: Record<string, string> | string,
// options: { context: string; dev: boolean }
// ) {
// if (typeof entry === "string") {
// entry = {
// main: entry
// };
// }
// return {
// ...mapValues(entry, item => path.resolve(options.context, item)),
// ...(options.dev ? getAdditionDevEntry() : {})
// };
// }
//# sourceMappingURL=entry.js.map
import type { Context, ResolvedContext } from "./context";
import type { Dev, ResolvedDev } from "./devServer";
import { Entry, ResolvedEntry } from "./entry";
import type { Entry, ResolvedEntry } from "./entry";
import type { External, ExternalType, ResolvedExternal, ResolvedExternalType } from "./external";
import type { Mode, ResolvedMode } from "./mode";
import type { Module, ResolvedModule } from "./module";
import type { Module, ResolvedModule, LoaderContext } from "./module";
import type { Plugin } from "./plugin";

@@ -49,3 +49,3 @@ import type { ResolvedTarget, Target } from "./target";

export declare function getNormalizedRspackOptions(config: RspackOptions): RspackOptionsNormalized;
export type { Plugin };
export type { Plugin, LoaderContext };
//# sourceMappingURL=index.d.ts.map

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

function getNormalizedRspackOptions(config) {
var _a, _b, _c, _d, _e, _f;
var _a, _b, _c, _d, _e;
const context = (_a = config.context) !== null && _a !== void 0 ? _a : process.cwd();
const mode = (_b = config.mode) !== null && _b !== void 0 ? _b : "production";
const devServer = (0, devServer_1.resolveDevOptions)(config.devServer, { context });
const entry = (0, entry_1.resolveEntryOptions)((_c = config.entry) !== null && _c !== void 0 ? _c : {}, {
const entry = (0, entry_1.resolveEntryOptions)(config.entry, {
context,

@@ -24,5 +24,5 @@ dev: !!config.devServer

const target = (0, target_1.resolveTargetOptions)(config.target);
const externals = (_d = config.externals) !== null && _d !== void 0 ? _d : {};
const externalType = (_e = config.externalsType) !== null && _e !== void 0 ? _e : "";
const plugins = (_f = config.plugins) !== null && _f !== void 0 ? _f : [];
const externals = (_c = config.externals) !== null && _c !== void 0 ? _c : {};
const externalType = (_d = config.externalsType) !== null && _d !== void 0 ? _d : "";
const plugins = (_e = config.plugins) !== null && _e !== void 0 ? _e : [];
const builtins = (0, builtins_1.resolveBuiltinsOptions)(config.builtins || {}, context);

@@ -29,0 +29,0 @@ const resolve = (0, resolve_1.resolveResolveOptions)(config.resolve);

{
"name": "@rspack/core",
"version": "0.0.0-20221029021419",
"version": "0.0.0-20221101015140",
"main": "./dist/index.js",

@@ -10,3 +10,3 @@ "types": "./dist/index.d.ts",

"devDependencies": {
"@rspack/core": "0.0.0-20221029021419",
"@rspack/core": "0.0.0-20221101015140",
"@swc/helpers": "^0.4.12",

@@ -28,6 +28,6 @@ "@types/jest": "29.0.2",

"dependencies": {
"@rspack/binding": "0.0.0-20221029021419",
"@rspack/dev-client": "0.0.0-20221029021419",
"@rspack/plugin-less": "^0.0.0-20221029021419",
"@rspack/plugin-postcss": "^0.0.0-20221029021419",
"@rspack/binding": "0.0.0-20221101015140",
"@rspack/dev-client": "0.0.0-20221101015140",
"@rspack/plugin-less": "^0.0.0-20221101015140",
"@rspack/plugin-postcss": "^0.0.0-20221101015140",
"browserslist": "^4.21.3",

@@ -34,0 +34,0 @@ "chokidar": "3.5.3",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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