zone5 1.2.1 → 1.3.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.
package/dist/vite.d.ts CHANGED
@@ -1,2 +1,6 @@
1
1
  import type { Plugin } from 'vite';
2
- export declare function zone5(cwd?: string): Plugin;
2
+ export interface Zone5PluginOptions {
3
+ cwd?: string;
4
+ basePath?: string;
5
+ }
6
+ export declare function zone5(options?: Zone5PluginOptions): Plugin;
package/dist/vite.js CHANGED
@@ -38,7 +38,7 @@ const serve = (basePath, cacheDir) => async (req, res, next) => {
38
38
  }
39
39
  next();
40
40
  };
41
- export function zone5(cwd) {
41
+ export function zone5(options = {}) {
42
42
  let viteConfig;
43
43
  let basePath;
44
44
  let zone5Config;
@@ -47,8 +47,11 @@ export function zone5(cwd) {
47
47
  enforce: 'pre',
48
48
  async configResolved(cfg) {
49
49
  viteConfig = cfg;
50
- zone5Config = await load(cwd);
51
- basePath = createBasePath(zone5Config.base.namespace, viteConfig.base);
50
+ zone5Config = await load(options.cwd);
51
+ const base = options.basePath
52
+ ? `${options.basePath.replace(/\/$/, '')}/${viteConfig.base.replace(/^\//, '')}`
53
+ : viteConfig.base;
54
+ basePath = createBasePath(zone5Config.base.namespace, base);
52
55
  },
53
56
  async resolveId(id, importer) {
54
57
  const srcURL = parseURL(id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zone5",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "repository": {
5
5
  "url": "https://github.com/cwygoda/zone5"
6
6
  },