@vcmap/plugin-cli 4.1.1 → 4.1.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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/serve.js +24 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcmap/plugin-cli",
3
- "version": "4.1.1",
3
+ "version": "4.1.3",
4
4
  "description": "A CLI to help develop and build plugins for the VC Map",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/serve.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import fs from 'fs';
2
- import { lstat, readFile } from 'fs/promises';
2
+ import { lstat, readFile, readlink } from 'fs/promises';
3
3
  import { createServer } from 'vite';
4
4
  import vue from '@vitejs/plugin-vue';
5
5
  import express from 'express';
6
6
  import { logger } from '@vcsuite/cli-logger';
7
7
  import path from 'path';
8
+ import { join, resolve, dirname } from 'node:path';
8
9
  import { getContext } from './context.js';
9
10
  import {
10
11
  addConfigRoute,
@@ -120,6 +121,7 @@ export default async function serve(options) {
120
121
  const { peerDependencies } = await getPackageJson();
121
122
 
122
123
  const optimizationIncludes = [
124
+ 'geotiff',
123
125
  'fast-deep-equal',
124
126
  'rbush',
125
127
  'rbush-knn',
@@ -141,6 +143,26 @@ export default async function serve(options) {
141
143
  (name) => !optimizationIncludes.includes(name),
142
144
  );
143
145
 
146
+ let serverFsConfig;
147
+ const coreModule = join(process.cwd(), 'node_modules', '@vcmap', 'core');
148
+ const coreStats = await lstat(coreModule);
149
+ if (coreStats.isSymbolicLink()) {
150
+ const linkPath = await readlink(coreModule);
151
+ serverFsConfig = {
152
+ allow: [
153
+ '.',
154
+ resolve(dirname(coreModule), join(linkPath, 'dist', 'src', 'workers')),
155
+ ],
156
+ };
157
+ } else {
158
+ serverFsConfig = {
159
+ allow: [
160
+ '.',
161
+ resolve(dirname(coreModule), join('dist', 'src', 'workers')),
162
+ ],
163
+ };
164
+ }
165
+
144
166
  const server = await createServer({
145
167
  root: getContext(),
146
168
  publicDir: './node_modules/@vcmap/ui/public',
@@ -171,6 +193,7 @@ export default async function serve(options) {
171
193
  },
172
194
  plugins: [vue(), createConfigJsonReloadPlugin()],
173
195
  server: {
196
+ fs: serverFsConfig,
174
197
  middlewareMode: true,
175
198
  proxy: { ...mergedOptions.proxy, ...proxy },
176
199
  },