Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ js/private/worker/src/package.json=1787033725
npm/private/lifecycle/package.json=804720835
npm/private/test/npm_package/package.json=-1991705133
npm/private/test/npm_package_publish/package.json=1501316979
npm/private/test/package.json=550137760
npm/private/test/package.json=819064253
npm/private/test/subs/package.json=-897547334
npm/private/test/vendored/is-odd/package.json=1041695223
npm/private/test/vendored/lodash-4.17.21.tgz=-1206623349
npm/private/test/vendored/semver-max/package.json=578664053
package.json=1856600154
pnpm-lock.yaml=-1083936682
pnpm-lock.yaml=1672732935
pnpm-workspace.yaml=2041973211
6 changes: 1 addition & 5 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,6 @@ npm.npm_translate_lock(
"no-sandbox",
"requires-network",
],
"esbuild": [
"no-sandbox",
"requires-network",
],
"segfault-handler": [
"no-sandbox",
"requires-network",
Expand Down Expand Up @@ -307,7 +303,7 @@ use_repo(
"npm__rollup__4.55.2",
"npm__rollup__4.55.2__links",
"npm__unused__0.2.2__links",
"npm__webpack-bundle-analyzer__4.5.0_bufferutil_4.0.8",
# "npm__webpack-bundle-analyzer__4.5.0_bufferutil_4.0.8",
)

# As an example, manually import a package using explicit coordinates.
Expand Down
70 changes: 68 additions & 2 deletions npm/private/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
load("@aspect_rules_js//js:defs.bzl", "js_test")
load("@aspect_rules_js//js:defs.bzl", "js_binary", "js_image_layer", "js_run_binary", "js_test")
load("@bazel_lib//lib:write_source_files.bzl", "write_source_files")
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@npm//npm/private/test:@rspack/cli/package_json.bzl", "bin")
load("@rules_shell//shell:sh_test.bzl", "sh_test")
load(":generated_pkg_json_test.bzl", "generated_pkg_json_test")
load(":npm_auth_test.bzl", "npm_auth_test_suite")
Expand Down Expand Up @@ -47,7 +48,7 @@ write_source_files(
"snapshots/next_links_defs.bzl": "@npm__next__15.2.6_1642820312__links//:defs.bzl",
"snapshots/rollup_links_defs.bzl": "@npm__rollup__4.55.2__links//:defs.bzl",
"snapshots/package_json.bzl": "@npm__rollup__4.55.2//:package_json.bzl",
"snapshots/package_json_with_dashes.bzl": "@npm__webpack-bundle-analyzer__4.5.0_bufferutil_4.0.8//:package_json.bzl",
# "snapshots/package_json_with_dashes.bzl": "@npm__webpack-bundle-analyzer__4.5.0_bufferutil_4.0.8//:package_json.bzl",
},
tags = [
"skip-on-bazel8",
Expand Down Expand Up @@ -120,3 +121,68 @@ js_test(
data = [":node_modules"],
entry_point = "versions.js",
)

bin.rspack(
name = "rspack_build",
chdir = package_name(),
testonly = True,
args = [
"build",
"--config",
"rspack_config.cjs"
],
srcs = [
"rspack_entry.js",
"rspack_config.cjs",
":node_modules/@rspack/cli",
],
outs = [
"rspack/main.bundle.js"
]
)



# A test simply running the compiled bundle
js_test(
name = "esbuilt_binary_test",
entry_point = "esbuild_test_out.js",
)

# A binary version of the compiled bundle
js_binary(
name = "rspack_built_binary",
testonly = True,
entry_point = "rspack/main.bundle.js",
)

platform(
name = "amd64_linux",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
)

# The compiled bundle in a platform specific container image layer
js_image_layer(
name = "rspack_binary_image",
testonly = True,
binary = ":rspack_built_binary",
platform = ":amd64_linux",
)

build_test(
name = "esbuild_test",
targets = [
# The esbuild npm package including lifecycle hooks to verify platform deps
":node_modules/esbuild",

# The bundle target and its output which required running esbuild
":esbuild_build",
"esbuild_test_out.js",

# The transitioned image using the bundle which required transitioning
":rspack_binary_image",
],
)
15 changes: 15 additions & 0 deletions npm/private/test/esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// A simple wrapper around esbuild accepting 1 input file and 2 output file argument.

const [, , input, output] = process.argv

console.error('[ESBUILD] ', input, ' -> ', output)

require('esbuild')
.build({
entryPoints: [input],
outfile: output,
bundle: true,
platform: 'node',
target: 'node14',
})
.catch(() => process.exit(1))
7 changes: 4 additions & 3 deletions npm/private/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
"@figma/nodegit": "^0.28.0-figma.6",
"@kubernetes/client-node": "https://github.com/kubernetes-client/javascript#cb821e92b766f6ffba6ad8cf5e7ff6ba77c3a1c9",
"@plotly/regl": "2.1.2",
"bufferutil": "4.0.8",
"debug": "ngokevin/debug#9742c5f383a6f8046241920156236ade8ec30d53",
"esbuild": "0.24.0",
"esbuild": "0.27.3",
"handlebars-helpers/helper-date": "github:coda/helper-date#a2cb4284148cbba7d36173dff4c7c60ce59eae55",
"hot-shots": "10.0.0",
"inline-fixtures": "https://registry.yarnpkg.com/inline-fixtures/-/inline-fixtures-1.1.0.tgz#5f9edf644ac02a1322012dbbb9f0a4739831d662",
Expand All @@ -35,6 +34,8 @@
"unused": "latest",
"test-npm_package": "workspace:*",
"webpack-bundle-analyzer": "4.5.0",
"pngjs": "5.0.0"
"pngjs": "5.0.0",
"@rspack/cli": "1.7.11",
"@rspack/core": "1.7.11"
}
}
12 changes: 12 additions & 0 deletions npm/private/test/rspack_config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { defineConfig } = require('@rspack/cli');
const path = require("path");

module.exports = defineConfig({
entry: {
main: './rspack_entry.js',
},
output: {
path: path.resolve(__dirname, 'rspack/'),
filename: '[name].bundle.js',
},
});
1 change: 1 addition & 0 deletions npm/private/test/rspack_entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('hello rspack');
Loading