@ryanatkn/gro 0.155.0 → 0.156.0

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.
@@ -21,7 +21,6 @@ export declare const GIT_DIRNAME = ".git";
21
21
  export declare const TSCONFIG_FILENAME = "tsconfig.json";
22
22
  export declare const TS_MATCHER: RegExp;
23
23
  export declare const JS_MATCHER: RegExp;
24
- export declare const JSON_MATCHER: RegExp;
25
24
  /** Extracts the script content from Svelte files. */
26
25
  export declare const SVELTE_SCRIPT_MATCHER: RegExp;
27
26
  export declare const EVERYTHING_MATCHER: RegExp;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/constants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,WAAW,SAAS,CAAC;AAClC,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC,eAAO,MAAM,gBAAgB,gBAAgB,CAAC;AAC9C,eAAO,MAAM,eAAe,QAAuB,CAAC;AACpD,eAAO,MAAM,UAAU,QAAuB,CAAC;AAC/C,eAAO,MAAM,OAAO,QAAoB,CAAC;AACzC,eAAO,MAAM,WAAW,QAAwB,CAAC;AACjD,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAC/C,eAAO,MAAM,eAAe,cAAc,CAAC;AAC3C,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AACzD,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;AACrD,eAAO,MAAM,oBAAoB,iBAAiB,CAAC;AACnD,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AACrD,eAAO,MAAM,qBAAqB,gBAAgB,CAAC;AACnD,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAC/C,eAAO,MAAM,sBAAsB,SAAS,CAAC;AAC7C,eAAO,MAAM,yBAAyB,QAAkC,CAAC;AACzE,eAAO,MAAM,cAAc,YAAY,CAAC;AACxC,eAAO,MAAM,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AClC,eAAO,MAAM,iBAAiB,kBAAkB,CAAC;AAEjD,eAAO,MAAM,UAAU,QAAwB,CAAC;AAChD,eAAO,MAAM,UAAU,QAAwB,CAAC;AAChD,qDAAqD;AACrD,eAAO,MAAM,qBAAqB,QAAiD,CAAC;AACpF,eAAO,MAAM,kBAAkB,QAAO,CAAC;AAEvC,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,oBAAoB,aAAa,CAAC"}
package/dist/constants.js CHANGED
@@ -28,7 +28,6 @@ export const GIT_DIRNAME = '.git';
28
28
  export const TSCONFIG_FILENAME = 'tsconfig.json';
29
29
  export const TS_MATCHER = /\.(ts|tsx|mts|cts)$/;
30
30
  export const JS_MATCHER = /\.(js|jsx|mjs|cjs)$/;
31
- export const JSON_MATCHER = /\.json$/;
32
31
  /** Extracts the script content from Svelte files. */
33
32
  export const SVELTE_SCRIPT_MATCHER = /<script(?:\s+[^>]*)?>([\s\S]*?)<\/script>/gim; // TODO maybe this shouldnt be global? or make a getter?
