@wix/astro 1.0.9 → 1.0.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/astro",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "devDependencies": {
5
5
  "@wix/dashboard": "^1.3.35",
6
6
  "@wix/sdk": "^1.15.17",
@@ -42,5 +42,5 @@
42
42
  ]
43
43
  }
44
44
  },
45
- "falconPackageHash": "b251cbdb69f32089c9cf5f43829ea7ff50cd2e9047db782ba373ae5f"
45
+ "falconPackageHash": "65862338b634d01a1ba6e654863433d3994fd23e9232010e19a045d6"
46
46
  }
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { join } from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
2
3
  import type { AstroConfig, AstroIntegration } from 'astro';
3
4
  import { envField, passthroughImageService } from 'astro/config';
4
5
  import chokidar from 'chokidar';
@@ -27,15 +28,15 @@ const createIntegration = (): AstroIntegration => {
27
28
  model ??= await createProjectModel(logger);
28
29
  const appManifest = generateAppManifest(model);
29
30
 
30
- const appManifestPath = join(
31
- _config.outDir.pathname,
32
- '_wix/app-manifest.json'
33
- );
31
+ const outDir = fileURLToPath(_config.outDir);
32
+ const rootDir = fileURLToPath(_config.outDir);
33
+
34
+ const appManifestPath = join(outDir, '_wix/app-manifest.json');
34
35
 
35
36
  await writeJson(appManifestPath, appManifest, { spaces: 2 });
36
37
 
37
38
  await writeJson(
38
- join(_config.root.pathname, GIT_IGNORED_DIR, 'build-metadata.json'),
39
+ join(rootDir, GIT_IGNORED_DIR, 'build-metadata.json'),
39
40
  await resolveBuildMetadata(appManifestPath, _config),
40
41
  { spaces: 2 }
41
42
  );
@@ -53,7 +54,9 @@ const createIntegration = (): AstroIntegration => {
53
54
  logger,
54
55
  updateConfig,
55
56
  }) {
56
- const { pathname: codegenDir } = createCodegenDir();
57
+ const codegenDirURL = createCodegenDir();
58
+ const codegenDir = fileURLToPath(codegenDirURL);
59
+ const rootDir = fileURLToPath(config.outDir);
57
60
 
58
61
  model ??= await createProjectModel(logger);
59
62
 
@@ -169,7 +172,7 @@ const createIntegration = (): AstroIntegration => {
169
172
 
170
173
  chokidar
171
174
  .watch([EXTENSIONS_DIR], {
172
- cwd: config.root.pathname,
175
+ cwd: rootDir,
173
176
  ignoreInitial: true,
174
177
  useFsEvents: false,
175
178
  })
@@ -215,7 +218,7 @@ const createIntegration = (): AstroIntegration => {
215
218
 
216
219
  chokidar
217
220
  .watch([EXTENSIONS_DIR], {
218
- cwd: config.root.pathname,
221
+ cwd: rootDir,
219
222
  ignoreInitial: true,
220
223
  useFsEvents: false,
221
224
  })
@@ -260,7 +263,7 @@ const createIntegration = (): AstroIntegration => {
260
263
 
261
264
  chokidar
262
265
  .watch([EXTENSIONS_DIR], {
263
- cwd: config.root.pathname,
266
+ cwd: rootDir,
264
267
  ignoreInitial: true,
265
268
  useFsEvents: false,
266
269
  })
@@ -1,3 +1,4 @@
1
+ import { fileURLToPath } from 'node:url';
1
2
  import type { AstroConfig } from 'astro';
2
3
  import { pathExists } from './fs-utils.js';
3
4
 
@@ -5,7 +6,6 @@ interface BuildMetadata {
5
6
  appManifestPath: string;
6
7
  clientDir: string;
7
8
  outDir: string;
8
- // In SSG (static site generation) mode, there is no `serverDir`, only the client side output.
9
9
  serverDir?: string;
10
10
  }
11
11
 
@@ -13,18 +13,25 @@ export async function resolveBuildMetadata(
13
13
  appManifestPath: string,
14
14
  config: AstroConfig
15
15
  ): Promise<BuildMetadata> {
16
- const clientDir = (await pathExists(config.build.client.pathname))
17
- ? config.build.client.pathname
18
- : config.outDir.pathname;
16
+ const outDir = fileURLToPath(config.outDir);
17
+ const buildClientDir = fileURLToPath(config.build.client);
18
+ const buildServerDir = fileURLToPath(config.build.server);
19
+
20
+ // When there are only static assets, everything is under the out dir.
21
+ // When there are static and server, the output is in the appropriate folders
22
+ const clientDir = (await pathExists(buildClientDir))
23
+ ? buildClientDir
24
+ : outDir;
19
25
 
20
- const serverDir = (await pathExists(config.build.server.pathname))
21
- ? config.build.server.pathname
26
+ // In SSG (static site generation) mode, there is no `serverDir`, only the client side output.
27
+ const serverDir = (await pathExists(buildServerDir))
28
+ ? buildServerDir
22
29
  : undefined;
23
30
 
24
31
  return {
25
32
  appManifestPath,
26
33
  clientDir,
27
- outDir: config.outDir.pathname,
34
+ outDir,
28
35
  serverDir,
29
36
  };
30
37
  }