@gjsify/rolldown-plugin-gjsify 0.4.26 → 0.4.27

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/lib/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export type { ProcessStubPluginOptions } from './plugins/process-stub.js';
9
9
  export { cssAsStringPlugin } from './plugins/css-as-string.js';
10
10
  export { textLoaderPlugin } from './plugins/text-loader.js';
11
11
  export type { TextLoaderPluginOptions } from './plugins/text-loader.js';
12
- export { shebangPlugin, GJS_SHEBANG, expandEnvTemplate, resolveShebangLine } from './plugins/shebang.js';
12
+ export { shebangPlugin, GJS_SHEBANG, NODE_SHEBANG, expandEnvTemplate, resolveShebangLine } from './plugins/shebang.js';
13
13
  export type { ShebangPluginOptions } from './plugins/shebang.js';
14
14
  export { gjsImportsEmptyPlugin } from './plugins/gjs-imports-empty.js';
15
15
  export * from './plugin.js';
package/lib/index.js CHANGED
@@ -7,7 +7,7 @@ export { REWRITE_FILTER, getBundleDirFromOutput, rewriteContents, shouldRewrite,
7
7
  export { processStubPlugin, GJS_PROCESS_STUB, composeBanner } from './plugins/process-stub.js';
8
8
  export { cssAsStringPlugin } from './plugins/css-as-string.js';
9
9
  export { textLoaderPlugin } from './plugins/text-loader.js';
10
- export { shebangPlugin, GJS_SHEBANG, expandEnvTemplate, resolveShebangLine } from './plugins/shebang.js';
10
+ export { shebangPlugin, GJS_SHEBANG, NODE_SHEBANG, expandEnvTemplate, resolveShebangLine } from './plugins/shebang.js';
11
11
  export { gjsImportsEmptyPlugin } from './plugins/gjs-imports-empty.js';
12
12
  export * from './plugin.js';
13
13
  import { gjsifyPlugin } from './plugin.js';
@@ -1,5 +1,6 @@
1
1
  import type { Plugin } from 'rolldown';
2
2
  export declare const GJS_SHEBANG = "#!/usr/bin/env -S gjs -m";
3
+ export declare const NODE_SHEBANG = "#!/usr/bin/env node";
3
4
  export interface ShebangPluginOptions {
4
5
  enabled?: boolean;
5
6
  /** Override the shebang line. Defaults to `GJS_SHEBANG`. */
@@ -21,12 +22,16 @@ export declare function expandEnvTemplate(input: string, env?: Record<string, st
21
22
  * that should be prepended to the bundle (without trailing newline), or
22
23
  * `null` when shebang injection is disabled.
23
24
  *
24
- * `true` → default GJS shebang
25
+ * `true` → `defaultLine` (the target's default shebang)
25
26
  * `false|undefined` → null (disabled)
26
27
  * `"…"` → string with `${env:NAME[:-default]}` expanded
27
28
  *
29
+ * `defaultLine` lets the caller pick the per-target default that `true`
30
+ * resolves to — `GJS_SHEBANG` for `--app gjs` (the default), `NODE_SHEBANG`
31
+ * for `--app node`. An explicit string value always wins over the default.
32
+ *
28
33
  * If the resolved string does not start with `#!`, it is prefixed
29
34
  * automatically so users can write `"shebang": "/usr/bin/gjs -m"` instead
30
35
  * of `"#!/usr/bin/gjs -m"`.
31
36
  */
32
- export declare function resolveShebangLine(value: boolean | string | undefined): string | null;
37
+ export declare function resolveShebangLine(value: boolean | string | undefined, defaultLine?: string): string | null;
@@ -6,6 +6,7 @@
6
6
  // the `#` character is only valid as the very first byte of the file under
7
7
  // SpiderMonkey 128+.
8
8
  export const GJS_SHEBANG = '#!/usr/bin/env -S gjs -m';
9
+ export const NODE_SHEBANG = '#!/usr/bin/env node';
9
10
  /**
10
11
  * Strip a leading `#!…\n` from a source module. Rolldown preserves input
11
12
  * shebangs verbatim, which ends up embedded mid-chunk after our process-stub
@@ -67,19 +68,23 @@ export function expandEnvTemplate(input, env = process.env) {
67
68
  * that should be prepended to the bundle (without trailing newline), or
68
69
  * `null` when shebang injection is disabled.
69
70
  *
70
- * `true` → default GJS shebang
71
+ * `true` → `defaultLine` (the target's default shebang)
71
72
  * `false|undefined` → null (disabled)
72
73
  * `"…"` → string with `${env:NAME[:-default]}` expanded
73
74
  *
75
+ * `defaultLine` lets the caller pick the per-target default that `true`
76
+ * resolves to — `GJS_SHEBANG` for `--app gjs` (the default), `NODE_SHEBANG`
77
+ * for `--app node`. An explicit string value always wins over the default.
78
+ *
74
79
  * If the resolved string does not start with `#!`, it is prefixed
75
80
  * automatically so users can write `"shebang": "/usr/bin/gjs -m"` instead
76
81
  * of `"#!/usr/bin/gjs -m"`.
77
82
  */
78
- export function resolveShebangLine(value) {
83
+ export function resolveShebangLine(value, defaultLine = GJS_SHEBANG) {
79
84
  if (value === undefined || value === false)
80
85
  return null;
81
86
  if (value === true)
82
- return GJS_SHEBANG;
87
+ return defaultLine;
83
88
  const expanded = expandEnvTemplate(value);
84
89
  if (!expanded.trim())
85
90
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/rolldown-plugin-gjsify",
3
- "version": "0.4.26",
3
+ "version": "0.4.27",
4
4
  "description": "Rolldown / Rollup / Vite plugin orchestrator for GJS, Node, and Browser targets",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -48,11 +48,11 @@
48
48
  ],
49
49
  "license": "MIT",
50
50
  "dependencies": {
51
- "@gjsify/console": "^0.4.26",
52
- "@gjsify/resolve-npm": "^0.4.26",
53
- "@gjsify/rolldown-plugin-deepkit": "^0.4.26",
54
- "@gjsify/rolldown-plugin-pnp": "^0.4.26",
55
- "@gjsify/vite-plugin-blueprint": "^0.4.26",
51
+ "@gjsify/console": "^0.4.27",
52
+ "@gjsify/resolve-npm": "^0.4.27",
53
+ "@gjsify/rolldown-plugin-deepkit": "^0.4.27",
54
+ "@gjsify/rolldown-plugin-pnp": "^0.4.27",
55
+ "@gjsify/vite-plugin-blueprint": "^0.4.27",
56
56
  "@rollup/pluginutils": "^5.3.0",
57
57
  "acorn": "^8.16.0",
58
58
  "acorn-walk": "^8.3.5",
@@ -60,7 +60,7 @@
60
60
  "lightningcss": "^1.32.0"
61
61
  },
62
62
  "peerDependencies": {
63
- "@gjsify/lightningcss-native": "^0.4.26",
63
+ "@gjsify/lightningcss-native": "^0.4.27",
64
64
  "rolldown": "^1.0.0-rc.18"
65
65
  },
66
66
  "peerDependenciesMeta": {