From 284d2248aa5bcf3c5c116e2ed334498cf4e57062 Mon Sep 17 00:00:00 2001 From: Jason Bedard Date: Mon, 22 Dec 2025 17:30:34 -0800 Subject: [PATCH] test: add additional esm sandbox assertions --- .../npm_translate_lock_LTE4Nzc1MDcwNjU= | 6 +- examples/js_binary/BUILD.bazel | 476 ++++++++++-------- .../{require_acorn.js => require_acorn.cjs} | 0 examples/js_binary/require_acorn.mjs | 10 + examples/js_binary/test.mjs | 2 + examples/macro/mocha.bzl | 2 + examples/macro/test.js | 11 + examples/npm_deps/BUILD.bazel | 115 ++++- examples/npm_package/packages/pkg_a/index.js | 14 + .../npm_package/packages/pkg_b/BUILD.bazel | 3 +- examples/npm_package/packages/pkg_b/index.cjs | 33 ++ examples/npm_package/packages/pkg_b/index.js | 19 - examples/npm_package/packages/pkg_b/index.mjs | 31 ++ .../npm_package/packages/pkg_b/package.json | 7 + .../npm_package/packages/pkg_c/BUILD.bazel | 6 +- .../packages/pkg_c/data1/package.json | 7 + .../packages/pkg_c/data2/package.json | 7 + .../npm_package/packages/pkg_c/src/index.cjs | 17 + .../npm_package/packages/pkg_c/src/index.js | 1 - .../npm_package/packages/pkg_c/src/index.mjs | 19 + .../npm_package/packages/pkg_d/BUILD.bazel | 4 +- examples/npm_package/packages/pkg_d/index.cjs | 34 ++ examples/npm_package/packages/pkg_d/index.js | 19 - examples/npm_package/packages/pkg_d/index.mjs | 30 ++ .../npm_package/packages/pkg_d/package.json | 8 + .../npm_package/packages/pkg_e/BUILD.bazel | 4 +- examples/npm_package/packages/pkg_e/index.cjs | 30 ++ examples/npm_package/packages/pkg_e/index.js | 6 - examples/npm_package/packages/pkg_e/index.mjs | 31 ++ .../npm_package/packages/pkg_e/package.json | 7 + js/private/test/image/checksum_test.expected | 2 +- ...yers_nomatch_test_package_store_1p.listing | 2 +- .../test/image/custom_owner_test_app.listing | 5 +- ...custom_owner_test_package_store_1p.listing | 2 +- .../test/image/default_test_app.listing | 5 +- .../default_test_package_store_1p.listing | 2 +- .../image/regex_edge_cases_test_app.listing | 5 +- ...x_edge_cases_test_package_store_1p.listing | 2 +- 38 files changed, 708 insertions(+), 276 deletions(-) rename examples/js_binary/{require_acorn.js => require_acorn.cjs} (100%) create mode 100644 examples/js_binary/require_acorn.mjs create mode 100644 examples/js_binary/test.mjs create mode 100644 examples/npm_package/packages/pkg_b/index.cjs delete mode 100644 examples/npm_package/packages/pkg_b/index.js create mode 100644 examples/npm_package/packages/pkg_b/index.mjs create mode 100644 examples/npm_package/packages/pkg_c/src/index.cjs delete mode 100644 examples/npm_package/packages/pkg_c/src/index.js create mode 100644 examples/npm_package/packages/pkg_c/src/index.mjs create mode 100644 examples/npm_package/packages/pkg_d/index.cjs delete mode 100644 examples/npm_package/packages/pkg_d/index.js create mode 100644 examples/npm_package/packages/pkg_d/index.mjs create mode 100644 examples/npm_package/packages/pkg_e/index.cjs delete mode 100644 examples/npm_package/packages/pkg_e/index.js create mode 100644 examples/npm_package/packages/pkg_e/index.mjs diff --git a/.aspect/rules/external_repository_action_cache/npm_translate_lock_LTE4Nzc1MDcwNjU= b/.aspect/rules/external_repository_action_cache/npm_translate_lock_LTE4Nzc1MDcwNjU= index 7284883539..287fd099d7 100755 --- a/.aspect/rules/external_repository_action_cache/npm_translate_lock_LTE4Nzc1MDcwNjU= +++ b/.aspect/rules/external_repository_action_cache/npm_translate_lock_LTE4Nzc1MDcwNjU= @@ -15,9 +15,9 @@ examples/npm_deps/package.json=-929156430 examples/npm_deps/patches/meaning-of-life@1.0.0-pnpm.patch=-442666336 examples/npm_package/libs/lib_a/package.json=-1377103079 examples/npm_package/packages/pkg_a/package.json=1006424040 -examples/npm_package/packages/pkg_b/package.json=1041247977 -examples/npm_package/packages/pkg_d/package.json=1110895851 -examples/npm_package/packages/pkg_e/package.json=-2145239245 +examples/npm_package/packages/pkg_b/package.json=-1129449456 +examples/npm_package/packages/pkg_d/package.json=1146506398 +examples/npm_package/packages/pkg_e/package.json=2063663382 examples/runfiles/package.json=-1545884645 examples/stack_traces/package.json=2011229626 examples/webpack_cli/package.json=1911342006 diff --git a/examples/js_binary/BUILD.bazel b/examples/js_binary/BUILD.bazel index a20a605c8b..40a6aff76f 100644 --- a/examples/js_binary/BUILD.bazel +++ b/examples/js_binary/BUILD.bazel @@ -22,87 +22,114 @@ npm_link_all_packages(name = "node_modules") # A simple program that runs the Acorn JS parser to produce an AST js_binary( - name = "bin", + name = "bin_mjs", # Reference the location where the acorn npm module was linked in the root Bazel package data = ["//:node_modules/acorn"], - entry_point = "require_acorn.js", + entry_point = "require_acorn.mjs", +) + +js_binary( + name = "bin_cjs", + # Reference the location where the acorn npm module was linked in the root Bazel package + data = ["//:node_modules/acorn"], + entry_point = "require_acorn.cjs", ) #################################################### # Use case 1 # js_binary can be used with genrule # because everything it needs to run is in the runfiles -genrule( - name = "run1", - srcs = [], - outs = ["out1"], - # All js_binary rules need a BAZEL_BINDIR environment variable set so they can - # run from that directory as the working directory. - cmd = "BAZEL_BINDIR=$(BINDIR) $(location :bin) {}/out1".format(package_name()), - tools = [":bin"], -) - -diff_test( - name = "test_js_binary_under_genrule", - file1 = "//examples:expected_one_ast.json", - file2 = "out1", -) +[ + [ + genrule( + name = "run1_%s" % t, + srcs = [], + outs = ["out1-%s" % t], + # All js_binary rules need a BAZEL_BINDIR environment variable set so they can + # run from that directory as the working directory. + cmd = "BAZEL_BINDIR=$(BINDIR) $(location :bin_%s) {}/out1-%s".format(package_name()) % (t, t), + tools = [":bin_%s" % t], + ), + diff_test( + name = "test_js_binary_under_genrule_%s" % t, + file1 = "//examples:expected_one_ast.json", + file2 = "out1-%s" % t, + ), + ] + for t in [ + "mjs", + "cjs", + ] +] #################################################### # Use case 2 # Using js_run_binary has some nice syntax sugar vs. # a genrule() or the run_binary rule from bazel-skylib. - -js_run_binary( - name = "run2", - srcs = [], - outs = ["out2"], - args = ["out2"], - chdir = package_name(), - # Request that the rules_js launcher prints extra information - log_level = "debug", - tool = ":bin", - # Uncomment the setting below to see debug output even on a - # successful run of the build action. - # silent_on_success = False, -) - -diff_test( - name = "test_js_binary_under_js_run_binary", - file1 = "//examples:expected_one_ast.json", - file2 = "out2", -) +[ + [ + js_run_binary( + name = "run2_%s" % t, + srcs = [], + outs = ["out2_%s" % t], + args = ["out2_%s" % t], + chdir = package_name(), + # Request that the rules_js launcher prints extra information + log_level = "debug", + tool = ":bin_%s" % t, + # Uncomment the setting below to see debug output even on a + # successful run of the build action. + # silent_on_success = False, + ), + diff_test( + name = "test_js_binary_under_js_run_binary_%s" % t, + file1 = "//examples:expected_one_ast.json", + file2 = "out2_%s" % t, + ), + ] + for t in [ + "mjs", + "cjs", + ] +] # Also test with local (no sandbox) execution by setting execution_requirements "local" to "1". # Bazel sets different environment variables in this case such as RUNFILES_MANIFEST_FILE. # This case tests for regression of the fix in https://github.com/aspect-build/rules_js/pull/323. -js_run_binary( - name = "run2_local", - srcs = [], - outs = ["out2_local"], - args = ["out2_local"], - chdir = package_name(), - execution_requirements = { - "local": "1", - }, - # Request that the rules_js launcher prints extra information - log_level = "debug", - tool = ":bin", - # Uncomment the setting below to see debug output even on a - # successful run of the build action. - # silent_on_success = False, -) - -diff_test( - name = "test_js_binary_under_js_run_binary_local", - file1 = "//examples:expected_one_ast.json", - file2 = "out2_local", -) +[ + [ + js_run_binary( + name = "run2_local_%s" % t, + srcs = [], + outs = ["out2_local_%s" % t], + args = ["out2_local_%s" % t], + chdir = package_name(), + execution_requirements = { + "local": "1", + }, + # Request that the rules_js launcher prints extra information + log_level = "debug", + tool = ":bin_%s" % t, + # Uncomment the setting below to see debug output even on a + # successful run of the build action. + # silent_on_success = False, + ), + diff_test( + name = "test_js_binary_under_js_run_binary_local_%s" % t, + file1 = "//examples:expected_one_ast.json", + file2 = "out2_local_%s" % t, + ), + ] + for t in [ + "mjs", + "cjs", + ] +] # Also test with copy_data_to_bin disabled copy_to_bin( - name = "require_acorn_js", - srcs = ["require_acorn.js"], + name = "require_acorn_mjs", + srcs = ["require_acorn.mjs"], ) js_binary( @@ -110,7 +137,7 @@ js_binary( copy_data_to_bin = False, # Reference the location where the acorn npm module was linked in the root Bazel package data = ["//:node_modules/acorn"], - entry_point = ":require_acorn_js", + entry_point = ":require_acorn_mjs", ) js_run_binary( @@ -140,7 +167,13 @@ diff_test( # Bazel will check the exit code: a zero means the test passes, anything else means it fails. js_test( - name = "test_test", + name = "test_mjs", + data = ["//:node_modules/@types/node"], + entry_point = "test.mjs", +) + +js_test( + name = "test_cjs", data = ["//:node_modules/@types/node"], entry_point = "test.js", ) @@ -151,8 +184,8 @@ js_test( # This relies on @mycorp/pkg-a and @mycorp/pkg-b which are packages within this monorepo. write_file( - name = "write4", - out = "case4.js", + name = "write4_cjs", + out = "case4.cjs", content = [ """require('fs').writeFileSync( process.argv[2], @@ -161,74 +194,100 @@ write_file( ], ) -js_binary( - name = "bin4", - data = [ - ":node_modules/@mycorp/pkg-a", - "//:node_modules/@mycorp/pkg-b", - ], - entry_point = "case4.js", -) - -js_run_binary( - name = "run4-a", - args = [ - "out4-dist/out4-a", - "@mycorp/pkg-a", - ], - chdir = package_name(), - # This specifically tests that a `select` can be used when setting `env`. - env = select({ - "//conditions:default": { - "NODE_ENV": "production", - }, - }), - out_dirs = ["out4-dist"], - tool = ":bin4", -) - -directory_path( - name = "out4-a", - directory = ":run4-a", - path = "out4-a", -) - -diff_test( - name = "test4-a", - file1 = "//examples:expected_one_ast.json", - file2 = ":out4-a", -) - -js_run_binary( - name = "run4-b", - outs = ["out4-b"], - args = [ - "out4-b", - "@mycorp/pkg-b", +write_file( + name = "write4_mjs", + out = "case4.mjs", + content = [ + "import { writeFileSync } from 'fs'", + """writeFileSync( + process.argv[2], + (await import(process.argv[3])).toAst("1") + )""", ], - chdir = package_name(), - # This specifically tests that a `select` and `|` operator can be used when setting `env`. - env = {} | select({ - "//conditions:default": { - "NODE_ENV": "production", - }, - }), - tool = ":bin4", ) -diff_test( - name = "test4-b", - file1 = "//examples:expected_one_ast.json", - file2 = ":out4-b", -) +[ + [ + js_binary( + name = "bin4_%s" % t, + data = [ + ":node_modules/@mycorp/pkg-a", + "//:node_modules/@mycorp/pkg-b", + ], + entry_point = "case4.%s" % t, + ), + js_run_binary( + name = "run4-a_%s" % t, + args = [ + "out4-%s-dist/out4-a" % t, + "@mycorp/pkg-a", + ], + chdir = package_name(), + # This specifically tests that a `select` can be used when setting `env`. + env = select({ + "//conditions:default": { + "NODE_ENV": "production", + }, + }), + out_dirs = ["out4-%s-dist" % t], + tool = ":bin4_%s" % t, + ), + directory_path( + name = "out4-a-%s" % t, + directory = ":run4-a_%s" % t, + path = "out4-a", + ), + diff_test( + name = "test4-%s-a" % t, + file1 = "//examples:expected_one_ast.json", + file2 = ":out4-a-%s" % t, + ), + js_run_binary( + name = "run4-b_%s" % t, + outs = ["out4-b_%s" % t], + args = [ + "out4-b_%s" % t, + "@mycorp/pkg-b", + ], + chdir = package_name(), + # This specifically tests that a `select` and `|` operator can be used when setting `env`. + env = {} | select({ + "//conditions:default": { + "NODE_ENV": "production", + }, + }), + tool = ":bin4_%s" % t, + ), + diff_test( + name = "test4-b_%s" % t, + file1 = "//examples:expected_one_ast.json", + file2 = ":out4-b_%s" % t, + ), + ] + for t in [ + "mjs", + "cjs", + ] +] ####################################### # Use case 5 # js_run_binary that reads a data file at runtime. write_file( - name = "write5", - out = "case5.js", + name = "write5_mjs", + out = "case5.mjs", + content = [ + "import { writeFileSync } from 'node:fs';", + "import { join } from 'node:path';", + "const jsonData = await import(join(process.cwd(), 'data.json'), { with: { type: 'json' } });", + "writeFileSync(process.argv[2], JSON.stringify(jsonData.default))", + ], +) + +write_file( + name = "write5_cjs", + out = "case5.cjs", content = ["""\ require('fs').writeFileSync( process.argv[2], @@ -242,25 +301,31 @@ write_file( content = ["{\"answer\":42}"], ) -js_binary( - name = "bin5", - entry_point = "case5.js", -) - -js_run_binary( - name = "run5", - srcs = ["data.json"], - outs = ["out5"], - args = ["out5"], - chdir = package_name(), - tool = ":bin5", -) - -diff_test( - name = "test5", - file1 = "expected5", - file2 = "out5", -) +[ + [ + js_binary( + name = "bin5_%s" % t, + entry_point = "case5.%s" % t, + ), + js_run_binary( + name = "run5_%s" % t, + srcs = ["data.json"], + outs = ["out5_%s" % t], + args = ["out5_%s" % t], + chdir = package_name(), + tool = ":bin5_%s" % t, + ), + diff_test( + name = "test5_%s" % t, + file1 = "expected5", + file2 = "out5_%s" % t, + ), + ] + for t in [ + "mjs", + "cjs", + ] +] ####################################### # Use case 6 @@ -514,7 +579,7 @@ genrule( # because everything it needs to run is in the runfiles custom_rule( name = "run11", - tool = ":bin", + tool = ":bin_mjs", ) diff_test( @@ -531,7 +596,7 @@ custom_rule( execution_requirements = { "local": "1", }, - tool = ":bin", + tool = ":bin_mjs", ) diff_test( @@ -556,8 +621,8 @@ js_test( # https://github.com/aspect-build/rules_js/issues/471 write_file( - name = "write13", - out = "case13.js", + name = "write13_cjs", + out = "case13.cjs", content = [ """require('fs').writeFileSync( process.argv[2], @@ -566,13 +631,17 @@ write_file( ], ) -js_binary( - name = "bin13", - data = [ - "//:node_modules/@mycorp/pkg-c1", - "//:node_modules/@mycorp/pkg-c2", +write_file( + name = "write13_mjs", + out = "case13.mjs", + content = [ + "import { writeFileSync } from 'fs';", + """ + writeFileSync( + process.argv[2], + JSON.stringify((await import(process.argv[3])).default) + )""", ], - entry_point = "case13.js", ) write_file( @@ -584,29 +653,6 @@ write_file( visibility = ["//visibility:private"], ) -js_run_binary( - name = "run13-1", - args = [ - "out13-dist-1/out13-1", - "@mycorp/pkg-c1", - ], - chdir = package_name(), - out_dirs = ["out13-dist-1"], - tool = ":bin13", -) - -directory_path( - name = "out13-1", - directory = ":run13-1", - path = "out13-1", -) - -diff_test( - name = "test13-1", - file1 = ":expected13-1-out.json", - file2 = ":out13-1", -) - write_file( name = "expected13-2-out", out = "expected13-2-out.json", @@ -616,25 +662,59 @@ write_file( visibility = ["//visibility:private"], ) -js_run_binary( - name = "run13-2", - args = [ - "out13-dist-2/out13-2", - "@mycorp/pkg-c2", - ], - chdir = package_name(), - out_dirs = ["out13-dist-2"], - tool = ":bin13", -) - -directory_path( - name = "out13-2", - directory = ":run13-2", - path = "out13-2", -) - -diff_test( - name = "test13-2", - file1 = ":expected13-2-out.json", - file2 = ":out13-2", -) +[ + [ + js_binary( + name = "bin13_%s" % t, + data = [ + "//:node_modules/@mycorp/pkg-c1", + "//:node_modules/@mycorp/pkg-c2", + ], + entry_point = "case13.%s" % t, + ), + js_run_binary( + name = "run13-1_%s" % t, + args = [ + "out13-dist-1_%s/out13-1" % t, + "@mycorp/pkg-c1", + ], + chdir = package_name(), + out_dirs = ["out13-dist-1_%s" % t], + tool = ":bin13_%s" % t, + ), + directory_path( + name = "out13-1_%s" % t, + directory = ":run13-1_%s" % t, + path = "out13-1", + ), + diff_test( + name = "test13-1_%s" % t, + file1 = ":expected13-1-out.json", + file2 = ":out13-1_%s" % t, + ), + js_run_binary( + name = "run13-2_%s" % t, + args = [ + "out13-dist-2_%s/out13-2" % t, + "@mycorp/pkg-c2", + ], + chdir = package_name(), + out_dirs = ["out13-dist-2_%s" % t], + tool = ":bin13_%s" % t, + ), + directory_path( + name = "out13-2_%s" % t, + directory = ":run13-2_%s" % t, + path = "out13-2", + ), + diff_test( + name = "test13-2_%s" % t, + file1 = ":expected13-2-out.json", + file2 = ":out13-2_%s" % t, + ), + ] + for t in [ + "mjs", + "cjs", + ] +] diff --git a/examples/js_binary/require_acorn.js b/examples/js_binary/require_acorn.cjs similarity index 100% rename from examples/js_binary/require_acorn.js rename to examples/js_binary/require_acorn.cjs diff --git a/examples/js_binary/require_acorn.mjs b/examples/js_binary/require_acorn.mjs new file mode 100644 index 0000000000..c08a5e12d4 --- /dev/null +++ b/examples/js_binary/require_acorn.mjs @@ -0,0 +1,10 @@ +/** + * @fileoverview minimal test program that requires a third-party package from npm + */ +import { writeFileSync } from 'node:fs' +import { parse } from 'acorn' + +writeFileSync( + process.argv[2], + JSON.stringify(parse('1', { ecmaVersion: 2020 })) + '\n' +) diff --git a/examples/js_binary/test.mjs b/examples/js_binary/test.mjs new file mode 100644 index 0000000000..8e700623e3 --- /dev/null +++ b/examples/js_binary/test.mjs @@ -0,0 +1,2 @@ +console.log('\n\n\nThis is only a test.\n\n\n') +console.log(import.meta.resolve('@types/node/package.json')) diff --git a/examples/macro/mocha.bzl b/examples/macro/mocha.bzl index 367260a78a..275097538d 100644 --- a/examples/macro/mocha.bzl +++ b/examples/macro/mocha.bzl @@ -22,5 +22,7 @@ def mocha_test(name, srcs, args = [], data = [], env = {}, **kwargs): # to the location Bazel expects. "MOCHA_FILE": "$$XML_OUTPUT_FILE", }), + preserve_symlinks_main = False, + copy_data_to_bin = False, **kwargs ) diff --git a/examples/macro/test.js b/examples/macro/test.js index ec3591f222..13f2ec5442 100644 --- a/examples/macro/test.js +++ b/examples/macro/test.js @@ -1,4 +1,5 @@ const assert = require('assert') +const { dirname } = require('node:path') describe('mocha', () => { it('integrates with Bazel', () => { @@ -8,4 +9,14 @@ describe('mocha', () => { it('is in bazel-out', () => { assert.match(__dirname, /bazel-out/) }) + + it('is sandboxed', () => { + assert.match(process.cwd(), /examples\/macro\/test_\/test\.runfiles/) + assert.match(__dirname, /examples\/macro\/test_\/test\.runfiles/) + assert.match( + __filename, + /-sandbox\/\d+\/execroot\/_main\/bazel-out\/[^/]+\/bin\/examples\/macro\/test_\/test.runfiles\/_main\/examples\/macro\/test\.js/ + ) + assert.equal(__dirname, dirname(__filename)) + }) }) diff --git a/examples/npm_deps/BUILD.bazel b/examples/npm_deps/BUILD.bazel index 9c2dcb2a8c..36fdfcfd26 100644 --- a/examples/npm_deps/BUILD.bazel +++ b/examples/npm_deps/BUILD.bazel @@ -237,19 +237,56 @@ js_test( # Case 7: use a first-party npm package within our Bazel monorepo workspace from an npm_package target write_file( - name = "write7", - out = "case7.js", + name = "write7_a", + out = "case7_a.js", content = ["require('@mycorp/pkg-a')"], ) js_test( - name = "test7", + name = "test7_a", data = [ ":node_modules/@mycorp/pkg-a", ], - entry_point = "case7.js", + entry_point = "case7_a.js", ) +write_file( + name = "write7_b_mjs", + out = "case7_b.mjs", + content = [ + "import { sandboxAssert, getAcornVersion } from '@mycorp/pkg-b'", + "import { deepEqual } from 'node:assert'", + "sandboxAssert();", + "(await import('@mycorp/pkg-b')).sandboxAssert();", + "deepEqual('8.7.1', getAcornVersion())", + ], +) + +write_file( + name = "write7_b_cjs", + out = "case7_b.cjs", + content = [ + "const { sandboxAssert, getAcornVersion } = require('@mycorp/pkg-b')", + "const { deepEqual } = require('node:assert')", + "sandboxAssert()", + "deepEqual('8.7.1', getAcornVersion())", + ], +) + +[ + js_test( + name = "test7_b_%s" % t, + data = [ + "//:node_modules/@mycorp/pkg-b", + ], + entry_point = "case7_b.%s" % t, + ) + for t in [ + "cjs", + "mjs", + ] +] + ####################################### # Case 8: patch applied via `pnpm.patchesDependencies` then by `patches` js_test( @@ -264,32 +301,82 @@ js_test( # Case 9: use a first-party npm package within our Bazel monorepo workspace from a js_library target write_file( - name = "write9", - out = "case9.js", - content = ["require('@mycorp/pkg-d')"], + name = "write9_cjs", + out = "case9.cjs", + content = [ + "const { sandboxAssert, getAcornVersion } = require('@mycorp/pkg-d')", + "const { deepEqual } = require('node:assert')", + "sandboxAssert()", + "deepEqual('8.7.1', getAcornVersion())", + ], +) + +write_file( + name = "write9_mjs", + out = "case9.mjs", + content = [ + "import { sandboxAssert, getAcornVersion } from '@mycorp/pkg-d'", + "import { deepEqual } from 'node:assert'", + "sandboxAssert();", + "(await import('@mycorp/pkg-d')).sandboxAssert();", + "deepEqual('8.7.1', getAcornVersion())", + ], ) js_test( - name = "test9", + name = "test9_cjs", data = [ ":node_modules/@mycorp/pkg-d", ], - entry_point = "case9.js", + entry_point = "case9.cjs", +) + +js_test( + name = "test9_mjs", + data = [ + ":node_modules/@mycorp/pkg-d", + ], + entry_point = "case9.mjs", ) ####################################### # Case 10: use a first-party npm package a transitive dependency on a monorepo workspace from a js_library target write_file( - name = "write10", - out = "case10.js", - content = ["require('@mycorp/pkg-e')"], + name = "write10_cjs", + out = "case10.cjs", + content = [ + "const { sandboxAssert, getAcornVersion } = require('@mycorp/pkg-e')", + "const { deepEqual } = require('node:assert')", + "sandboxAssert()", + "deepEqual('8.7.1', getAcornVersion())", + ], +) + +write_file( + name = "write10_mjs", + out = "case10.mjs", + content = [ + "import { sandboxAssert, getAcornVersion } from '@mycorp/pkg-e'", + "import { deepEqual } from 'node:assert'", + "sandboxAssert();", + "(await import('@mycorp/pkg-e')).sandboxAssert();", + "deepEqual('8.7.1', getAcornVersion())", + ], +) + +js_test( + name = "test10_cjs", + data = [ + ":node_modules/@mycorp/pkg-e", + ], + entry_point = "case10.cjs", ) js_test( - name = "test10", + name = "test10_mjs", data = [ ":node_modules/@mycorp/pkg-e", ], - entry_point = "case10.js", + entry_point = "case10.mjs", ) diff --git a/examples/npm_package/packages/pkg_a/index.js b/examples/npm_package/packages/pkg_a/index.js index 25475f9a81..dcce73de16 100644 --- a/examples/npm_package/packages/pkg_a/index.js +++ b/examples/npm_package/packages/pkg_a/index.js @@ -13,9 +13,23 @@ function getAcornVersion() { return acorn.version } +function sandboxAssert() { + if (!/-sandbox\/\d+\/execroot\//.test(__filename)) { + throw new Error(`Not in sandbox: ${__filename}`) + } + + // Use of npm_package() copies files into the npm package store. + if (!__filename.includes('/node_modules/.aspect_rules_js/')) { + throw new Error(`Not in package store: ${__filename}`) + } +} + +sandboxAssert() + module.exports = { toAst, getAcornVersion, uuid, a, + sandboxAssert, } diff --git a/examples/npm_package/packages/pkg_b/BUILD.bazel b/examples/npm_package/packages/pkg_b/BUILD.bazel index 8be1bf977b..dec7a801d4 100644 --- a/examples/npm_package/packages/pkg_b/BUILD.bazel +++ b/examples/npm_package/packages/pkg_b/BUILD.bazel @@ -8,7 +8,8 @@ npm_link_all_packages(name = "node_modules") npm_package( name = "pkg", srcs = [ - "index.js", + "index.cjs", + "index.mjs", "package.json", ], data = [ diff --git a/examples/npm_package/packages/pkg_b/index.cjs b/examples/npm_package/packages/pkg_b/index.cjs new file mode 100644 index 0000000000..40ef71316a --- /dev/null +++ b/examples/npm_package/packages/pkg_b/index.cjs @@ -0,0 +1,33 @@ +/** + * @fileoverview minimal test program that requires a third-party package from npm + */ +const acorn = require('acorn') +const { v4: uuid } = require('uuid') + +function toAst(program) { + return JSON.stringify(acorn.parse(program, { ecmaVersion: 2020 })) + '\n' +} + +function getAcornVersion() { + return acorn.version +} + +function sandboxAssert() { + if (!/-sandbox\/\d+\/execroot\//.test(__filename)) { + throw new Error(`Not in sandbox: ${__filename}`) + } + + // Use of npm_package() copies files into the npm package store. + if (!__filename.includes('/node_modules/.aspect_rules_js/')) { + throw new Error(`Not in package store: ${__filename}`) + } +} + +sandboxAssert() + +module.exports = { + toAst, + getAcornVersion, + uuid, + sandboxAssert, +} diff --git a/examples/npm_package/packages/pkg_b/index.js b/examples/npm_package/packages/pkg_b/index.js deleted file mode 100644 index fef5665088..0000000000 --- a/examples/npm_package/packages/pkg_b/index.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @fileoverview minimal test program that requires a third-party package from npm - */ -const acorn = require('acorn') -const { v4: uuid } = require('uuid') - -function toAst(program) { - return JSON.stringify(acorn.parse(program, { ecmaVersion: 2020 })) + '\n' -} - -function getAcornVersion() { - return acorn.version -} - -module.exports = { - toAst, - getAcornVersion, - uuid, -} diff --git a/examples/npm_package/packages/pkg_b/index.mjs b/examples/npm_package/packages/pkg_b/index.mjs new file mode 100644 index 0000000000..3502e185fb --- /dev/null +++ b/examples/npm_package/packages/pkg_b/index.mjs @@ -0,0 +1,31 @@ +/** + * @fileoverview minimal test program that requires a third-party package from npm + */ +import { fileURLToPath } from 'node:url' +import * as acorn from 'acorn' + +export { acorn } +export { v4 as uuid } from 'uuid' + +export function toAst(program) { + return JSON.stringify(acorn.parse(program, { ecmaVersion: 2020 })) + '\n' +} + +export function getAcornVersion() { + return acorn.version +} + +export function sandboxAssert() { + const __filename = fileURLToPath(import.meta.url) + + if (!/-sandbox\/\d+\/execroot\//.test(__filename)) { + throw new Error(`Not in sandbox: ${__filename}`) + } + + // Use of npm_package() copies files into the npm package store. + if (!__filename.includes('/node_modules/.aspect_rules_js/')) { + throw new Error(`Not in package store: ${__filename}`) + } +} + +sandboxAssert() diff --git a/examples/npm_package/packages/pkg_b/package.json b/examples/npm_package/packages/pkg_b/package.json index 95862f6c8f..dba192534d 100644 --- a/examples/npm_package/packages/pkg_b/package.json +++ b/examples/npm_package/packages/pkg_b/package.json @@ -1,6 +1,13 @@ { "name": "@mycorp/pkg-b", "private": true, + "type": "module", + "exports": { + ".": { + "import": "./index.mjs", + "require": "./index.cjs" + } + }, "dependencies": { "uuid": "8.3.2" }, diff --git a/examples/npm_package/packages/pkg_c/BUILD.bazel b/examples/npm_package/packages/pkg_c/BUILD.bazel index 2e246c3a10..f3f5030b33 100644 --- a/examples/npm_package/packages/pkg_c/BUILD.bazel +++ b/examples/npm_package/packages/pkg_c/BUILD.bazel @@ -9,7 +9,8 @@ npm_package( srcs = [ "data1/package.json", "data1/pkg-c.json", - "src/index.js", + "src/index.cjs", + "src/index.mjs", ], package = "@mycorp/pkg-c1", root_paths = [ @@ -25,7 +26,8 @@ npm_package( srcs = [ "data2/package.json", "data2/pkg-c.json", - "src/index.js", + "src/index.cjs", + "src/index.mjs", ], package = "@mycorp/pkg-c2", root_paths = [ diff --git a/examples/npm_package/packages/pkg_c/data1/package.json b/examples/npm_package/packages/pkg_c/data1/package.json index 2d75d20ba5..6ebc5e5d42 100644 --- a/examples/npm_package/packages/pkg_c/data1/package.json +++ b/examples/npm_package/packages/pkg_c/data1/package.json @@ -1,5 +1,12 @@ { "name": "@mycorp/pkg-c1", + "type": "module", + "exports": { + ".": { + "import": "./index.mjs", + "require": "./index.cjs" + } + }, "private": true, "dependencies": {} } diff --git a/examples/npm_package/packages/pkg_c/data2/package.json b/examples/npm_package/packages/pkg_c/data2/package.json index c42a189569..4dcee33b0a 100644 --- a/examples/npm_package/packages/pkg_c/data2/package.json +++ b/examples/npm_package/packages/pkg_c/data2/package.json @@ -1,5 +1,12 @@ { "name": "@mycorp/pkg-c2", + "type": "module", + "exports": { + ".": { + "import": "./index.mjs", + "require": "./index.cjs" + } + }, "private": true, "dependencies": {} } diff --git a/examples/npm_package/packages/pkg_c/src/index.cjs b/examples/npm_package/packages/pkg_c/src/index.cjs new file mode 100644 index 0000000000..6ed403bd90 --- /dev/null +++ b/examples/npm_package/packages/pkg_c/src/index.cjs @@ -0,0 +1,17 @@ +const pkgC = require('./pkg-c.json') + +function sandboxAssert() { + if (!/-sandbox\/\d+\/execroot\//.test(__filename)) { + throw new Error(`Not in sandbox: ${__filename}`) + } + + // Use of npm_package() copies files into the npm package store. + if (!__filename.includes('/node_modules/.aspect_rules_js/')) { + throw new Error(`Not in package store: ${__filename}`) + } +} + +sandboxAssert() + +module.exports.name = pkgC.name +module.exports.sandboxAssert = sandboxAssert diff --git a/examples/npm_package/packages/pkg_c/src/index.js b/examples/npm_package/packages/pkg_c/src/index.js deleted file mode 100644 index 32e977a33a..0000000000 --- a/examples/npm_package/packages/pkg_c/src/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./pkg-c.json') diff --git a/examples/npm_package/packages/pkg_c/src/index.mjs b/examples/npm_package/packages/pkg_c/src/index.mjs new file mode 100644 index 0000000000..92d35e7952 --- /dev/null +++ b/examples/npm_package/packages/pkg_c/src/index.mjs @@ -0,0 +1,19 @@ +import { fileURLToPath } from 'node:url' +import pkgC from './pkg-c.json' assert { type: 'json' } + +export default pkgC + +export function sandboxAssert() { + const __filename = fileURLToPath(import.meta.url) + + if (!/-sandbox\/\d+\/execroot\//.test(__filename)) { + throw new Error(`Not in sandbox: ${__filename}`) + } + + // Use of npm_package() copies files into the npm package store. + if (!__filename.includes('/node_modules/.aspect_rules_js/')) { + throw new Error(`Not in package store: ${__filename}`) + } +} + +sandboxAssert() diff --git a/examples/npm_package/packages/pkg_d/BUILD.bazel b/examples/npm_package/packages/pkg_d/BUILD.bazel index 366b368fcc..61b800b37a 100644 --- a/examples/npm_package/packages/pkg_d/BUILD.bazel +++ b/examples/npm_package/packages/pkg_d/BUILD.bazel @@ -6,9 +6,11 @@ npm_link_all_packages(name = "node_modules") js_library( name = "pkg", srcs = [ - "index.js", + "index.cjs", + "index.mjs", "package.json", ], + copy_data_to_bin = False, visibility = ["//visibility:public"], # because we're linking this js_library, we must explictly add our npm dependendies to `deps` so # they are picked up my the linker. npm dependendies in `data` are not propogated through the diff --git a/examples/npm_package/packages/pkg_d/index.cjs b/examples/npm_package/packages/pkg_d/index.cjs new file mode 100644 index 0000000000..2c4fdb38df --- /dev/null +++ b/examples/npm_package/packages/pkg_d/index.cjs @@ -0,0 +1,34 @@ +/** + * @fileoverview minimal test program that requires a third-party package from npm + */ +const acorn = require('acorn') +const { v4: uuid } = require('uuid') + +function toAst(program) { + return JSON.stringify(acorn.parse(program, { ecmaVersion: 2020 })) + '\n' +} + +function getAcornVersion() { + return acorn.version +} + +function sandboxAssert() { + if (!/-sandbox\/\d+\/execroot\//.test(__filename)) { + throw new Error(`Not in sandbox: ${__filename}`) + } + + // Files are in the runfiles directory via js_library(srcs) instead + // of copies in the npm package store. + if (!__filename.startsWith(process.env.RUNFILES_DIR)) { + throw new Error(`Not runfiles: ${__filename}`) + } +} + +module.exports = { + toAst, + getAcornVersion, + uuid, + sandboxAssert, +} + +sandboxAssert() diff --git a/examples/npm_package/packages/pkg_d/index.js b/examples/npm_package/packages/pkg_d/index.js deleted file mode 100644 index fef5665088..0000000000 --- a/examples/npm_package/packages/pkg_d/index.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @fileoverview minimal test program that requires a third-party package from npm - */ -const acorn = require('acorn') -const { v4: uuid } = require('uuid') - -function toAst(program) { - return JSON.stringify(acorn.parse(program, { ecmaVersion: 2020 })) + '\n' -} - -function getAcornVersion() { - return acorn.version -} - -module.exports = { - toAst, - getAcornVersion, - uuid, -} diff --git a/examples/npm_package/packages/pkg_d/index.mjs b/examples/npm_package/packages/pkg_d/index.mjs new file mode 100644 index 0000000000..aec2726a24 --- /dev/null +++ b/examples/npm_package/packages/pkg_d/index.mjs @@ -0,0 +1,30 @@ +/** + * @fileoverview minimal test program that requires a third-party package from npm + */ +import { fileURLToPath } from 'node:url' +import * as acorn from 'acorn' +export { v4 as uuid } from 'uuid' + +export function sandboxAssert() { + const __filename = fileURLToPath(import.meta.url) + + if (!/-sandbox\/\d+\/execroot\//.test(__filename)) { + throw new Error(`Not in sandbox: ${__filename}`) + } + + // Files are in the runfiles directory via js_library(srcs) instead + // of copies in the npm package store. + if (!__filename.startsWith(process.env.RUNFILES_DIR)) { + throw new Error(`Not runfiles: ${__filename}`) + } +} + +export function toAst(program) { + return JSON.stringify(acorn.parse(program, { ecmaVersion: 2020 })) + '\n' +} + +export function getAcornVersion() { + return acorn.version +} + +sandboxAssert() diff --git a/examples/npm_package/packages/pkg_d/package.json b/examples/npm_package/packages/pkg_d/package.json index f6bd811259..45212d3850 100644 --- a/examples/npm_package/packages/pkg_d/package.json +++ b/examples/npm_package/packages/pkg_d/package.json @@ -1,5 +1,13 @@ { "name": "@mycorp/pkg-d", + "type": "module", + "main": "./index.mjs", + "exports": { + ".": { + "import": "./index.mjs", + "require": "./index.cjs" + } + }, "private": true, "dependencies": { "uuid": "8.3.2" diff --git a/examples/npm_package/packages/pkg_e/BUILD.bazel b/examples/npm_package/packages/pkg_e/BUILD.bazel index 366b368fcc..61b800b37a 100644 --- a/examples/npm_package/packages/pkg_e/BUILD.bazel +++ b/examples/npm_package/packages/pkg_e/BUILD.bazel @@ -6,9 +6,11 @@ npm_link_all_packages(name = "node_modules") js_library( name = "pkg", srcs = [ - "index.js", + "index.cjs", + "index.mjs", "package.json", ], + copy_data_to_bin = False, visibility = ["//visibility:public"], # because we're linking this js_library, we must explictly add our npm dependendies to `deps` so # they are picked up my the linker. npm dependendies in `data` are not propogated through the diff --git a/examples/npm_package/packages/pkg_e/index.cjs b/examples/npm_package/packages/pkg_e/index.cjs new file mode 100644 index 0000000000..68f65fbe2f --- /dev/null +++ b/examples/npm_package/packages/pkg_e/index.cjs @@ -0,0 +1,30 @@ +const { + getAcornVersion, + toAst, + uuid, + sandboxAssert: dSandboxAssert, +} = require('@mycorp/pkg-d') + +function sandboxAssert() { + if (!/-sandbox\/\d+\/execroot\//.test(__filename)) { + throw new Error(`Not in sandbox: ${__filename}`) + } + + // Files are in the runfiles directory via js_library(srcs) instead + // of copies in the npm package store. + if (!__filename.startsWith(process.env.RUNFILES_DIR)) { + throw new Error(`Not runfiles: ${__filename}`) + } + + dSandboxAssert() + require('@mycorp/pkg-d').sandboxAssert() +} + +sandboxAssert() + +module.exports = { + getAcornVersion, + sandboxAssert, + toAst, + uuid, +} diff --git a/examples/npm_package/packages/pkg_e/index.js b/examples/npm_package/packages/pkg_e/index.js deleted file mode 100644 index 83db516b86..0000000000 --- a/examples/npm_package/packages/pkg_e/index.js +++ /dev/null @@ -1,6 +0,0 @@ -/** - * @fileoverview minimal test program that requires a another workspace project - * that defines its package using js_library. - */ - -module.exports = require('@mycorp/pkg-d') diff --git a/examples/npm_package/packages/pkg_e/index.mjs b/examples/npm_package/packages/pkg_e/index.mjs new file mode 100644 index 0000000000..9ff70d8de7 --- /dev/null +++ b/examples/npm_package/packages/pkg_e/index.mjs @@ -0,0 +1,31 @@ +/** + * @fileoverview minimal test program that requires a another workspace project + * that defines its package using js_library. + */ + +import { fileURLToPath } from 'node:url' + +import { sandboxAssert as dSandboxAssert } from '@mycorp/pkg-d' +export { getAcornVersion, toAst, uuid } from '@mycorp/pkg-d' + +export async function sandboxAssert() { + const __filename = fileURLToPath(import.meta.url) + + if (!/-sandbox\/\d+\/execroot\//.test(__filename)) { + throw new Error(`Not in sandbox: ${__filename}`) + } + + // Files are in the runfiles directory via js_library(srcs) instead + // of copies in the npm package store. + if (!__filename.startsWith(process.env.RUNFILES_DIR)) { + throw new Error(`Not runfiles: ${__filename}`) + } + + // Static import of pkg-d + dSandboxAssert() + + // Dynamic import of pkg-d + await import('@mycorp/pkg-d').then(({ sandboxAssert }) => sandboxAssert()) +} + +await sandboxAssert() diff --git a/examples/npm_package/packages/pkg_e/package.json b/examples/npm_package/packages/pkg_e/package.json index 20ba5f1b7b..2cbab8452d 100644 --- a/examples/npm_package/packages/pkg_e/package.json +++ b/examples/npm_package/packages/pkg_e/package.json @@ -1,6 +1,13 @@ { "name": "@mycorp/pkg-e", + "type": "module", "private": true, + "exports": { + ".": { + "import": "./index.mjs", + "require": "./index.cjs" + } + }, "dependencies": { "@mycorp/pkg-d": "workspace:*" } diff --git a/js/private/test/image/checksum_test.expected b/js/private/test/image/checksum_test.expected index f48c0fd829..666804daa5 100644 --- a/js/private/test/image/checksum_test.expected +++ b/js/private/test/image/checksum_test.expected @@ -1,4 +1,4 @@ b1b723afb1aac593e55cc5050909103650a13306d1f0366c5405dcc6cf73461f js/private/test/image/cksum_node.tar 052600f3a82ab6a4cc12cab7384971c960f9c589fdbfcf21bca563c36ff7d16e js/private/test/image/cksum_package_store_3p.tar -971f291232f3ab63aff37fb66c96fbf0eddc05ea9564b9673d0d2c9bfe958994 js/private/test/image/cksum_package_store_1p.tar +214533bee38e3daf9cab29d917ab775ec6b55c726ace5ed27e957b59a95091b3 js/private/test/image/cksum_package_store_1p.tar febf95a6d554c9bda3f0515bfd5ef273ac67d31c231d8162beaef8c4b7bc72f3 js/private/test/image/cksum_node_modules.tar diff --git a/js/private/test/image/custom_layers_nomatch_test_package_store_1p.listing b/js/private/test/image/custom_layers_nomatch_test_package_store_1p.listing index 413fc48529..b44d0a2c7c 100644 --- a/js/private/test/image/custom_layers_nomatch_test_package_store_1p.listing +++ b/js/private/test/image/custom_layers_nomatch_test_package_store_1p.listing @@ -19,7 +19,7 @@ drwxr-xr-x 0 0 0 0 Jan 1 1970 ./app/js/private/test/image/bin. -r-xr-xr-x 0 0 0 224 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/a/a2/index.js -r-xr-xr-x 0 0 0 31 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/a/index.d.ts -r-xr-xr-x 0 0 0 237 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/a/index.js --r-xr-xr-x 0 0 0 423 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/index.js +-r-xr-xr-x 0 0 0 815 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/index.js -r-xr-xr-x 0 0 0 166 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/package.json lrwxrwxr-x 0 0 0 0 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/acorn -> ../../acorn@8.7.1/node_modules/acorn lrwxrwxr-x 0 0 0 0 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/chalk -> ../../chalk@5.0.1/node_modules/chalk diff --git a/js/private/test/image/custom_owner_test_app.listing b/js/private/test/image/custom_owner_test_app.listing index 7d944026fe..eaa72ff896 100644 --- a/js/private/test/image/custom_owner_test_app.listing +++ b/js/private/test/image/custom_owner_test_app.listing @@ -9,8 +9,9 @@ drwxr-xr-x 0 100 0 0 Jan 1 1970 ./js/private/test/image/bin.runf drwxr-xr-x 0 100 0 0 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/examples/npm_package/ drwxr-xr-x 0 100 0 0 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/ drwxr-xr-x 0 100 0 0 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/pkg_d/ --r-xr-xr-x 0 100 0 387 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/pkg_d/index.js --r-xr-xr-x 0 100 0 164 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/pkg_d/package.json +-r-xr-xr-x 0 100 0 810 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/pkg_d/index.cjs +-r-xr-xr-x 0 100 0 841 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/pkg_d/index.mjs +-r-xr-xr-x 0 100 0 336 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/pkg_d/package.json drwxr-xr-x 0 100 0 0 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/js/ drwxr-xr-x 0 100 0 0 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/js/private/ drwxr-xr-x 0 100 0 0 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/js/private/test/ diff --git a/js/private/test/image/custom_owner_test_package_store_1p.listing b/js/private/test/image/custom_owner_test_package_store_1p.listing index 3fa9ed3fba..36be2c2c1e 100644 --- a/js/private/test/image/custom_owner_test_package_store_1p.listing +++ b/js/private/test/image/custom_owner_test_package_store_1p.listing @@ -18,7 +18,7 @@ drwxr-xr-x 0 100 0 0 Jan 1 1970 ./js/private/test/image/bin.runf -r-xr-xr-x 0 100 0 224 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/a/a2/index.js -r-xr-xr-x 0 100 0 31 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/a/index.d.ts -r-xr-xr-x 0 100 0 237 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/a/index.js --r-xr-xr-x 0 100 0 423 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/index.js +-r-xr-xr-x 0 100 0 815 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/index.js -r-xr-xr-x 0 100 0 166 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/package.json lrwxrwxr-x 0 100 0 0 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/acorn -> ../../acorn@8.7.1/node_modules/acorn lrwxrwxr-x 0 100 0 0 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/chalk -> ../../chalk@5.0.1/node_modules/chalk diff --git a/js/private/test/image/default_test_app.listing b/js/private/test/image/default_test_app.listing index 983df884a8..d5a70f360b 100644 --- a/js/private/test/image/default_test_app.listing +++ b/js/private/test/image/default_test_app.listing @@ -9,8 +9,9 @@ drwxr-xr-x 0 0 0 0 Jan 1 1970 ./js/private/test/image/bin.runf drwxr-xr-x 0 0 0 0 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/examples/npm_package/ drwxr-xr-x 0 0 0 0 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/ drwxr-xr-x 0 0 0 0 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/pkg_d/ --r-xr-xr-x 0 0 0 387 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/pkg_d/index.js --r-xr-xr-x 0 0 0 164 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/pkg_d/package.json +-r-xr-xr-x 0 0 0 810 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/pkg_d/index.cjs +-r-xr-xr-x 0 0 0 841 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/pkg_d/index.mjs +-r-xr-xr-x 0 0 0 336 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/pkg_d/package.json drwxr-xr-x 0 0 0 0 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/js/ drwxr-xr-x 0 0 0 0 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/js/private/ drwxr-xr-x 0 0 0 0 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/js/private/test/ diff --git a/js/private/test/image/default_test_package_store_1p.listing b/js/private/test/image/default_test_package_store_1p.listing index 34f2a31b86..ae77a79ce0 100644 --- a/js/private/test/image/default_test_package_store_1p.listing +++ b/js/private/test/image/default_test_package_store_1p.listing @@ -18,7 +18,7 @@ drwxr-xr-x 0 0 0 0 Jan 1 1970 ./js/private/test/image/bin.runf -r-xr-xr-x 0 0 0 224 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/a/a2/index.js -r-xr-xr-x 0 0 0 31 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/a/index.d.ts -r-xr-xr-x 0 0 0 237 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/a/index.js --r-xr-xr-x 0 0 0 423 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/index.js +-r-xr-xr-x 0 0 0 815 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/index.js -r-xr-xr-x 0 0 0 166 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/package.json lrwxrwxr-x 0 0 0 0 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/acorn -> ../../acorn@8.7.1/node_modules/acorn lrwxrwxr-x 0 0 0 0 Jan 1 1970 ./js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/chalk -> ../../chalk@5.0.1/node_modules/chalk diff --git a/js/private/test/image/regex_edge_cases_test_app.listing b/js/private/test/image/regex_edge_cases_test_app.listing index 48ba14254d..378789f0ba 100644 --- a/js/private/test/image/regex_edge_cases_test_app.listing +++ b/js/private/test/image/regex_edge_cases_test_app.listing @@ -10,8 +10,9 @@ drwxr-xr-x 0 0 0 0 Jan 1 1970 ./app/js/private/test/image/bin. drwxr-xr-x 0 0 0 0 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/examples/npm_package/ drwxr-xr-x 0 0 0 0 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/ drwxr-xr-x 0 0 0 0 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/pkg_d/ --r-xr-xr-x 0 0 0 387 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/pkg_d/index.js --r-xr-xr-x 0 0 0 164 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/pkg_d/package.json +-r-xr-xr-x 0 0 0 810 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/pkg_d/index.cjs +-r-xr-xr-x 0 0 0 841 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/pkg_d/index.mjs +-r-xr-xr-x 0 0 0 336 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/examples/npm_package/packages/pkg_d/package.json drwxr-xr-x 0 0 0 0 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/js/ drwxr-xr-x 0 0 0 0 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/js/private/ drwxr-xr-x 0 0 0 0 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/js/private/test/ diff --git a/js/private/test/image/regex_edge_cases_test_package_store_1p.listing b/js/private/test/image/regex_edge_cases_test_package_store_1p.listing index 413fc48529..b44d0a2c7c 100644 --- a/js/private/test/image/regex_edge_cases_test_package_store_1p.listing +++ b/js/private/test/image/regex_edge_cases_test_package_store_1p.listing @@ -19,7 +19,7 @@ drwxr-xr-x 0 0 0 0 Jan 1 1970 ./app/js/private/test/image/bin. -r-xr-xr-x 0 0 0 224 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/a/a2/index.js -r-xr-xr-x 0 0 0 31 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/a/index.d.ts -r-xr-xr-x 0 0 0 237 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/a/index.js --r-xr-xr-x 0 0 0 423 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/index.js +-r-xr-xr-x 0 0 0 815 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/index.js -r-xr-xr-x 0 0 0 166 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/@mycorp/pkg-a/package.json lrwxrwxr-x 0 0 0 0 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/acorn -> ../../acorn@8.7.1/node_modules/acorn lrwxrwxr-x 0 0 0 0 Jan 1 1970 ./app/js/private/test/image/bin.runfiles/_main/node_modules/.aspect_rules_js/@mycorp+pkg-a@0.0.0/node_modules/chalk -> ../../chalk@5.0.1/node_modules/chalk