34
33
  export const EVERYTHING_MATCHER = /.*/;
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAuEvD,eAAO,MAAM,IAAI,EAAE,QA+FlB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,WAqDrB,CAAC"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAuEvD,eAAO,MAAM,IAAI,EAAE,QA0GlB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,WAqDrB,CAAC"}
package/dist/loader.js CHANGED
@@ -9,7 +9,7 @@ import { render_sveltekit_shim_app_environment, render_sveltekit_shim_app_paths,
9
9
  import { default_svelte_config } from "./svelte_config.js";
10
10
  import { SVELTE_MATCHER, SVELTE_RUNES_MATCHER } from "./svelte_helpers.js";
11
11
  import { IS_THIS_GRO, paths } from "./paths.js";
12
- import { JSON_MATCHER, NODE_MODULES_DIRNAME, TS_MATCHER } from "./constants.js";
12
+ import { NODE_MODULES_DIRNAME, TS_MATCHER } from "./constants.js";
13
13
  import { resolve_specifier } from "./resolve_specifier.js";
14
14
  import { map_sveltekit_aliases } from "./sveltekit_helpers.js";
15
15
  // TODO get out of the loader business, starting with https://nodejs.org/api/typescript.html#type-stripping
@@ -69,7 +69,7 @@ export const load = async (url, context, nextLoad) => {
69
69
  const loaded = await nextLoad(url, { ...context, format: 'module-typescript' });
70
70
  const raw_source = loaded.source?.toString(); // eslint-disable-line @typescript-eslint/no-base-to-string
71
71
  if (raw_source == null)
72
- throw new Error(`Failed to load ${url}`);
72
+ throw Error(`Failed to load ${url}`);
73
73
  // TODO should be nice if we could use Node's builtin amaro transform, but I couldn't find a way after digging into the source, AFAICT it's internal and not exposed
74
74
  const source = ts_blank_space(raw_source); // TODO was using oxc-transform and probably should, but this doesn't require sourcemaps, and it's still alpha as of May 2025
75
75
  const transformed = compileModule(source, {
@@ -95,14 +95,15 @@ export const load = async (url, context, nextLoad) => {
95
95
  const transformed = compile(source, { ...svelte_compile_options, dev, filename });
96
96
  return { format: 'module', shortCircuit: true, source: transformed.js.code };
97
97
  }
98
- else if (JSON_MATCHER.test(url)) {
99
- // TODO probably require import attrs: `JSON_MATCHER.test(url) && context.importAttributes.type === 'json'`
100
- // json
98
+ else if (context.importAttributes.type === 'json') {
99
+ // json - any file extension
101
100
  // TODO probably follow esbuild and also export every top-level property for objects from the module for good treeshaking - https://esbuild.github.io/content-types/#json (type generation?)
102
- const loaded = await nextLoad(url, context);
101
+ // TODO why is removing the importAttributes needed? can't pass no context either -
102
+ // error: `Module "file:///home/user/dev/repo/foo.json" is not of type "json"`
103
+ const loaded = await nextLoad(url, { ...context, importAttributes: undefined });
103
104
  const raw_source = loaded.source?.toString(); // eslint-disable-line @typescript-eslint/no-base-to-string
104
105
  if (raw_source == null)
105
- throw new Error(`Failed to load ${url}`);
106
+ throw Error(`Failed to load ${url}`);
106
107
  const source = `export default ` + raw_source;
107
108
  return { format: 'module', shortCircuit: true, source };
108
109
  }
@@ -119,28 +120,34 @@ export const load = async (url, context, nextLoad) => {
119
120
  if (context.format === 'sveltekit-env') {
120
121
  let mode;
121
122
  let visibility;
122
- if (context.importAttributes.virtual === '$env/static/public') {
123
- mode = 'static';
124
- visibility = 'public';
125
- }
126
- else if (context.importAttributes.virtual === '$env/static/private') {
127
- mode = 'static';
128
- visibility = 'private';
129
- }
130
- else if (context.importAttributes.virtual === '$env/dynamic/public') {
131
- mode = 'dynamic';
132
- visibility = 'public';
133
- }
134
- else if (context.importAttributes.virtual === '$env/dynamic/private') {
135
- mode = 'dynamic';
136
- visibility = 'private';
137
- }
138
- else {
139
- throw new Error(`Unknown $env import: ${context.importAttributes.virtual}`);
123
+ switch (context.importAttributes.virtual) {
124
+ case '$env/static/public': {
125
+ mode = 'static';
126
+ visibility = 'public';
127
+ break;
128
+ }
129
+ case '$env/static/private': {
130
+ mode = 'static';
131
+ visibility = 'private';
132
+ break;
133
+ }
134
+ case '$env/dynamic/public': {
135
+ mode = 'dynamic';
136
+ visibility = 'public';
137
+ break;
138
+ }
139
+ case '$env/dynamic/private': {
140
+ mode = 'dynamic';
141
+ visibility = 'private';
142
+ break;
143
+ }
144
+ default: {
145
+ throw Error(`Unknown $env import: ${context.importAttributes.virtual}`);
146
+ }
140
147
  }
141
148
  const source = render_env_shim_module(dev, mode, visibility, public_prefix, private_prefix, env_dir);
142
149
  return { format: 'module', shortCircuit: true, source };
143
- } // else fallback
150
+ }
144
151
  }
145
152
  // fallback to default behavior
146
153
  return nextLoad(url, context);
@@ -1 +1 @@
1
- {"version":3,"file":"package.d.ts","sourceRoot":"../src/l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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAswBD,CAAC"}
package/dist/package.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // generated by src/lib/package.gen.ts
2
2
  export const package_json = {
3
3
  name: '@ryanatkn/gro',
4
- version: '0.155.0',
4
+ version: '0.156.0',
5
5
  description: 'task runner and toolkit extending SvelteKit',
6
6
  motto: 'generate, run, optimize',
7
7
  glyph: '🌰',
@@ -258,7 +258,7 @@ export const package_json = {
258
258
  };
259
259
  export const src_json = {
260
260
  name: '@ryanatkn/gro',
261
- version: '0.155.0',
261
+ version: '0.156.0',
262
262
  modules: {
263
263
  '.': {
264
264
  path: 'index.ts',
@@ -386,7 +386,6 @@ export const src_json = {
386
386
  { name: 'TSCONFIG_FILENAME', kind: 'variable' },
387
387
  { name: 'TS_MATCHER', kind: 'variable' },
388
388
  { name: 'JS_MATCHER', kind: 'variable' },
389
- { name: 'JSON_MATCHER', kind: 'variable' },
390
389
  { name: 'SVELTE_SCRIPT_MATCHER', kind: 'variable' },
391
390
  { name: 'EVERYTHING_MATCHER', kind: 'variable' },
392
391
  { name: 'JS_CLI_DEFAULT', kind: 'variable' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryanatkn/gro",
3
- "version": "0.155.0",
3
+ "version": "0.156.0",
4
4
  "description": "task runner and toolkit extending SvelteKit",
5
5
  "motto": "generate, run, optimize",
6
6
  "glyph": "🌰",
@@ -31,7 +31,6 @@ export const TSCONFIG_FILENAME = 'tsconfig.json';
31
31
 
32
32
  export const TS_MATCHER = /\.(ts|tsx|mts|cts)$/;
33
33
  export const JS_MATCHER = /\.(js|jsx|mjs|cjs)$/;
34
- export const JSON_MATCHER = /\.json$/;
35
34
  /** Extracts the script content from Svelte files. */
36
35
  export const SVELTE_SCRIPT_MATCHER = /<script(?:\s+[^>]*)?>([\s\S]*?)<\/script>/gim; // TODO maybe this shouldnt be global? or make a getter?
37
36
  export const EVERYTHING_MATCHER = /.*/;
package/src/lib/loader.ts CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  import {default_svelte_config} from './svelte_config.ts';
18
18
  import {SVELTE_MATCHER, SVELTE_RUNES_MATCHER} from './svelte_helpers.ts';
19
19
  import {IS_THIS_GRO, paths} from './paths.ts';
20
- import {JSON_MATCHER, NODE_MODULES_DIRNAME, TS_MATCHER} from './constants.ts';
20
+ import {NODE_MODULES_DIRNAME, TS_MATCHER} from './constants.ts';
21
21
  import {resolve_specifier} from './resolve_specifier.ts';
22
22
  import {map_sveltekit_aliases} from './sveltekit_helpers.ts';
23
23
 
@@ -93,7 +93,7 @@ export const load: LoadHook = async (url, context, nextLoad) => {
93
93
  const filename = fileURLToPath(url);
94
94
  const loaded = await nextLoad(url, {...context, format: 'module-typescript'});
95
95
  const raw_source = loaded.source?.toString(); // eslint-disable-line @typescript-eslint/no-base-to-string
96
- if (raw_source == null) throw new Error(`Failed to load ${url}`);
96
+ if (raw_source == null) throw Error(`Failed to load ${url}`);
97
97
  // TODO should be nice if we could use Node's builtin amaro transform, but I couldn't find a way after digging into the source, AFAICT it's internal and not exposed
98
98
  const source = ts_blank_space(raw_source); // TODO was using oxc-transform and probably should, but this doesn't require sourcemaps, and it's still alpha as of May 2025
99
99
  const transformed = compileModule(source, {
@@ -116,13 +116,14 @@ export const load: LoadHook = async (url, context, nextLoad) => {
116
116
  const source = preprocessed?.code ?? raw_source;
117
117
  const transformed = compile(source, {...svelte_compile_options, dev, filename});
118
118
  return {format: 'module', shortCircuit: true, source: transformed.js.code};
119
- } else if (JSON_MATCHER.test(url)) {
120
- // TODO probably require import attrs: `JSON_MATCHER.test(url) && context.importAttributes.type === 'json'`
121
- // json
119
+ } else if (context.importAttributes.type === 'json') {
120
+ // json - any file extension
122
121
  // TODO probably follow esbuild and also export every top-level property for objects from the module for good treeshaking - https://esbuild.github.io/content-types/#json (type generation?)
123
- const loaded = await nextLoad(url, context);
122
+ // TODO why is removing the importAttributes needed? can't pass no context either -
123
+ // error: `Module "file:///home/user/dev/repo/foo.json" is not of type "json"`
124
+ const loaded = await nextLoad(url, {...context, importAttributes: undefined});
124
125
  const raw_source = loaded.source?.toString(); // eslint-disable-line @typescript-eslint/no-base-to-string
125
- if (raw_source == null) throw new Error(`Failed to load ${url}`);
126
+ if (raw_source == null) throw Error(`Failed to load ${url}`);
126
127
  const source = `export default ` + raw_source;
127
128
  return {format: 'module', shortCircuit: true, source};
128
129
  } else if (RAW_MATCHER.test(url)) {
@@ -138,20 +139,30 @@ export const load: LoadHook = async (url, context, nextLoad) => {
138
139
  if (context.format === 'sveltekit-env') {
139
140
  let mode: 'static' | 'dynamic';
140
141
  let visibility: 'public' | 'private';
141
- if (context.importAttributes.virtual === '$env/static/public') {
142
- mode = 'static';
143
- visibility = 'public';
144
- } else if (context.importAttributes.virtual === '$env/static/private') {
145
- mode = 'static';
146
- visibility = 'private';
147
- } else if (context.importAttributes.virtual === '$env/dynamic/public') {
148
- mode = 'dynamic';
149
- visibility = 'public';
150
- } else if (context.importAttributes.virtual === '$env/dynamic/private') {
151
- mode = 'dynamic';
152
- visibility = 'private';
153
- } else {
154
- throw new Error(`Unknown $env import: ${context.importAttributes.virtual}`);
142
+ switch (context.importAttributes.virtual) {
143
+ case '$env/static/public': {
144
+ mode = 'static';
145
+ visibility = 'public';
146
+ break;
147
+ }
148
+ case '$env/static/private': {
149
+ mode = 'static';
150
+ visibility = 'private';
151
+ break;
152
+ }
153
+ case '$env/dynamic/public': {
154
+ mode = 'dynamic';
155
+ visibility = 'public';
156
+ break;
157
+ }
158
+ case '$env/dynamic/private': {
159
+ mode = 'dynamic';
160
+ visibility = 'private';
161
+ break;
162
+ }
163
+ default: {
164
+ throw Error(`Unknown $env import: ${context.importAttributes.virtual}`);
165
+ }
155
166
  }
156
167
  const source = render_env_shim_module(
157
168
  dev,
@@ -162,7 +173,7 @@ export const load: LoadHook = async (url, context, nextLoad) => {
162
173
  env_dir,
163
174
  );
164
175
  return {format: 'module', shortCircuit: true, source};
165
- } // else fallback
176
+ }
166
177
  }
167
178
 
168
179
  // fallback to default behavior
@@ -5,7 +5,7 @@ import type {Src_Json} from './src_json.ts';
5
5
 
6
6
  export const package_json = {
7
7
  name: '@ryanatkn/gro',
8
- version: '0.155.0',
8
+ version: '0.156.0',
9
9
  description: 'task runner and toolkit extending SvelteKit',
10
10
  motto: 'generate, run, optimize',
11
11
  glyph: '🌰',
@@ -264,7 +264,7 @@ export const package_json = {
264
264
 
265
265
  export const src_json = {
266
266
  name: '@ryanatkn/gro',
267
- version: '0.155.0',
267
+ version: '0.156.0',
268
268
  modules: {
269
269
  '.': {
270
270
  path: 'index.ts',
@@ -392,7 +392,6 @@ export const src_json = {
392
392
  {name: 'TSCONFIG_FILENAME', kind: 'variable'},
393
393
  {name: 'TS_MATCHER', kind: 'variable'},
394
394
  {name: 'JS_MATCHER', kind: 'variable'},
395
- {name: 'JSON_MATCHER', kind: 'variable'},
396
395
  {name: 'SVELTE_SCRIPT_MATCHER', kind: 'variable'},
397
396
  {name: 'EVERYTHING_MATCHER', kind: 'variable'},
398
397
  {name: 'JS_CLI_DEFAULT', kind: 'variable'},