Skip to content

Commit

Permalink
chore: fix for explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Jun 19, 2024
1 parent ca26016 commit 6b42a04
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions explorer-v2/build-system/shim/path.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,40 @@
export default {
extname,
isAbsolute,
join
join,
resolve,
dirname,
basename
};

export function extname(p) {
return /\.[^.]*$/.exec(p)?.[0];
}

export function isAbsolute() {
return false;
}
export function join(...args) {
return args.join('/');
}
export function resolve(...args) {
return join(...args);
}
export function parse(s) {
const dir = dirname(s);
const ext = extname(s);
const base = basename(s);
return {
root: '',
dir,
base,
ext,
name: basename(base, ext)
};
}
export function dirname(p) {
return p.split('/').slice(0, -1).join('/') || p;
}
export function basename(p, ext) {
const base = p.split('/').pop() || p;
return base.endsWith(ext) ? base.slice(0, -ext.length) : base;
}

0 comments on commit 6b42a04

Please sign in to comment.