unplugin-isolated-decl 0.4.6 → 0.4.7

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/esbuild.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  require('./transformer-wFl7-Qrk.cjs');
3
- const require_src_index = require('./src_index-yIG2muej.cjs');
3
+ const require_src_index = require('./src_index-t9_prpkU.cjs');
4
4
 
5
5
  //#region src/esbuild.ts
6
6
  var esbuild_default = require_src_index.IsolatedDecl.esbuild;
package/dist/esbuild.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./transformer-69vts78l.js";
2
- import { IsolatedDecl } from "./src_index-CysF8PH2.js";
2
+ import { IsolatedDecl } from "./src_index-IB8kj2gH.js";
3
3
 
4
4
  //#region src/esbuild.ts
5
5
  var esbuild_default = IsolatedDecl.esbuild;
package/dist/index.cjs CHANGED
@@ -1,10 +1,16 @@
1
1
  "use strict";
2
2
  require('./transformer-wFl7-Qrk.cjs');
3
- const require_src_index = require('./src_index-yIG2muej.cjs');
3
+ const require_src_index = require('./src_index-t9_prpkU.cjs');
4
4
 
5
5
  Object.defineProperty(exports, 'IsolatedDecl', {
6
6
  enumerable: true,
7
7
  get: function () {
8
8
  return require_src_index.IsolatedDecl;
9
9
  }
10
+ });
11
+ Object.defineProperty(exports, 'lowestCommonAncestor', {
12
+ enumerable: true,
13
+ get: function () {
14
+ return require_src_index.lowestCommonAncestor;
15
+ }
10
16
  });
package/dist/index.d.cts CHANGED
@@ -2,3 +2,4 @@ import { type UnpluginInstance } from "unplugin";
2
2
  import { type Options } from "./core/options";
3
3
  export type { Options };
4
4
  export declare const IsolatedDecl: UnpluginInstance<Options | undefined, false>;
5
+ export declare function lowestCommonAncestor(...filepaths: string[]): string;
package/dist/index.d.ts CHANGED
@@ -2,3 +2,4 @@ import { type UnpluginInstance } from "unplugin";
2
2
  import { type Options } from "./core/options";
3
3
  export type { Options };
4
4
  export declare const IsolatedDecl: UnpluginInstance<Options | undefined, false>;
5
+ export declare function lowestCommonAncestor(...filepaths: string[]): string;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import "./transformer-69vts78l.js";
2
- import { IsolatedDecl } from "./src_index-CysF8PH2.js";
2
+ import { IsolatedDecl, lowestCommonAncestor } from "./src_index-IB8kj2gH.js";
3
3
 
4
- export { IsolatedDecl };
4
+ export { IsolatedDecl, lowestCommonAncestor };
package/dist/rolldown.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  require('./transformer-wFl7-Qrk.cjs');
3
- const require_src_index = require('./src_index-yIG2muej.cjs');
3
+ const require_src_index = require('./src_index-t9_prpkU.cjs');
4
4
 
5
5
  //#region src/rolldown.ts
6
6
  var rolldown_default = require_src_index.IsolatedDecl.rolldown;
package/dist/rolldown.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./transformer-69vts78l.js";
2
- import { IsolatedDecl } from "./src_index-CysF8PH2.js";
2
+ import { IsolatedDecl } from "./src_index-IB8kj2gH.js";
3
3
 
4
4
  //#region src/rolldown.ts
5
5
  var rolldown_default = IsolatedDecl.rolldown;
package/dist/rollup.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  require('./transformer-wFl7-Qrk.cjs');
3
- const require_src_index = require('./src_index-yIG2muej.cjs');
3
+ const require_src_index = require('./src_index-t9_prpkU.cjs');
4
4
 
5
5
  //#region src/rollup.ts
6
6
  var rollup_default = require_src_index.IsolatedDecl.rollup;
package/dist/rollup.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./transformer-69vts78l.js";
2
- import { IsolatedDecl } from "./src_index-CysF8PH2.js";
2
+ import { IsolatedDecl } from "./src_index-IB8kj2gH.js";
3
3
 
4
4
  //#region src/rollup.ts
