@gjsify/rolldown-plugin-gjsify 0.3.21 → 0.4.3

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.
Files changed (41) hide show
  1. package/lib/app/gjs.js +66 -2
  2. package/lib/plugins/css-as-string.js +98 -11
  3. package/lib/plugins/shebang.d.ts +2 -0
  4. package/lib/plugins/shebang.js +23 -0
  5. package/lib/shims/unicorn-magic.d.ts +14 -0
  6. package/lib/shims/unicorn-magic.js +68 -0
  7. package/lib/utils/auto-globals.d.ts +17 -2
  8. package/lib/utils/auto-globals.js +49 -27
  9. package/lib/utils/detect-free-globals.js +6 -0
  10. package/package.json +72 -64
  11. package/src/app/browser.ts +0 -101
  12. package/src/app/gjs.ts +0 -273
  13. package/src/app/index.ts +0 -6
  14. package/src/app/node.ts +0 -127
  15. package/src/globals.ts +0 -11
  16. package/src/index.ts +0 -34
  17. package/src/library/index.ts +0 -2
  18. package/src/library/lib.ts +0 -141
  19. package/src/plugin.ts +0 -96
  20. package/src/plugins/alias.ts +0 -61
  21. package/src/plugins/css-as-string.ts +0 -78
  22. package/src/plugins/gjs-imports-empty.ts +0 -29
  23. package/src/plugins/process-stub.ts +0 -91
  24. package/src/plugins/rewrite-node-modules-paths.ts +0 -169
  25. package/src/plugins/shebang.ts +0 -69
  26. package/src/plugins/text-loader.ts +0 -54
  27. package/src/shims/console-gjs.ts +0 -25
  28. package/src/types/app.ts +0 -1
  29. package/src/types/index.ts +0 -3
  30. package/src/types/plugin-options.ts +0 -48
  31. package/src/types/resolve-alias-options.ts +0 -1
  32. package/src/utils/alias.ts +0 -46
  33. package/src/utils/auto-globals.ts +0 -283
  34. package/src/utils/detect-free-globals.ts +0 -278
  35. package/src/utils/entry-points.ts +0 -48
  36. package/src/utils/extension.ts +0 -7
  37. package/src/utils/index.ts +0 -7
  38. package/src/utils/inline-static-reads.ts +0 -541
  39. package/src/utils/merge.ts +0 -22
  40. package/src/utils/scan-globals.ts +0 -91
  41. package/tsconfig.json +0 -16
