unrun 0.2.26 → 0.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # unrun
2
2
 
3
- [![npm version][npm-version-src]][npm-version-href]
4
- [![npm downloads][npm-downloads-src]][npm-downloads-href]
3
+ [![Open on npmx][npmx-version-src]][npmx-version-href]
4
+ [![Open on npmx][npmx-downloads-src]][npmx-downloads-href]
5
+ [![Open on npmx][npmx-vulnerabilities-src]][npmx-vulnerabilities-href]
5
6
  [![Unit Test][unit-test-src]][unit-test-href]
6
7
 
7
8
  unrun is a tool that enables running and loading any module at runtime (TypeScript, ESM, CJS, JSX, etc.) by bundling it with [Rolldown](https://rolldown.rs/).
@@ -54,9 +55,11 @@ const { module } = unrunSync({
54
55
 
55
56
  <!-- Badges -->
56
57
 
57
- [npm-version-src]: https://img.shields.io/npm/v/unrun.svg
58
- [npm-version-href]: https://npmjs.com/package/unrun
59
- [npm-downloads-src]: https://img.shields.io/npm/dm/unrun
60
- [npm-downloads-href]: https://www.npmcharts.com/compare/unrun?interval=30
58
+ [npmx-version-src]: https://npmx.dev/api/registry/badge/version/unrun
59
+ [npmx-version-href]: https://npmx.dev/unrun
60
+ [npmx-downloads-src]: https://npmx.dev/api/registry/badge/downloads-month/unrun
61
+ [npmx-downloads-href]: https://npmx.dev/unrun
62
+ [npmx-vulnerabilities-src]: https://npmx.dev/api/registry/badge/vulnerabilities/unrun
63
+ [npmx-vulnerabilities-href]: https://npmx.dev/unrun
61
64
  [unit-test-src]: https://github.com/gugustinette/unrun/actions/workflows/unit-test.yml/badge.svg
62
65
  [unit-test-href]: https://github.com/gugustinette/unrun/actions/workflows/unit-test.yml
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { n as unrunCli, r as unrunSync, t as unrun } from "./src-FpjER4tG.mjs";
1
+ import { n as unrunCli, r as unrunSync, t as unrun } from "./src-CS8hJStK.mjs";
2
2
 
3
3
  export { unrun, unrunCli, unrunSync };
@@ -238,8 +238,8 @@ const WRAPPER_MARKER = "__unrun__wrapRolldownHelpers";
238
238
  function createConsoleOutputCustomizer() {
239
239
  return {
240
240
  name: "unrun-console-output-customizer",
241
- generateBundle: { handler(_, bundle$1) {
242
- for (const chunk of Object.values(bundle$1)) {
241
+ generateBundle: { handler(_, bundle) {
242
+ for (const chunk of Object.values(bundle)) {
243
243
  if (chunk.type !== "chunk") continue;
244
244
  injectInspectHelper(chunk);
245
245
  injectHelperWrappers(chunk);
@@ -337,8 +337,8 @@ function createJsonLoader() {
337
337
  function createMakeCjsWrapperAsyncFriendlyPlugin() {
338
338
  return {
339
339
  name: "unrun-make-cjs-wrapper-async-friendly",
340
- generateBundle: { handler(_outputOptions, bundle$1) {
341
- for (const chunk of Object.values(bundle$1)) {
340
+ generateBundle: { handler(_outputOptions, bundle) {
341
+ for (const chunk of Object.values(bundle)) {
342
342
  if (chunk.type !== "chunk") continue;
343
343
  let code = chunk.code;
344
344
  const wrapperMarkers = ["__commonJS({", "__commonJSMin("];
@@ -390,8 +390,8 @@ function createMakeCjsWrapperAsyncFriendlyPlugin() {
390
390
  function createRequireResolveFix(options) {
391
391
  return {
392
392
  name: "unrun-require-resolve-fix",
393
- generateBundle: { handler(_, bundle$1) {
394
- for (const chunk of Object.values(bundle$1)) if (chunk.type === "chunk") chunk.code = chunk.code.replaceAll(/__require\.resolve\(["']([^"']+)["']\)/g, (match, id) => {
393
+ generateBundle: { handler(_, bundle) {
394
+ for (const chunk of Object.values(bundle)) if (chunk.type === "chunk") chunk.code = chunk.code.replaceAll(/__require\.resolve\(["']([^"']+)["']\)/g, (match, id) => {
395
395
  if (id.startsWith("./") || id.startsWith("../")) try {
396
396
  const baseDir = path.dirname(options.path);
397
397
  for (const ext of [
@@ -426,8 +426,8 @@ function createRequireResolveFix(options) {
426
426
  function createRequireTypeofFix() {
427
427
  return {
428
428
  name: "unrun-require-typeof-fix",
429
- generateBundle: { handler(_, bundle$1) {
430
- for (const chunk of Object.values(bundle$1)) if (chunk.type === "chunk") chunk.code = chunk.code.replaceAll(/\btypeof\s+__require\b/g, "typeof require");
429
+ generateBundle: { handler(_, bundle) {
430
+ for (const chunk of Object.values(bundle)) if (chunk.type === "chunk") chunk.code = chunk.code.replaceAll(/\btypeof\s+__require\b/g, "typeof require");
431
431
  } }
432
432
  };
433
433
  }
@@ -674,6 +674,7 @@ async function bundle(options) {
674
674
  format: "esm",
675
675
  codeSplitting: false,
676
676
  keepNames: true,
677
+ ...options.preset === "bundle-require" ? { generatedCode: { symbols: false } } : {},
677
678
  ...options.outputOptions
678
679
  };
679
680
  const rolldownOutput = await bundle.generate(outputOptions);
@@ -1,4 +1,4 @@
1
- import { t as unrun } from "../src-FpjER4tG.mjs";
1
+ import { t as unrun } from "../src-CS8hJStK.mjs";
2
2
  import { runAsWorker } from "synckit";
3
3
 
4
4
  //#region src/sync/worker.ts
@@ -8,19 +8,19 @@ function cloneForTransfer(value, seen = /* @__PURE__ */ new WeakMap()) {
8
8
  const objectValue = value;
9
9
  if (seen.has(objectValue)) return seen.get(objectValue);
10
10
  if (Array.isArray(value)) {
11
- const clone$1 = [];
12
- seen.set(objectValue, clone$1);
13
- for (const item of value) clone$1.push(cloneForTransfer(item, seen));
14
- return clone$1;
11
+ const clone = [];
12
+ seen.set(objectValue, clone);
13
+ for (const item of value) clone.push(cloneForTransfer(item, seen));
14
+ return clone;
15
15
  }
16
16
  if (isModuleNamespace(value)) {
17
- const clone$1 = Object.create(null);
18
- seen.set(objectValue, clone$1);
17
+ const clone = Object.create(null);
18
+ seen.set(objectValue, clone);
19
19
  for (const key of Object.keys(value)) {
20
20
  const nestedValue = value[key];
21
- clone$1[key] = cloneForTransfer(nestedValue, seen);
21
+ clone[key] = cloneForTransfer(nestedValue, seen);
22
22
  }
23
- return clone$1;
23
+ return clone;
24
24
  }
25
25
  if (typeof structuredClone === "function") try {
26
26
  return structuredClone(value);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unrun",
3
3
  "type": "module",
4
- "version": "0.2.26",
4
+ "version": "0.2.28",
5
5
  "description": "A tool to load and execute any JavaScript or TypeScript code at runtime.",
6
6
  "author": "Augustin Mercier <gugustinette@proton.me>",
7
7
  "license": "MIT",
@@ -42,59 +42,59 @@
42
42
  }
43
43
  },
44
44
  "dependencies": {
45
- "rolldown": "1.0.0-rc.1"
45
+ "rolldown": "1.0.0-rc.5"
46
46
  },
47
47
  "devDependencies": {
48
- "@sxzz/eslint-config": "^7.5.0",
49
- "@sxzz/prettier-config": "^2.2.6",
50
- "@types/node": "^25.0.10",
51
- "@typescript/native-preview": "7.0.0-dev.20260122.3",
52
- "@vitest/browser": "4.0.17",
53
- "@vitest/browser-playwright": "4.0.17",
48
+ "@sxzz/eslint-config": "^7.7.2",
49
+ "@sxzz/prettier-config": "^2.3.1",
50
+ "@types/node": "^25.2.3",
51
+ "@typescript/native-preview": "7.0.0-dev.20260204.1",
52
+ "@vitest/browser": "4.0.18",
53
+ "@vitest/browser-playwright": "4.0.18",
54
54
  "@webcontainer/api": "^1.6.1",
55
55
  "acorn": "^8.15.0",
56
- "bumpp": "^10.4.0",
56
+ "bumpp": "^10.4.1",
57
57
  "bundle-require": "^5.1.0",
58
- "config": "^4.2.0",
58
+ "config": "^4.3.0",
59
59
  "consola": "^3.4.2",
60
60
  "defu": "^6.1.4",
61
61
  "destr": "^2.0.5",
62
- "esbuild": "^0.27.2",
62
+ "esbuild": "^0.27.3",
63
63
  "eslint": "^9.39.2",
64
64
  "estree-walker": "^3.0.3",
65
65
  "etag": "^1.8.1",
66
66
  "fast-glob": "^3.3.3",
67
- "giget": "^3.1.1",
67
+ "giget": "^3.1.2",
68
68
  "is-installed-globally": "^1.0.0",
69
69
  "jiti": "^2.6.1",
70
70
  "mime": "^4.1.0",
71
71
  "moment-timezone": "^0.6.0",
72
72
  "nano-jsx": "^0.2.1",
73
- "playwright": "^1.57.0",
74
- "preact": "^10.28.2",
73
+ "playwright": "^1.58.2",
74
+ "preact": "^10.28.3",
75
75
  "preact-render-to-string": "^6.6.5",
76
76
  "prettier": "^3.8.1",
77
- "react": "^19.2.3",
78
- "react-dom": "^19.2.3",
77
+ "react": "^19.2.4",
78
+ "react-dom": "^19.2.4",
79
79
  "reflect-metadata": "^0.2.2",
80
80
  "synckit": "^0.11.12",
81
81
  "test-ecosystem-ci": "^0.0.3",
82
82
  "tinyexec": "^1.0.2",
83
- "tsdown": "0.20.0-beta.4",
83
+ "tsdown": "0.20.1",
84
84
  "tsx": "^4.21.0",
85
85
  "typedoc": "^0.28.16",
86
- "typedoc-plugin-markdown": "^4.9.0",
86
+ "typedoc-plugin-markdown": "^4.10.0",
87
87
  "typedoc-vitepress-theme": "^1.1.2",
88
88
  "typescript": "^5.9.3",
89
89
  "unconfig": "^7.4.2",
90
- "unplugin-vue": "^7.1.0",
90
+ "unplugin-vue": "^7.1.1",
91
91
  "vite": "^7.3.1",
92
92
  "vitepress": "2.0.0-alpha.12",
93
93
  "vitepress-plugin-group-icons": "^1.7.1",
94
- "vitest": "4.0.17",
95
- "vue": "^3.5.27",
96
- "vue-tsc": "^3.2.2",
97
- "zod": "^4.3.5"
94
+ "vitest": "4.0.18",
95
+ "vue": "^3.5.28",
96
+ "vue-tsc": "^3.2.4",
97
+ "zod": "^4.3.6"
98
98
  },
99
99
  "prettier": "@sxzz/prettier-config",
100
100
  "scripts": {