5
5
  var rollup_default = IsolatedDecl.rollup;
@@ -166,10 +166,11 @@ const IsolatedDecl = createUnplugin((rawOptions = {}, meta) => {
166
166
  function lowestCommonAncestor(...filepaths) {
167
167
  if (filepaths.length === 0) return "";
168
168
  if (filepaths.length === 1) return path.dirname(filepaths[0]);
169
+ filepaths = filepaths.map((p) => p.replaceAll("\\", "/"));
169
170
  const [first, ...rest] = filepaths;
170
- let ancestor = first.split(path.sep);
171
+ let ancestor = first.split("/");
171
172
  for (const filepath of rest) {
172
- const directories = filepath.split(path.sep, ancestor.length);
173
+ const directories = filepath.split("/", ancestor.length);
173
174
  let index = 0;
174
175
  for (const directory of directories) {
175
176
  if (directory === ancestor[index]) {
@@ -181,8 +182,8 @@ function lowestCommonAncestor(...filepaths) {
181
182
  }
182
183
  ancestor = ancestor.slice(0, index);
183
184
  }
184
- return ancestor.length <= 1 && ancestor[0] === "" ? path.sep + ancestor[0] : ancestor.join(path.sep);
185
+ return ancestor.length <= 1 && ancestor[0] === "" ? `/${ancestor[0]}` : ancestor.join("/");
185
186
  }
186
187
 
187
188
  //#endregion
188
- export { IsolatedDecl };
189
+ export { IsolatedDecl, lowestCommonAncestor };
@@ -167,10 +167,11 @@ const IsolatedDecl = createUnplugin((rawOptions = {}, meta) => {
167
167
  function lowestCommonAncestor(...filepaths) {
168
168
  if (filepaths.length === 0) return "";
169
169
  if (filepaths.length === 1) return path.dirname(filepaths[0]);
170
+ filepaths = filepaths.map((p) => p.replaceAll("\\", "/"));
170
171
  const [first, ...rest] = filepaths;
171
- let ancestor = first.split(path.sep);
172
+ let ancestor = first.split("/");
172
173
  for (const filepath of rest) {
173
- const directories = filepath.split(path.sep, ancestor.length);
174
+ const directories = filepath.split("/", ancestor.length);
174
175
  let index = 0;
175
176
  for (const directory of directories) {
176
177
  if (directory === ancestor[index]) {
@@ -182,7 +183,7 @@ function lowestCommonAncestor(...filepaths) {
182
183
  }
183
184
  ancestor = ancestor.slice(0, index);
184
185
  }
185
- return ancestor.length <= 1 && ancestor[0] === "" ? path.sep + ancestor[0] : ancestor.join(path.sep);
186
+ return ancestor.length <= 1 && ancestor[0] === "" ? `/${ancestor[0]}` : ancestor.join("/");
186
187
  }
187
188
 
188
189
  //#endregion
@@ -191,4 +192,9 @@ Object.defineProperty(exports, 'IsolatedDecl', {
191
192
  get: function () {
192
193
  return IsolatedDecl;
193
194
  }
195
+ });Object.defineProperty(exports, 'lowestCommonAncestor', {
196
+ enumerable: true,
197
+ get: function () {
198
+ return lowestCommonAncestor;
199
+ }
194
200
  });
package/dist/vite.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  require('./transformer-wFl7-Qrk.cjs');
3
- const require_src_index = require('./src_index-yIG2muej.cjs');
3
+ const require_src_index = require('./src_index-t9_prpkU.cjs');
4
4
 
5
5
  //#region src/vite.ts
6
6
  var vite_default = require_src_index.IsolatedDecl.vite;
package/dist/vite.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./transformer-69vts78l.js";
2
- import { IsolatedDecl } from "./src_index-CysF8PH2.js";
2
+ import { IsolatedDecl } from "./src_index-IB8kj2gH.js";
3
3
 
4
4
  //#region src/vite.ts
5
5
  var vite_default = IsolatedDecl.vite;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unplugin-isolated-decl",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "A blazing-fast tool for generating isolated declarations, powered by Oxc.",
5
5
  "type": "module",
6
6
  "keywords": [