@ryanatkn/gro 0.133.2 → 0.133.4
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/dist/build.task.d.ts +6 -0
- package/dist/build.task.d.ts.map +1 -1
- package/dist/build.task.js +6 -3
- package/dist/check.task.d.ts +2 -2
- package/dist/dev.task.d.ts +2 -2
- package/dist/esbuild_helpers.d.ts +1 -1
- package/dist/esbuild_helpers.d.ts.map +1 -1
- package/dist/esbuild_helpers.js +1 -1
- package/dist/esbuild_plugin_external_worker.d.ts +2 -2
- package/dist/esbuild_plugin_external_worker.d.ts.map +1 -1
- package/dist/esbuild_plugin_external_worker.js +3 -1
- package/dist/esbuild_plugin_svelte.d.ts +7 -2
- package/dist/esbuild_plugin_svelte.d.ts.map +1 -1
- package/dist/esbuild_plugin_svelte.js +20 -9
- package/dist/esbuild_plugin_sveltekit_local_imports.d.ts.map +1 -1
- package/dist/esbuild_plugin_sveltekit_local_imports.js +3 -2
- package/dist/esbuild_plugin_sveltekit_shim_app.d.ts.map +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_app.js +3 -2
- package/dist/esbuild_plugin_sveltekit_shim_env.d.ts.map +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_env.js +6 -5
- package/dist/gro_plugin_server.d.ts.map +1 -1
- package/dist/gro_plugin_server.js +4 -10
- package/dist/gro_plugin_sveltekit_app.js +2 -2
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +14 -14
- package/dist/package.d.ts +0 -11
- package/dist/package.d.ts.map +1 -1
- package/dist/package.js +16 -18
- package/dist/path_constants.d.ts +3 -0
- package/dist/path_constants.d.ts.map +1 -1
- package/dist/path_constants.js +3 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +3 -3
- package/dist/run_gen.js +2 -2
- package/dist/run_task.js +2 -2
- package/dist/sveltekit_config.d.ts +7 -2
- package/dist/sveltekit_config.d.ts.map +1 -1
- package/dist/sveltekit_config.js +11 -1
- package/dist/sveltekit_helpers.d.ts +2 -1
- package/dist/sveltekit_helpers.d.ts.map +1 -1
- package/dist/sveltekit_helpers.js +3 -2
- package/dist/task_logging.js +2 -4
- package/package.json +8 -12
- package/src/lib/build.task.ts +6 -3
- package/src/lib/esbuild_helpers.ts +1 -1
- package/src/lib/esbuild_plugin_external_worker.ts +4 -2
- package/src/lib/esbuild_plugin_svelte.ts +38 -11
- package/src/lib/esbuild_plugin_sveltekit_local_imports.ts +16 -9
- package/src/lib/esbuild_plugin_sveltekit_shim_app.ts +3 -2
- package/src/lib/esbuild_plugin_sveltekit_shim_env.ts +7 -5
- package/src/lib/gro_plugin_server.ts +4 -11
- package/src/lib/gro_plugin_sveltekit_app.ts +2 -2
- package/src/lib/loader.ts +14 -16
- package/src/lib/package.ts +16 -18
- package/src/lib/path_constants.ts +4 -0
- package/src/lib/paths.ts +3 -3
- package/src/lib/run_gen.ts +2 -2
- package/src/lib/run_task.ts +2 -2
- package/src/lib/sveltekit_config.ts +21 -4
- package/src/lib/sveltekit_helpers.ts +4 -3
- package/src/lib/task_logging.ts +4 -6
- package/dist/sveltekit_config_global.d.ts +0 -5
- package/dist/sveltekit_config_global.d.ts.map +0 -1
- package/dist/sveltekit_config_global.js +0 -5
- package/src/lib/sveltekit_config_global.ts +0 -6
package/dist/build.task.d.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { Task } from './task.js';
|
|
3
3
|
export declare const Args: z.ZodObject<{
|
|
4
|
+
sync: z.ZodDefault<z.ZodBoolean>;
|
|
5
|
+
'no-sync': z.ZodDefault<z.ZodBoolean>;
|
|
4
6
|
install: z.ZodDefault<z.ZodBoolean>;
|
|
5
7
|
'no-install': z.ZodDefault<z.ZodBoolean>;
|
|
6
8
|
}, "strict", z.ZodTypeAny, {
|
|
9
|
+
sync: boolean;
|
|
10
|
+
'no-sync': boolean;
|
|
7
11
|
install: boolean;
|
|
8
12
|
'no-install': boolean;
|
|
9
13
|
}, {
|
|
14
|
+
sync?: boolean | undefined;
|
|
15
|
+
'no-sync'?: boolean | undefined;
|
|
10
16
|
install?: boolean | undefined;
|
|
11
17
|
'no-install'?: boolean | undefined;
|
|
12
18
|
}>;
|
package/dist/build.task.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.task.d.ts","sourceRoot":"../src/lib/","sources":["build.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"build.task.d.ts","sourceRoot":"../src/lib/","sources":["build.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;EASP,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAqB3B,CAAC"}
|
package/dist/build.task.js
CHANGED
|
@@ -3,6 +3,8 @@ import { Plugins } from './plugin.js';
|
|
|
3
3
|
import { clean_fs } from './clean_fs.js';
|
|
4
4
|
export const Args = z
|
|
5
5
|
.object({
|
|
6
|
+
sync: z.boolean({ description: 'dual of no-sync' }).default(true),
|
|
7
|
+
'no-sync': z.boolean({ description: 'opt out of gro sync' }).default(false),
|
|
6
8
|
install: z.boolean({ description: 'dual of no-install' }).default(true),
|
|
7
9
|
'no-install': z // convenience, same as `gro build -- gro sync --no-install` but the latter takes precedence
|
|
8
10
|
.boolean({ description: 'opt out of `npm install` before building' })
|
|
@@ -14,9 +16,10 @@ export const task = {
|
|
|
14
16
|
Args,
|
|
15
17
|
run: async (ctx) => {
|
|
16
18
|
const { args, invoke_task } = ctx;
|
|
17
|
-
const { install } = args;
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
const { sync, install } = args;
|
|
20
|
+
if (sync) {
|
|
21
|
+
await invoke_task('sync', { install });
|
|
22
|
+
}
|
|
20
23
|
// TODO possibly detect if the git workspace is clean, and ask for confirmation if not,
|
|
21
24
|
// because we're not doing things like `gro gen` here because that's a dev/CI concern
|
|
22
25
|
await clean_fs({ build_dist: true });
|
package/dist/check.task.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare const Args: z.ZodObject<{
|
|
|
22
22
|
sync: boolean;
|
|
23
23
|
package_json: boolean;
|
|
24
24
|
format: boolean;
|
|
25
|
+
'no-sync': boolean;
|
|
25
26
|
install: boolean;
|
|
26
27
|
'no-install': boolean;
|
|
27
28
|
typecheck: boolean;
|
|
@@ -34,12 +35,12 @@ export declare const Args: z.ZodObject<{
|
|
|
34
35
|
'no-package_json': boolean;
|
|
35
36
|
lint: boolean;
|
|
36
37
|
'no-lint': boolean;
|
|
37
|
-
'no-sync': boolean;
|
|
38
38
|
workspace: boolean;
|
|
39
39
|
}, {
|
|
40
40
|
sync?: boolean | undefined;
|
|
41
41
|
package_json?: boolean | undefined;
|
|
42
42
|
format?: boolean | undefined;
|
|
43
|
+
'no-sync'?: boolean | undefined;
|
|
43
44
|
install?: boolean | undefined;
|
|
44
45
|
'no-install'?: boolean | undefined;
|
|
45
46
|
typecheck?: boolean | undefined;
|
|
@@ -52,7 +53,6 @@ export declare const Args: z.ZodObject<{
|
|
|
52
53
|
'no-package_json'?: boolean | undefined;
|
|
53
54
|
lint?: boolean | undefined;
|
|
54
55
|
'no-lint'?: boolean | undefined;
|
|
55
|
-
'no-sync'?: boolean | undefined;
|
|
56
56
|
workspace?: boolean | undefined;
|
|
57
57
|
}>;
|
|
58
58
|
export type Args = z.infer<typeof Args>;
|
package/dist/dev.task.d.ts
CHANGED
|
@@ -11,16 +11,16 @@ export declare const Args: z.ZodObject<{
|
|
|
11
11
|
}, "strict", z.ZodTypeAny, {
|
|
12
12
|
sync: boolean;
|
|
13
13
|
watch: boolean;
|
|
14
|
+
'no-sync': boolean;
|
|
14
15
|
install: boolean;
|
|
15
16
|
'no-install': boolean;
|
|
16
|
-
'no-sync': boolean;
|
|
17
17
|
'no-watch': boolean;
|
|
18
18
|
}, {
|
|
19
19
|
sync?: boolean | undefined;
|
|
20
20
|
watch?: boolean | undefined;
|
|
21
|
+
'no-sync'?: boolean | undefined;
|
|
21
22
|
install?: boolean | undefined;
|
|
22
23
|
'no-install'?: boolean | undefined;
|
|
23
|
-
'no-sync'?: boolean | undefined;
|
|
24
24
|
'no-watch'?: boolean | undefined;
|
|
25
25
|
}>;
|
|
26
26
|
export type Args = z.infer<typeof Args>;
|
|
@@ -12,5 +12,5 @@ export declare const print_build_result: (log: Logger, build_result: esbuild.Bui
|
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
14
|
export declare const to_define_import_meta_env: (dev: boolean, base_url: Parsed_Sveltekit_Config["base_url"], ssr?: boolean, mode?: string) => Record<string, string>;
|
|
15
|
-
export declare const
|
|
15
|
+
export declare const default_ts_transform_options: esbuild.TransformOptions;
|
|
16
16
|
//# sourceMappingURL=esbuild_helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild_helpers.d.ts","sourceRoot":"../src/lib/","sources":["esbuild_helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAExC,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,uBAAuB,CAAC;AAEnE,eAAO,MAAM,kBAAkB,QAAS,MAAM,gBAAgB,OAAO,CAAC,WAAW,KAAG,IAOnF,CAAC;AAMF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,QAChC,OAAO,YACF,uBAAuB,CAAC,UAAU,CAAC,mCAG3C,MAAM,CAAC,MAAM,EAAE,MAAM,CAQtB,CAAC;AAEH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"esbuild_helpers.d.ts","sourceRoot":"../src/lib/","sources":["esbuild_helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAExC,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,uBAAuB,CAAC;AAEnE,eAAO,MAAM,kBAAkB,QAAS,MAAM,gBAAgB,OAAO,CAAC,WAAW,KAAG,IAOnF,CAAC;AAMF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,QAChC,OAAO,YACF,uBAAuB,CAAC,UAAU,CAAC,mCAG3C,MAAM,CAAC,MAAM,EAAE,MAAM,CAQtB,CAAC;AAEH,eAAO,MAAM,4BAA4B,EAAE,OAAO,CAAC,gBAMlD,CAAC"}
|
package/dist/esbuild_helpers.js
CHANGED
|
@@ -28,7 +28,7 @@ export const to_define_import_meta_env = (dev, base_url, ssr = true, mode = dev
|
|
|
28
28
|
// it appears SvelteKit's `''` translates to Vite's `'/'`, so this intentionally falls back for falsy values, not just undefined
|
|
29
29
|
[import_meta_env + 'BASE_URL']: JSON.stringify(base_url || '/'), // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing
|
|
30
30
|
});
|
|
31
|
-
export const
|
|
31
|
+
export const default_ts_transform_options = {
|
|
32
32
|
target: 'esnext',
|
|
33
33
|
format: 'esm',
|
|
34
34
|
loader: 'ts',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as esbuild from 'esbuild';
|
|
2
2
|
import type { Logger } from '@ryanatkn/belt/log.js';
|
|
3
|
-
import type { CompileOptions,
|
|
3
|
+
import type { CompileOptions, ModuleCompileOptions, PreprocessorGroup } from 'svelte/compiler';
|
|
4
4
|
import type { Parsed_Sveltekit_Config } from './sveltekit_config.js';
|
|
5
5
|
export interface Options {
|
|
6
6
|
dev: boolean;
|
|
@@ -19,5 +19,5 @@ export interface Options {
|
|
|
19
19
|
ambient_env?: Record<string, string>;
|
|
20
20
|
log?: Logger;
|
|
21
21
|
}
|
|
22
|
-
export declare const esbuild_plugin_external_worker: ({ dev, build_options, dir, svelte_compile_options,
|
|
22
|
+
export declare const esbuild_plugin_external_worker: ({ dev, build_options, dir, svelte_compile_options, svelte_compile_module_options, svelte_preprocessors, alias, base_url, assets_url, public_prefix, private_prefix, env_dir, env_files, ambient_env, log, }: Options) => esbuild.Plugin;
|
|
23
23
|
//# sourceMappingURL=esbuild_plugin_external_worker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild_plugin_external_worker.d.ts","sourceRoot":"../src/lib/","sources":["esbuild_plugin_external_worker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAElD,OAAO,KAAK,EAAC,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"esbuild_plugin_external_worker.d.ts","sourceRoot":"../src/lib/","sources":["esbuild_plugin_external_worker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAElD,OAAO,KAAK,EAAC,cAAc,EAAE,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAS7F,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,uBAAuB,CAAC;AAGnE,MAAM,WAAW,OAAO;IACvB,GAAG,EAAE,OAAO,CAAC;IACb,aAAa,EAAE,OAAO,CAAC,YAAY,CAAC;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sBAAsB,CAAC,EAAE,cAAc,CAAC;IACxC,6BAA6B,CAAC,EAAE,oBAAoB,CAAC;IACrD,oBAAoB,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,EAAE,CAAC;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,uBAAuB,CAAC,UAAU,CAAC,CAAC;IAC/C,UAAU,CAAC,EAAE,uBAAuB,CAAC,YAAY,CAAC,CAAC;IACnD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,8BAA8B,gNAgBxC,OAAO,KAAG,OAAO,CAAC,MA4CnB,CAAC"}
|
|
@@ -7,7 +7,7 @@ import { esbuild_plugin_sveltekit_shim_env } from './esbuild_plugin_sveltekit_sh
|
|
|
7
7
|
import { esbuild_plugin_sveltekit_shim_app } from './esbuild_plugin_sveltekit_shim_app.js';
|
|
8
8
|
import { esbuild_plugin_sveltekit_local_imports } from './esbuild_plugin_sveltekit_local_imports.js';
|
|
9
9
|
import { esbuild_plugin_svelte } from './esbuild_plugin_svelte.js';
|
|
10
|
-
export const esbuild_plugin_external_worker = ({ dev, build_options, dir = process.cwd(), svelte_compile_options,
|
|
10
|
+
export const esbuild_plugin_external_worker = ({ dev, build_options, dir = process.cwd(), svelte_compile_options, svelte_compile_module_options, svelte_preprocessors, alias, base_url, assets_url, public_prefix, private_prefix, env_dir, env_files, ambient_env, log, }) => ({
|
|
11
11
|
name: 'external_worker',
|
|
12
12
|
setup: (build) => {
|
|
13
13
|
const builds = new Map();
|
|
@@ -28,6 +28,8 @@ export const esbuild_plugin_external_worker = ({ dev, build_options, dir = proce
|
|
|
28
28
|
}),
|
|
29
29
|
esbuild_plugin_sveltekit_shim_alias({ dir, alias }),
|
|
30
30
|
esbuild_plugin_svelte({
|
|
31
|
+
dev,
|
|
32
|
+
base_url,
|
|
31
33
|
dir,
|
|
32
34
|
svelte_compile_options,
|
|
33
35
|
svelte_compile_module_options,
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as esbuild from 'esbuild';
|
|
2
2
|
import { type CompileOptions, type ModuleCompileOptions, type PreprocessorGroup } from 'svelte/compiler';
|
|
3
|
+
import { type Parsed_Sveltekit_Config } from './sveltekit_config.js';
|
|
3
4
|
export interface Options {
|
|
5
|
+
dev: boolean;
|
|
6
|
+
base_url: Parsed_Sveltekit_Config['base_url'];
|
|
4
7
|
dir?: string;
|
|
5
8
|
svelte_compile_options?: CompileOptions;
|
|
6
9
|
svelte_compile_module_options?: ModuleCompileOptions;
|
|
7
10
|
svelte_preprocessors?: PreprocessorGroup | PreprocessorGroup[];
|
|
11
|
+
ts_transform_options?: esbuild.TransformOptions;
|
|
12
|
+
is_ts?: (filename: string) => boolean;
|
|
8
13
|
}
|
|
9
|
-
export declare const esbuild_plugin_svelte: (options
|
|
14
|
+
export declare const esbuild_plugin_svelte: (options: Options) => esbuild.Plugin;
|
|
10
15
|
//# sourceMappingURL=esbuild_plugin_svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild_plugin_svelte.d.ts","sourceRoot":"../src/lib/","sources":["esbuild_plugin_svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"esbuild_plugin_svelte.d.ts","sourceRoot":"../src/lib/","sources":["esbuild_plugin_svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAIN,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EAGN,KAAK,uBAAuB,EAC5B,MAAM,uBAAuB,CAAC;AAG/B,MAAM,WAAW,OAAO;IACvB,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,uBAAuB,CAAC,UAAU,CAAC,CAAC;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sBAAsB,CAAC,EAAE,cAAc,CAAC;IACxC,6BAA6B,CAAC,EAAE,oBAAoB,CAAC;IACrD,oBAAoB,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,EAAE,CAAC;IAC/D,oBAAoB,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAChD,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;CACtC;AAED,eAAO,MAAM,qBAAqB,YAAa,OAAO,KAAG,OAAO,CAAC,MAmEhE,CAAC"}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
import * as esbuild from 'esbuild';
|
|
1
2
|
import { compile, compileModule, preprocess, } from 'svelte/compiler';
|
|
2
3
|
import { readFile } from 'node:fs/promises';
|
|
3
4
|
import { relative } from 'node:path';
|
|
4
5
|
import { SVELTE_MATCHER, SVELTE_RUNES_MATCHER } from './svelte_helpers.js';
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
import { to_define_import_meta_env, default_ts_transform_options } from './esbuild_helpers.js';
|
|
7
|
+
import { default_sveltekit_config, to_default_compile_module_options, } from './sveltekit_config.js';
|
|
8
|
+
import { TS_MATCHER } from './path_constants.js';
|
|
9
|
+
export const esbuild_plugin_svelte = (options) => {
|
|
10
|
+
const { dev, base_url, dir = process.cwd(), svelte_compile_options = default_sveltekit_config.svelte_compile_options, svelte_compile_module_options = to_default_compile_module_options(svelte_compile_options), svelte_preprocessors, ts_transform_options = default_ts_transform_options, is_ts = (f) => TS_MATCHER.test(f), } = options;
|
|
11
|
+
const final_ts_transform_options = {
|
|
12
|
+
...ts_transform_options,
|
|
13
|
+
define: to_define_import_meta_env(dev, base_url),
|
|
14
|
+
sourcemap: 'inline',
|
|
15
|
+
};
|
|
7
16
|
return {
|
|
8
17
|
name: 'svelte',
|
|
9
18
|
setup: (build) => {
|
|
@@ -11,9 +20,15 @@ export const esbuild_plugin_svelte = (options = {}) => {
|
|
|
11
20
|
const source = await readFile(path, 'utf8');
|
|
12
21
|
try {
|
|
13
22
|
const filename = relative(dir, path);
|
|
14
|
-
const
|
|
15
|
-
|
|
23
|
+
const js_source = is_ts(filename)
|
|
24
|
+
? (await esbuild.transform(source, {
|
|
25
|
+
...final_ts_transform_options,
|
|
26
|
+
sourcefile: filename,
|
|
27
|
+
})).code // TODO @many use warnings? handle not-inline sourcemaps?
|
|
28
|
+
: source;
|
|
29
|
+
const { js, warnings } = compileModule(js_source, {
|
|
16
30
|
...svelte_compile_module_options,
|
|
31
|
+
filename,
|
|
17
32
|
});
|
|
18
33
|
const contents = js.code + '//# sourceMappingURL=' + js.map.toUrl();
|
|
19
34
|
return {
|
|
@@ -32,13 +47,9 @@ export const esbuild_plugin_svelte = (options = {}) => {
|
|
|
32
47
|
const preprocessed = svelte_preprocessors
|
|
33
48
|
? await preprocess(source, svelte_preprocessors, { filename })
|
|
34
49
|
: null;
|
|
35
|
-
// TODO handle preprocessor sourcemaps, same as in loader - merge?
|
|
36
50
|
if (preprocessed?.code)
|
|
37
51
|
source = preprocessed.code;
|
|
38
|
-
const { js, warnings } = compile(source, {
|
|
39
|
-
filename,
|
|
40
|
-
...svelte_compile_options,
|
|
41
|
-
});
|
|
52
|
+
const { js, warnings } = compile(source, { ...svelte_compile_options, filename });
|
|
42
53
|
const contents = js.code + '//# sourceMappingURL=' + js.map.toUrl();
|
|
43
54
|
return {
|
|
44
55
|
contents,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild_plugin_sveltekit_local_imports.d.ts","sourceRoot":"../src/lib/","sources":["esbuild_plugin_sveltekit_local_imports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"esbuild_plugin_sveltekit_local_imports.d.ts","sourceRoot":"../src/lib/","sources":["esbuild_plugin_sveltekit_local_imports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAOxC;;;;GAIG;AACH,eAAO,MAAM,sCAAsC,QAAO,OAAO,CAAC,MAyBhE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import { dirname } from 'node:path';
|
|
3
3
|
import { resolve_specifier } from './resolve_specifier.js';
|
|
4
|
+
import { EVERYTHING_MATCHER } from './path_constants.js';
|
|
4
5
|
/**
|
|
5
6
|
* Adds support for imports to both `.ts` and `.js`,
|
|
6
7
|
* as well as imports without extensions that resolve to `.js` or `.ts`.
|
|
@@ -16,12 +17,12 @@ export const esbuild_plugin_sveltekit_local_imports = () => ({
|
|
|
16
17
|
const { path_id, namespace } = resolve_specifier(path, dirname(importer));
|
|
17
18
|
return { path: path_id, namespace }; // `namespace` may be `undefined`, but esbuild needs the absolute path for json etc
|
|
18
19
|
});
|
|
19
|
-
build.onLoad({ filter:
|
|
20
|
+
build.onLoad({ filter: EVERYTHING_MATCHER, namespace: 'sveltekit_local_imports_ts' }, async ({ path }) => ({
|
|
20
21
|
contents: await readFile(path),
|
|
21
22
|
loader: 'ts',
|
|
22
23
|
resolveDir: dirname(path),
|
|
23
24
|
}));
|
|
24
|
-
build.onLoad({ filter:
|
|
25
|
+
build.onLoad({ filter: EVERYTHING_MATCHER, namespace: 'sveltekit_local_imports_js' }, async ({ path }) => ({
|
|
25
26
|
contents: await readFile(path),
|
|
26
27
|
resolveDir: dirname(path),
|
|
27
28
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild_plugin_sveltekit_shim_app.d.ts","sourceRoot":"../src/lib/","sources":["esbuild_plugin_sveltekit_shim_app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAOxC,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"esbuild_plugin_sveltekit_shim_app.d.ts","sourceRoot":"../src/lib/","sources":["esbuild_plugin_sveltekit_shim_app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAOxC,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,uBAAuB,CAAC;AAGnE,MAAM,WAAW,OAAO;IACvB,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,uBAAuB,CAAC,UAAU,CAAC,CAAC;IAC9C,UAAU,EAAE,uBAAuB,CAAC,YAAY,CAAC,CAAC;CAClD;AAED,eAAO,MAAM,iCAAiC,mCAI3C,OAAO,KAAG,OAAO,CAAC,MAqBnB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { render_sveltekit_shim_app_environment, render_sveltekit_shim_app_paths, sveltekit_shim_app_specifiers, } from './sveltekit_shim_app.js';
|
|
2
|
+
import { EVERYTHING_MATCHER } from './path_constants.js';
|
|
2
3
|
export const esbuild_plugin_sveltekit_shim_app = ({ dev, base_url, assets_url, }) => ({
|
|
3
4
|
name: 'sveltekit_shim_app',
|
|
4
5
|
setup: (build) => {
|
|
@@ -7,14 +8,14 @@ export const esbuild_plugin_sveltekit_shim_app = ({ dev, base_url, assets_url, }
|
|
|
7
8
|
path: sveltekit_shim_app_specifiers.get(path),
|
|
8
9
|
namespace: 'sveltekit_shim_app_paths',
|
|
9
10
|
}));
|
|
10
|
-
build.onLoad({ filter:
|
|
11
|
+
build.onLoad({ filter: EVERYTHING_MATCHER, namespace: 'sveltekit_shim_app_paths' }, () => ({
|
|
11
12
|
contents: render_sveltekit_shim_app_paths(base_url, assets_url),
|
|
12
13
|
}));
|
|
13
14
|
build.onResolve({ filter: /^\$app\/environment$/ }, ({ path }) => ({
|
|
14
15
|
path: sveltekit_shim_app_specifiers.get(path),
|
|
15
16
|
namespace: 'sveltekit_shim_app_environment',
|
|
16
17
|
}));
|
|
17
|
-
build.onLoad({ filter:
|
|
18
|
+
build.onLoad({ filter: EVERYTHING_MATCHER, namespace: 'sveltekit_shim_app_environment' }, () => ({
|
|
18
19
|
contents: render_sveltekit_shim_app_environment(dev),
|
|
19
20
|
}));
|
|
20
21
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild_plugin_sveltekit_shim_env.d.ts","sourceRoot":"../src/lib/","sources":["esbuild_plugin_sveltekit_shim_env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"esbuild_plugin_sveltekit_shim_env.d.ts","sourceRoot":"../src/lib/","sources":["esbuild_plugin_sveltekit_shim_env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAMxC,MAAM,WAAW,OAAO;IACvB,GAAG,EAAE,OAAO,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAID,eAAO,MAAM,iCAAiC,6EAO3C,OAAO,KAAG,OAAO,CAAC,MAuBnB,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { render_env_shim_module } from './sveltekit_shim_env.js';
|
|
2
|
+
import { EVERYTHING_MATCHER } from './path_constants.js';
|
|
3
|
+
import { SVELTEKIT_ENV_MATCHER } from './sveltekit_helpers.js';
|
|
4
|
+
const namespace = 'sveltekit_shim_env';
|
|
2
5
|
export const esbuild_plugin_sveltekit_shim_env = ({ dev, public_prefix, private_prefix, env_dir, env_files, ambient_env, }) => ({
|
|
3
6
|
name: 'sveltekit_shim_env',
|
|
4
7
|
setup: (build) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
build.onLoad({ filter: /.*/, namespace }, ({ path }) => {
|
|
9
|
-
const matches = filter.exec(path);
|
|
8
|
+
build.onResolve({ filter: SVELTEKIT_ENV_MATCHER }, ({ path }) => ({ path, namespace }));
|
|
9
|
+
build.onLoad({ filter: EVERYTHING_MATCHER, namespace }, ({ path }) => {
|
|
10
|
+
const matches = SVELTEKIT_ENV_MATCHER.exec(path);
|
|
10
11
|
const mode = matches[1];
|
|
11
12
|
const visibility = matches[2];
|
|
12
13
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gro_plugin_server.d.ts","sourceRoot":"../src/lib/","sources":["gro_plugin_server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAC,MAAM,IAAI,eAAe,EAAC,MAAM,eAAe,CAAC;AAI7D,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAGrD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"gro_plugin_server.d.ts","sourceRoot":"../src/lib/","sources":["gro_plugin_server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAC,MAAM,IAAI,eAAe,EAAC,MAAM,eAAe,CAAC;AAI7D,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAGrD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAiBxC,eAAO,MAAM,gBAAgB,6BAA0D,CAAC;AAExF,eAAO,MAAM,UAAU,0CAA8B,MAAM,CAAC,MAAM,EAAE;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,CAKpF,CAAC;AAEF,MAAM,WAAW,OAAO;IACvB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC;;OAEG;IACH,gBAAgB,CAAC,EAAE,eAAe,CAAC;IACnC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC;IACrF;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACd;AAED,MAAM,WAAW,QAAQ;IACxB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,QAAQ,CAAC;AAEzD,eAAO,MAAM,iBAAiB,yJAgB3B,OAAO,KAAQ,MAgJjB,CAAC"}
|
|
@@ -7,7 +7,7 @@ import { existsSync } from 'node:fs';
|
|
|
7
7
|
import { base_path_to_path_id, LIB_DIRNAME, paths } from './paths.js';
|
|
8
8
|
import { GRO_DEV_DIRNAME, SERVER_DIST_PATH } from './path_constants.js';
|
|
9
9
|
import { watch_dir } from './watch_dir.js';
|
|
10
|
-
import { init_sveltekit_config } from './sveltekit_config.js';
|
|
10
|
+
import { init_sveltekit_config, default_sveltekit_config } from './sveltekit_config.js';
|
|
11
11
|
import { esbuild_plugin_sveltekit_shim_app } from './esbuild_plugin_sveltekit_shim_app.js';
|
|
12
12
|
import { esbuild_plugin_sveltekit_shim_env } from './esbuild_plugin_sveltekit_shim_env.js';
|
|
13
13
|
import { print_build_result, to_define_import_meta_env } from './esbuild_helpers.js';
|
|
@@ -16,7 +16,6 @@ import { esbuild_plugin_external_worker } from './esbuild_plugin_external_worker
|
|
|
16
16
|
import { esbuild_plugin_sveltekit_local_imports } from './esbuild_plugin_sveltekit_local_imports.js';
|
|
17
17
|
import { esbuild_plugin_svelte } from './esbuild_plugin_svelte.js';
|
|
18
18
|
import { throttle } from './throttle.js';
|
|
19
|
-
import { sveltekit_config_global } from './sveltekit_config_global.js';
|
|
20
19
|
// TODO sourcemap as a hoisted option? disable for production by default - or like `outpaths`, passed a `dev` param
|
|
21
20
|
export const SERVER_SOURCE_ID = base_path_to_path_id(LIB_DIRNAME + '/server/server.ts');
|
|
22
21
|
export const has_server = (path = SERVER_SOURCE_ID) => {
|
|
@@ -39,16 +38,9 @@ export const gro_plugin_server = ({ entry_points = [SERVER_SOURCE_ID], dir = pro
|
|
|
39
38
|
name: 'gro_plugin_server',
|
|
40
39
|
setup: async ({ dev, watch, timings, log }) => {
|
|
41
40
|
const parsed_sveltekit_config = !sveltekit_config && strip_end(dir, '/') === process.cwd()
|
|
42
|
-
?
|
|
41
|
+
? default_sveltekit_config
|
|
43
42
|
: await init_sveltekit_config(sveltekit_config ?? dir);
|
|
44
43
|
const { alias, base_url, assets_url, env_dir, private_prefix, public_prefix, svelte_compile_options, svelte_compile_module_options, svelte_preprocessors, } = parsed_sveltekit_config;
|
|
45
|
-
// TODO hacky
|
|
46
|
-
if (svelte_compile_options.generate === undefined) {
|
|
47
|
-
svelte_compile_options.generate = 'server';
|
|
48
|
-
}
|
|
49
|
-
if (svelte_compile_module_options.generate === undefined) {
|
|
50
|
-
svelte_compile_module_options.generate = 'server';
|
|
51
|
-
}
|
|
52
44
|
const { outbase, outdir, outname } = outpaths(dev);
|
|
53
45
|
const server_outpath = join(outdir, outname);
|
|
54
46
|
const timing_to_esbuild_create_context = timings.start('create build context');
|
|
@@ -92,6 +84,8 @@ export const gro_plugin_server = ({ entry_points = [SERVER_SOURCE_ID], dir = pro
|
|
|
92
84
|
log,
|
|
93
85
|
}),
|
|
94
86
|
esbuild_plugin_svelte({
|
|
87
|
+
dev,
|
|
88
|
+
base_url,
|
|
95
89
|
dir,
|
|
96
90
|
svelte_compile_options,
|
|
97
91
|
svelte_compile_module_options,
|
|
@@ -6,7 +6,7 @@ import { Task_Error } from './task.js';
|
|
|
6
6
|
import { find_cli, spawn_cli, spawn_cli_process } from './cli.js';
|
|
7
7
|
import { serialize_src_json, create_src_json } from './src_json.js';
|
|
8
8
|
import { DEFAULT_EXPORTS_EXCLUDER } from './gro_config.js';
|
|
9
|
-
import {
|
|
9
|
+
import { default_sveltekit_config } from './sveltekit_config.js';
|
|
10
10
|
import { SOURCE_DIRNAME } from './path_constants.js';
|
|
11
11
|
import { VITE_CLI } from './sveltekit_helpers.js';
|
|
12
12
|
export const gro_plugin_sveltekit_app = ({ host_target = 'github_pages', well_known_package_json, well_known_src_json, well_known_src_files, vite_cli = VITE_CLI, } = {}) => {
|
|
@@ -57,7 +57,7 @@ export const gro_plugin_sveltekit_app = ({ host_target = 'github_pages', well_kn
|
|
|
57
57
|
// maybe a Vite middleware is best? what if this plugin added its plugin to your `vite.config.ts`?
|
|
58
58
|
// copy files to `static` before building, in such a way
|
|
59
59
|
// that's non-destructive to existing files and dirs and easy to clean up
|
|
60
|
-
const { assets_path } =
|
|
60
|
+
const { assets_path } = default_sveltekit_config;
|
|
61
61
|
const cleanups = [
|
|
62
62
|
serialized_package_json
|
|
63
63
|
? create_temporarily(join(assets_path, '.well-known/package.json'), serialized_package_json)
|
package/dist/loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"../src/lib/","sources":["loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"../src/lib/","sources":["loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AA+EvD,eAAO,MAAM,IAAI,EAAE,QAsFlB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,WAoDrB,CAAC"}
|
package/dist/loader.js
CHANGED
|
@@ -5,11 +5,11 @@ import { dirname, join } from 'node:path';
|
|
|
5
5
|
import { escape_regexp } from '@ryanatkn/belt/regexp.js';
|
|
6
6
|
import { render_env_shim_module } from './sveltekit_shim_env.js';
|
|
7
7
|
import { render_sveltekit_shim_app_environment, render_sveltekit_shim_app_paths, SVELTEKIT_SHIM_APP_ENVIRONMENT_MATCHER, SVELTEKIT_SHIM_APP_PATHS_MATCHER, sveltekit_shim_app_specifiers, } from './sveltekit_shim_app.js';
|
|
8
|
-
import {
|
|
8
|
+
import { default_sveltekit_config } from './sveltekit_config.js';
|
|
9
9
|
import { SVELTE_MATCHER, SVELTE_RUNES_MATCHER } from './svelte_helpers.js';
|
|
10
10
|
import { paths } from './paths.js';
|
|
11
|
-
import { NODE_MODULES_DIRNAME } from './path_constants.js';
|
|
12
|
-
import { to_define_import_meta_env,
|
|
11
|
+
import { JSON_MATCHER, NODE_MODULES_DIRNAME, TS_MATCHER } from './path_constants.js';
|
|
12
|
+
import { to_define_import_meta_env, default_ts_transform_options } from './esbuild_helpers.js';
|
|
13
13
|
import { resolve_specifier } from './resolve_specifier.js';
|
|
14
14
|
import { resolve_node_specifier } from './resolve_node_specifier.js';
|
|
15
15
|
/*
|
|
@@ -41,15 +41,13 @@ TODO how to improve that gnarly import line? was originally designed for the now
|
|
|
41
41
|
// dev is always true in the loader
|
|
42
42
|
const dev = true;
|
|
43
43
|
const dir = paths.root;
|
|
44
|
-
const { alias, base_url, assets_url, env_dir, private_prefix, public_prefix, svelte_compile_options, svelte_compile_module_options, svelte_preprocessors, } =
|
|
45
|
-
const
|
|
46
|
-
...
|
|
44
|
+
const { alias, base_url, assets_url, env_dir, private_prefix, public_prefix, svelte_compile_options, svelte_compile_module_options, svelte_preprocessors, } = default_sveltekit_config;
|
|
45
|
+
const ts_transform_options = {
|
|
46
|
+
...default_ts_transform_options,
|
|
47
47
|
define: to_define_import_meta_env(dev, base_url),
|
|
48
48
|
sourcemap: 'inline',
|
|
49
49
|
};
|
|
50
50
|
const aliases = Object.entries({ $lib: 'src/lib', ...alias });
|
|
51
|
-
const TS_MATCHER = /\.(ts|tsx|mts|cts)$/;
|
|
52
|
-
const JSON_MATCHER = /\.(json)$/;
|
|
53
51
|
const NOOP_MATCHER = /\.(css|svg)$/; // TODO others? configurable?
|
|
54
52
|
const ENV_MATCHER = /src\/lib\/\$env\/(static|dynamic)\/(public|private)$/;
|
|
55
53
|
const NODE_MODULES_MATCHER = new RegExp(escape_regexp('/' + NODE_MODULES_DIRNAME + '/'), 'u');
|
|
@@ -73,18 +71,20 @@ export const load = async (url, context, nextLoad) => {
|
|
|
73
71
|
}
|
|
74
72
|
else if (SVELTE_RUNES_MATCHER.test(url)) {
|
|
75
73
|
// Svelte runes in js/ts
|
|
76
|
-
// TODO support sourcemaps
|
|
77
74
|
const loaded = await nextLoad(url, context.format === 'module' ? context : { ...context, format: 'module' });
|
|
78
75
|
const filename = fileURLToPath(url);
|
|
79
76
|
const source = loaded.source.toString(); // eslint-disable-line @typescript-eslint/no-base-to-string
|
|
80
|
-
const
|
|
77
|
+
const js_source = TS_MATCHER.test(url)
|
|
78
|
+
? (await esbuild.transform(source, { ...ts_transform_options, sourcefile: url })).code // TODO @many use warnings? handle not-inline sourcemaps?
|
|
79
|
+
: source;
|
|
80
|
+
const transformed = compileModule(js_source, { ...svelte_compile_module_options, dev, filename });
|
|
81
81
|
return { format: 'module', shortCircuit: true, source: transformed.js.code };
|
|
82
82
|
}
|
|
83
83
|
else if (TS_MATCHER.test(url)) {
|
|
84
84
|
// ts
|
|
85
85
|
const loaded = await nextLoad(url, context.format === 'module' ? context : { ...context, format: 'module' });
|
|
86
|
-
const
|
|
87
|
-
{ ...
|
|
86
|
+
const source = loaded.source.toString(); // eslint-disable-line @typescript-eslint/no-base-to-string
|
|
87
|
+
const transformed = await esbuild.transform(source, { ...ts_transform_options, sourcefile: url }); // TODO @many use warnings? handle not-inline sourcemaps?
|
|
88
88
|
return { format: 'module', shortCircuit: true, source: transformed.code };
|
|
89
89
|
}
|
|
90
90
|
else if (SVELTE_MATCHER.test(url)) {
|
|
@@ -93,11 +93,11 @@ export const load = async (url, context, nextLoad) => {
|
|
|
93
93
|
const loaded = await nextLoad(url, context.format === 'module' ? context : { ...context, format: 'module' });
|
|
94
94
|
const filename = fileURLToPath(url);
|
|
95
95
|
const raw_source = loaded.source.toString(); // eslint-disable-line @typescript-eslint/no-base-to-string
|
|
96
|
-
const preprocessed = svelte_preprocessors
|
|
96
|
+
const preprocessed = svelte_preprocessors // TODO @many use sourcemaps (and diagnostics?)
|
|
97
97
|
? await preprocess(raw_source, svelte_preprocessors, { filename })
|
|
98
98
|
: null;
|
|
99
99
|
const source = preprocessed?.code ?? raw_source;
|
|
100
|
-
const transformed = compile(source, { ...svelte_compile_options, filename });
|
|
100
|
+
const transformed = compile(source, { ...svelte_compile_options, dev, filename });
|
|
101
101
|
return { format: 'module', shortCircuit: true, source: transformed.js.code };
|
|
102
102
|
}
|
|
103
103
|
else if (JSON_MATCHER.test(url)) {
|
package/dist/package.d.ts
CHANGED
|
@@ -357,10 +357,6 @@ export declare const package_json: {
|
|
|
357
357
|
types: string;
|
|
358
358
|
default: string;
|
|
359
359
|
};
|
|
360
|
-
'./sveltekit_config_global.js': {
|
|
361
|
-
types: string;
|
|
362
|
-
default: string;
|
|
363
|
-
};
|
|
364
360
|
'./sveltekit_config.js': {
|
|
365
361
|
types: string;
|
|
366
362
|
default: string;
|
|
@@ -892,13 +888,6 @@ export declare const src_json: {
|
|
|
892
888
|
kind: string;
|
|
893
889
|
}[];
|
|
894
890
|
};
|
|
895
|
-
'./sveltekit_config_global.js': {
|
|
896
|
-
path: string;
|
|
897
|
-
declarations: {
|
|
898
|
-
name: string;
|
|
899
|
-
kind: string;
|
|
900
|
-
}[];
|
|
901
|
-
};
|
|
902
891
|
'./sveltekit_config.js': {
|
|
903
892
|
path: string;
|
|
904
893
|
declarations: {
|
package/dist/package.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.d.ts","sourceRoot":"../src/lib/","sources":["package.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"package.d.ts","sourceRoot":"../src/lib/","sources":["package.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqQD,CAAC;AAEzB,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyuBD,CAAC"}
|