@@ -1,101 +0,0 @@
1
- // `--app browser` Rolldown configuration factory.
2
- //
3
- // Browser builds redirect `@girs/*` and `gi://*` to an empty virtual module
4
- // (they appear transitively via `@gjsify/unit` and similar packages with
5
- // GJS-specific code paths). Standard Node.js → browser polyfill aliases
6
- // for `process` and `assert` keep `@gjsify/unit`'s top-level imports
7
- // resolvable in a browser bundle.
8
-
9
- import { aliasPlugin } from '../plugins/alias.js';
10
- import type { RolldownOptions, RolldownPluginOption } from 'rolldown';
11
-
12
- import { deepkitPlugin } from '@gjsify/rolldown-plugin-deepkit';
13
- import blueprintPlugin from '@gjsify/vite-plugin-blueprint';
14
-
15
- import type { PluginOptions } from '../types/plugin-options.js';
16
- import { globToEntryPoints } from '../utils/entry-points.js';
17
- import { gjsImportsEmptyPlugin } from '../plugins/gjs-imports-empty.js';
18
- import { cssAsStringPlugin } from '../plugins/css-as-string.js';
19
-
20
- export interface BrowserBuildConfig {
21
- options: RolldownOptions;
22
- plugins: RolldownPluginOption[];
23
- }
24
-
25
- export interface BrowserFactoryInput {
26
- input?: RolldownOptions['input'];
27
- output: { file?: string; dir?: string };
28
- userExternal?: string[];
29
- userAliases?: Record<string, string>;
30
- pluginOptions: PluginOptions;
31
- }
32
-
33
- export const setupForBrowser = async (input: BrowserFactoryInput): Promise<BrowserBuildConfig> => {
34
- const userExternal = input.userExternal ?? [];
35
- const external = [...userExternal];
36
-
37
- const exclude = input.pluginOptions.exclude ?? [];
38
- const entryPoints = await globToEntryPoints(input.input, exclude);
39
-
40
- // `@gjsify/unit` has `await import('process')` inside a try-catch that
41
- // is unreachable in browser (typeof document check comes first), but
42
- // Rolldown still resolves it statically. Map to `@gjsify/empty` so the
43
- // build succeeds. `assert` → `@gjsify/assert` because `@gjsify/unit`
44
- // imports `node:assert` at the top level.
45
- const browserPolyfillAliases: Record<string, string> = {
46
- process: '@gjsify/empty',
47
- 'node:process': '@gjsify/empty',
48
- assert: '@gjsify/assert',
49
- 'node:assert': '@gjsify/assert',
50
- };
51
-
52
- const aliasMap: Record<string, string> = {
53
- ...browserPolyfillAliases,
54
- ...(input.pluginOptions.aliases ?? {}),
55
- ...(input.userAliases ?? {}),
56
- };
57
-
58
- const options: RolldownOptions = {
59
- input: entryPoints,
60
- platform: 'browser',
61
- external,
62
- resolve: {
63
- mainFields: ['browser', 'module', 'main'],
64
- conditionNames: ['import', 'browser'],
65
- },
66
- transform: {
67
- target: 'esnext',
68
- define: {
69
- global: 'globalThis',
70
- window: 'globalThis',
71
- },
72
- },
73
- output: {
74
- ...input.output,
75
- format: 'esm',
76
- sourcemap: false,
77
- // Single-bundle output. `codeSplitting: false` replaces the
78
- // deprecated `inlineDynamicImports: true`.
79
- codeSplitting: false,
80
- },
81
- treeshake: true,
82
- };
83
-
84
- const plugins: RolldownPluginOption[] = [
85
- gjsImportsEmptyPlugin(),
86
- aliasPlugin({ entries: flattenAliases(aliasMap) }),
87
- blueprintPlugin() as RolldownPluginOption,
88
- deepkitPlugin({ reflection: input.pluginOptions.reflection }),
89
- cssAsStringPlugin(),
90
- ];
91
-
92
- return { options, plugins };
93
- };
94
-
95
- function flattenAliases(map: Record<string, string>): Record<string, string> {
96
- const out: Record<string, string> = {};
97
- for (const [from, to] of Object.entries(map)) {
98
- if (to) out[from] = to;
99
- }
100
- return out;
101
- }
package/src/app/gjs.ts DELETED
@@ -1,273 +0,0 @@
1
- // `--app gjs` Rolldown configuration factory.
2
- //
3
- // Mirrors the esbuild predecessor's `setupForGjs` exactly in terms of the
4
- // effective build behaviour: same externals, same alias map, same target
5
- // (firefox140 for JS, firefox60 for CSS), same console-shim injection,
6
- // same process-stub banner, same `random-access-file` fs-backed-fallback.
7
- //
8
- // Returns a partial `RolldownOptions` template plus the plugin array the
9
- // caller should compose with their user-supplied options. Library mode is
10
- // handled separately by `setupLib`.
11
-
12
- import { fileURLToPath } from 'node:url';
13
- import { dirname, resolve } from 'node:path';
14
- import type { RolldownOptions, RolldownPluginOption } from 'rolldown';
15
- import { aliasPlugin } from '../plugins/alias.js';
16
-
17
- import { deepkitPlugin } from '@gjsify/rolldown-plugin-deepkit';
18
- import blueprintPlugin from '@gjsify/vite-plugin-blueprint';
19
-
20
- import type { PluginOptions } from '../types/plugin-options.js';
21
- import { getAliasesForGjs } from '../utils/alias.js';
22
- import { globToEntryPoints } from '../utils/entry-points.js';
23
- import {
24
- nodeModulesPathRewritePlugin,
25
- getBundleDirFromOutput,
26
- } from '../plugins/rewrite-node-modules-paths.js';
27
- import { processStubPlugin } from '../plugins/process-stub.js';
28
- import { cssAsStringPlugin } from '../plugins/css-as-string.js';
29
- import { shebangPlugin, resolveShebangLine } from '../plugins/shebang.js';
30
-
31
- const _shimDir = dirname(fileURLToPath(import.meta.url));
32
-
33
- /** Resolved Rolldown configuration template + plugins for `--app gjs`. */
34
- export interface GjsBuildConfig {
35
- options: RolldownOptions;
36
- plugins: RolldownPluginOption[];
37
- }
38
-
39
- export interface GjsFactoryInput {
40
- /** User entry points after CLI / config merging. */
41
- input?: RolldownOptions['input'];
42
- /** Output `file` or `dir` so `import.meta.url` rewriter knows the bundle path. */
43
- output: { file?: string; dir?: string };
44
- /** Caller-supplied externals (`gjsify build --external`). */
45
- userExternal?: string[];
46
- /** User-supplied banner string (may contain a leading `#!shebang`). */
47
- userBanner?: string;
48
- /** User-supplied resolve.alias overrides. */
49
- userAliases?: Record<string, string>;
50
- /**
51
- * Shebang to prepend to the output bundle.
52
- * `true` → default `#!/usr/bin/env -S gjs -m`
53
- * `false` → no shebang
54
- * `"…"` → custom line, supports `${env:NAME[:-default]}` placeholders
55
- */
56
- shebang?: boolean | string;
57
- /** Plugin options forwarded to sub-plugins (deepkit, css, …). */
58
- pluginOptions: PluginOptions;
59
- }
60
-
61
- export const setupForGjs = async (input: GjsFactoryInput): Promise<GjsBuildConfig> => {
62
- const userExternal = input.userExternal ?? [];
63
- // Rolldown's `external` array does not support glob patterns the way
64
- // esbuild's did (`gi://*`). We use a function predicate so any
65
- // `gi://Foo?version=…` URI matches by prefix and the GJS-built-in
66
- // string specifiers stay externalised by name.
67
- const exactExternal = ['cairo', 'gettext', 'system', ...userExternal];
68
- const external = (id: string): boolean => {
69
- if (id.startsWith('gi://')) return true;
70
- if (exactExternal.includes(id)) return true;
71
- return false;
72
- };
73
- const format = input.pluginOptions.format ?? 'esm';
74
-
75
- const exclude = input.pluginOptions.exclude ?? [];
76
- const entryPoints = await globToEntryPoints(input.input, exclude);
77
-
78
- const aliasMap = {
79
- ...getAliasesForGjs({ external }),
80
- ...(input.pluginOptions.aliases ?? {}),
81
- ...(input.userAliases ?? {}),
82
- };
83
-
84
- // The console shim replaces all `console` references with print()/printerr()-
85
- // based implementations that bypass GLib.log_structured() — no prefix,
86
- // ANSI codes work. Disabled via `pluginOptions.consoleShim === false`.
87
- const consoleShimEnabled = input.pluginOptions.consoleShim !== false;
88
- const consoleShimPath = consoleShimEnabled
89
- ? resolve(_shimDir, '../shims/console-gjs.js')
90
- : null;
91
-
92
- // The auto-globals inject stub (when present) is side-effect-imported
93
- // via a virtual entry — its register modules write to globalThis, so
94
- // the import chain matters but no name binding does. We can't use
95
- // Rolldown's `inject` for this because the auto-globals invariant
96
- // forbids source-AST rewrites for global identifiers (false positives
97
- // from isomorphic guards / bracket access — see AGENTS.md).
98
- const sideEffectImports: string[] = [];
99
- if (input.pluginOptions.autoGlobalsInject) sideEffectImports.push(input.pluginOptions.autoGlobalsInject);
100
-
101
- const virtualEntries = wrapInputWithSideEffects(entryPoints, sideEffectImports);
102
- const finalInput = virtualEntries.input;
103
-
104
- const options: RolldownOptions = {
105
- input: finalInput,
106
- platform: 'neutral',
107
- external,
108
- // 'browser' field is needed so packages like create-hash, create-hmac,
109
- // randombytes use their pure-JS browser entry instead of index.js
110
- // (which does require('crypto') and causes circular dependencies via
111
- // the crypto → @gjsify/crypto alias).
112
- resolve: {
113
- mainFields: format === 'esm' ? ['browser', 'module', 'main'] : ['browser', 'main', 'module'],
114
- // ESM: omit 'require' — packages listing 'require' before 'import'
115
- // would silently route through their CJS entry.
116
- conditionNames: format === 'esm' ? ['browser', 'import'] : ['browser', 'require', 'import'],
117
- },
118
- transform: {
119
- // Compile target: GJS 1.86 / SpiderMonkey 140 ≈ firefox140.
120
- target: 'firefox140',
121
- define: {
122
- global: 'globalThis',
123
- window: 'globalThis',
124
- 'process.env.READABLE_STREAM': '"disable"',
125
- },
126
- // Console shim: rewrite bare `console` references to a named
127
- // import from our shim module. We use Rolldown's `inject`
128
- // (Oxc-driven, lives under `transform`) because:
129
- // 1. `globalThis.console` is non-configurable on SpiderMonkey
130
- // 128 so a register-style global write throws.
131
- // 2. We're replacing console unconditionally — there's no
132
- // tree-shake-aware detection concern that motivated the
133
- // auto-globals invariant.
134
- ...(consoleShimPath ? { inject: { console: [consoleShimPath, 'console'] } } : {}),
135
- },
136
- output: {
137
- ...input.output,
138
- format,
139
- sourcemap: false,
140
- // App builds emit a single bundle file. Disable code-splitting
141
- // so dynamic imports get inlined and the entire program lands
142
- // in one chunk that matches `gjsify build --outfile foo.js`.
143
- // (`codeSplitting: false` replaces the deprecated
144
- // `inlineDynamicImports: true` in Rolldown ≥ 1.0-rc.18.)
145
- codeSplitting: false,
146
- },
147
- treeshake: true,
148
- };
149
-
150
- const bundleDir = getBundleDirFromOutput(input.output);
151
-
152
- const plugins: RolldownPluginOption[] = [
153
- // Virtual-entry plugin runs FIRST so its resolveId/load match the
154
- // synthetic input ids that `wrapInputWithSideEffects` produces.
155
- ...(virtualEntries.plugin ? [virtualEntries.plugin] : []),
156
- // random-access-file's 'browser' field maps to a throwing stub; force
157
- // the fs-backed Node entry. Implemented via the gjsify alias plugin
158
- // as a direct entry-table override.
159
- aliasPlugin({
160
- entries: {
161
- 'random-access-file': 'random-access-file/index.js',
162
- ...flattenAliases(aliasMap),
163
- },
164
- }),
165
- blueprintPlugin() as RolldownPluginOption,
166
- deepkitPlugin({ reflection: input.pluginOptions.reflection }),
167
- // GTK4's CSS engine is much older than browser engines — its
168
- // parser predates nesting + many modern selectors. Targeting
169
- // `firefox: 60 << 16` makes lightningcss flatten the source
170
- // into the subset GTK4 understands.
171
- cssAsStringPlugin({ targets: { firefox: 60 << 16 } }),
172
- nodeModulesPathRewritePlugin({ bundleDir }),
173
- processStubPlugin({ userBanner: input.userBanner }),
174
- // resolveShebangLine returns null when disabled (false/undefined) and
175
- // the resolved line otherwise — also handles `${env:…}` expansion.
176
- (() => {
177
- const line = resolveShebangLine(input.shebang);
178
- return shebangPlugin({ enabled: line !== null, line: line ?? undefined });
179
- })(),
180
- ];
181
-
182
- return { options, plugins };
183
- };
184
-
185
- interface VirtualEntriesResult {
186
- input: RolldownOptions['input'];
187
- plugin: RolldownPluginOption | null;
188
- }
189
-
190
- /**
191
- * If there are side-effect imports to land alongside the user's entry,
192
- * wrap each entry in a virtual module that imports them first then
193
- * re-exports the entry. Returns the rewritten `input` plus the resolveId/load
194
- * plugin that resolves the virtual ids.
195
- *
196
- * Single-input case: `'src/index.ts'` → `'\0gjsify-entry:src/index.ts'`.
197
- * Array-input case: each element gets the same wrapper id.
198
- * Record-input case: values get wrapped, keys preserved.
199
- *
200
- * `\0`-prefixed ids are Rollup's convention for synthetic modules — Rolldown
201
- * recognises and treats them as not-from-disk, skipping the default loader.
202
- */
203
- function wrapInputWithSideEffects(
204
- input: RolldownOptions['input'],
205
- sideEffects: string[],
206
- ): VirtualEntriesResult {
207
- if (sideEffects.length === 0 || input === undefined) {
208
- return { input, plugin: null };
209
- }
210
-
211
- const userEntries = new Map<string, string>(); // virtualId → realPath
212
- const PREFIX = '\0gjsify-entry:';
213
-
214
- function wrap(realPath: string): string {
215
- const id = PREFIX + realPath;
216
- userEntries.set(id, realPath);
217
- return id;
218
- }
219
-
220
- let wrappedInput: RolldownOptions['input'];
221
- if (typeof input === 'string') {
222
- wrappedInput = wrap(input);
223
- } else if (Array.isArray(input)) {
224
- wrappedInput = input.map(wrap);
225
- } else {
226
- const out: Record<string, string> = {};
227
- for (const [name, path] of Object.entries(input)) {
228
- out[name] = wrap(path);
229
- }
230
- wrappedInput = out;
231
- }
232
-
233
- const sideEffectImports = sideEffects
234
- .map((p) => `import ${JSON.stringify(p)};`)
235
- .join('\n');
236
-
237
- const plugin: RolldownPluginOption = {
238
- name: 'gjsify-virtual-entry',
239
- async resolveId(source, importer) {
240
- if (source.startsWith(PREFIX)) return source;
241
- return null;
242
- },
243
- async load(id) {
244
- if (!id.startsWith(PREFIX)) return null;
245
- const realPath = userEntries.get(id);
246
- if (!realPath) return null;
247
- // Resolve the user-provided entry path through the full
248
- // resolver chain so the re-export targets a real on-disk
249
- // module — otherwise Rolldown treats `src/foo.ts` as a bare
250
- // specifier and emits it as an external import.
251
- const resolved = await this.resolve(realPath, undefined, { skipSelf: true });
252
- const target = resolved?.id ?? realPath;
253
- return {
254
- code: `${sideEffectImports}\nexport * from ${JSON.stringify(target)};\n`,
255
- moduleSideEffects: true,
256
- };
257
- },
258
- };
259
-
260
- return { input: wrappedInput, plugin };
261
- }
262
-
263
- /**
264
- * Flatten the legacy `Record<string, string>` alias map into the
265
- * `@rollup/plugin-alias` `entries` array shape, dropping empty values.
266
- */
267
- function flattenAliases(map: Record<string, string>): Record<string, string> {
268
- const out: Record<string, string> = {};
269
- for (const [from, to] of Object.entries(map)) {
270
- if (to) out[from] = to;
271
- }
272
- return out;
273
- }
package/src/app/index.ts DELETED
@@ -1,6 +0,0 @@
1
- export { setupForGjs } from './gjs.js';
2
- export type { GjsBuildConfig, GjsFactoryInput } from './gjs.js';
3
- export { setupForNode } from './node.js';
4
- export type { NodeBuildConfig, NodeFactoryInput } from './node.js';
5
- export { setupForBrowser } from './browser.js';
6
- export type { BrowserBuildConfig, BrowserFactoryInput } from './browser.js';
package/src/app/node.ts DELETED
@@ -1,127 +0,0 @@
1
- // `--app node` Rolldown configuration factory.
2
- //
3
- // Same external set + alias map as the esbuild predecessor. The
4
- // `createRequire` banner that esbuild needed for ESM-output CJS interop
5
- // translates to Rolldown's `output.banner` directly — Rolldown itself does
6
- // not synthesise a `require()` shim for ESM consumers of bundled CJS code.
7
-
8
- import { aliasPlugin } from '../plugins/alias.js';
9
- import type { RolldownOptions, RolldownPluginOption } from 'rolldown';
10
-
11
- import { deepkitPlugin } from '@gjsify/rolldown-plugin-deepkit';
12
- import { EXTERNALS_NODE } from '@gjsify/resolve-npm';
13
-
14
- import type { PluginOptions } from '../types/plugin-options.js';
15
- import { getAliasesForNode } from '../utils/alias.js';
16
- import { globToEntryPoints } from '../utils/entry-points.js';
17
- import {
18
- nodeModulesPathRewritePlugin,
19
- getBundleDirFromOutput,
20
- } from '../plugins/rewrite-node-modules-paths.js';
21
- import { cssAsStringPlugin } from '../plugins/css-as-string.js';
22
-
23
- export interface NodeBuildConfig {
24
- options: RolldownOptions;
25
- plugins: RolldownPluginOption[];
26
- }
27
-
28
- export interface NodeFactoryInput {
29
- input?: RolldownOptions['input'];
30
- output: { file?: string; dir?: string };
31
- userExternal?: string[];
32
- userAliases?: Record<string, string>;
33
- pluginOptions: PluginOptions;
34
- }
35
-
36
- export const setupForNode = async (input: NodeFactoryInput): Promise<NodeBuildConfig> => {
37
- const userExternal = input.userExternal ?? [];
38
- // node-datachannel is a native C++ addon that cannot be bundled — its
39
- // `require('../build/Release/node_datachannel.node')` must resolve at
40
- // runtime against the real node_modules tree.
41
- //
42
- // Note: Rolldown's `external` array does NOT support glob patterns the
43
- // way esbuild's did (`gi://*`, `@girs/*`). We use a function predicate
44
- // instead so the gi:// URI scheme and the @girs/ namespace are matched
45
- // by prefix.
46
- const exactExternal = [
47
- ...EXTERNALS_NODE as string[],
48
- 'node-datachannel',
49
- ...userExternal,
50
- ];
51
- const external = (id: string): boolean => {
52
- if (id.startsWith('gi://')) return true;
53
- if (id.startsWith('@girs/')) return true;
54
- if (exactExternal.includes(id)) return true;
55
- return false;
56
- };
57
- const format = input.pluginOptions.format ?? 'esm';
58
-
59
- const exclude = input.pluginOptions.exclude ?? [];
60
- const entryPoints = await globToEntryPoints(input.input, exclude);
61
-
62
- const aliasMap = {
63
- ...getAliasesForNode({ external }),
64
- ...(input.pluginOptions.aliases ?? {}),
65
- ...(input.userAliases ?? {}),
66
- };
67
-
68
- const bundleDir = getBundleDirFromOutput(input.output);
69
-
70
- // Rolldown's CJS interop wraps bundled CJS via `__commonJSMin` and
71
- // routes external Node-builtin `require()` through `__require` —
72
- // both injected internally. Unlike esbuild we therefore don't need a
73
- // top-of-bundle `const require = createRequire(...)` shim. Keeping
74
- // one collides with bundled CJS sources that declare their own
75
- // `const require = createRequire(...)` (e.g. yargs's ESM platform
76
- // shim) — `SyntaxError: Identifier 'require' has already been
77
- // declared`.
78
- const banner: string | undefined = undefined;
79
-
80
- const options: RolldownOptions = {
81
- input: entryPoints,
82
- platform: 'node',
83
- external,
84
- resolve: {
85
- mainFields: format === 'esm' ? ['module', 'main', 'browser'] : ['main', 'module', 'browser'],
86
- // CJS-priority conditions for Node bundles. Rolldown uses the first
87
- // matching key, so including 'import' would route packages like ws
88
- // v8 (whose exports map lists 'import' before 'require') through
89
- // their incomplete ESM wrapper.
90
- conditionNames: format === 'esm' ? ['require', 'node', 'module'] : ['require'],
91
- },
92
- transform: {
93
- target: 'node24',
94
- define: {
95
- global: 'globalThis',
96
- window: 'globalThis',
97
- },
98
- },
99
- output: {
100
- ...input.output,
101
- format,
102
- sourcemap: false,
103
- banner,
104
- // Single-bundle output. `codeSplitting: false` replaces the
105
- // deprecated `inlineDynamicImports: true`.
106
- codeSplitting: false,
107
- },
108
- treeshake: true,
109
- };
110
-
111
- const plugins: RolldownPluginOption[] = [
112
- aliasPlugin({ entries: flattenAliases(aliasMap) }),
113
- deepkitPlugin({ reflection: input.pluginOptions.reflection }),
114
- cssAsStringPlugin(),
115
- nodeModulesPathRewritePlugin({ bundleDir }),
116
- ];
117
-
118
- return { options, plugins };
119
- };
120
-
121
- function flattenAliases(map: Record<string, string>): Record<string, string> {
122
- const out: Record<string, string> = {};
123
- for (const [from, to] of Object.entries(map)) {
124
- if (to) out[from] = to;
125
- }
126
- return out;
127
- }
package/src/globals.ts DELETED
@@ -1,11 +0,0 @@
1
- // Public subpath export for the `--globals` CLI support.
2
- //
3
- // Consumed by `@gjsify/cli` to resolve the user's explicit `--globals` list
4
- // (or auto-detect via the iterative multi-pass build) and write the inject
5
- // stub that the plugin picks up via its `autoGlobalsInject` option. See the
6
- // "Tree-shakeable Globals" section in AGENTS.md for the architecture.
7
-
8
- export { resolveGlobalsList, writeRegisterInjectFile } from './utils/scan-globals.js';
9
- export { detectFreeGlobals } from './utils/detect-free-globals.js';
10
- export { detectAutoGlobals } from './utils/auto-globals.js';
11
- export type { AutoGlobalsResult, DetectAutoGlobalsOptions, AnalysisOptions } from './utils/auto-globals.js';
package/src/index.ts DELETED
@@ -1,34 +0,0 @@
1
- // Public re-exports for `@gjsify/rolldown-plugin-gjsify`.
2
-
3
- export * from './types/index.js';
4
- export * from './utils/index.js';
5
- export * from './app/index.js';
6
- export * from './library/index.js';
7
-
8
- export {
9
- REWRITE_FILTER,
10
- getBundleDirFromOutput,
11
- rewriteContents,
12
- shouldRewrite,
13
- nodeModulesPathRewritePlugin,
14
- } from './plugins/rewrite-node-modules-paths.js';
15
- export type {
16
- NodeModulesPathRewriteOptions,
17
- RewriteResult,
18
- } from './plugins/rewrite-node-modules-paths.js';
19
-
20
- export { processStubPlugin, GJS_PROCESS_STUB, composeBanner } from './plugins/process-stub.js';
21
- export type { ProcessStubPluginOptions } from './plugins/process-stub.js';
22
- export { cssAsStringPlugin } from './plugins/css-as-string.js';
23
- export { textLoaderPlugin } from './plugins/text-loader.js';
24
- export type { TextLoaderPluginOptions } from './plugins/text-loader.js';
25
- export { shebangPlugin, GJS_SHEBANG, expandEnvTemplate, resolveShebangLine } from './plugins/shebang.js';
26
- export type { ShebangPluginOptions } from './plugins/shebang.js';
27
- export { gjsImportsEmptyPlugin } from './plugins/gjs-imports-empty.js';
28
-
29
- export * from './plugin.js';
30
- import { gjsifyPlugin } from './plugin.js';
31
- export { gjsifyPlugin };
32
- export default gjsifyPlugin;
33
-
34
- export * from '@gjsify/resolve-npm';
@@ -1,2 +0,0 @@
1
- export { setupLib } from './lib.js';
2
- export type { LibBuildConfig, LibFactoryInput } from './lib.js';