Skip to content

Commit

Permalink
fix: do not use extra path.posix when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
joneff committed Sep 19, 2022
1 parent 8616d5a commit 068e4b2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ const buildOptions = merge( {}, sharedOptions );
*/
function compile( file, options ) {
const opts = merge( {}, compileOptions, options );
const cwd = path.posix.resolve(opts.cwd || CWD);
const cwd = path.resolve(opts.cwd || CWD);
let result = [
'// This file is auto-generated. Do not edit!',
`// baka:source ${path.posix.resolve(file).replace(`${cwd}/`,'')}`,
`// baka:source ${path.resolve(file).replace(`${cwd}/`,'')}`,
'\n'
].join('\n');

Expand All @@ -51,7 +51,7 @@ function compile( file, options ) {
: [];

ignoredFiles.forEach(file => {
opts.ignoredFiles.add(path.posix.resolve(file));
opts.ignoredFiles.add(path.resolve(file));
});

result += parse( file, opts );
Expand All @@ -69,12 +69,12 @@ function compile( file, options ) {
*/
function build( file, outFile, options ) {
const opts = merge( {}, buildOptions, options );
const cwd = path.posix.resolve(opts.cwd || CWD);
const cwd = path.resolve(opts.cwd || CWD);

// eslint-disable-next-line no-param-reassign
file = path.posix.resolve( cwd, file );
file = path.resolve( cwd, file );
// eslint-disable-next-line no-param-reassign
outFile = path.posix.resolve( cwd, outFile );
outFile = path.resolve( cwd, outFile );

const result = compile( file, opts );

Expand All @@ -89,11 +89,11 @@ function build( file, outFile, options ) {
*/
function buildFiles( fileOrGlob, output = {}, options ) {
const opts = merge( {}, buildOptions, options );
const cwd = path.posix.resolve(opts.cwd || CWD);
const cwd = path.resolve(opts.cwd || CWD);

// eslint-disable-next-line no-param-reassign
output = {
path: path.posix.resolve(cwd, output.path || 'dist'),
path: path.resolve(cwd, output.path || 'dist'),
filename: output.filename || '[name]-flat[ext]'
};

Expand All @@ -107,7 +107,7 @@ function buildFiles( fileOrGlob, output = {}, options ) {

files.forEach(file => {
// eslint-disable-next-line no-param-reassign
file = path.posix.resolve(cwd, file);
file = path.resolve(cwd, file);

const outFile = path.resolve(
output.path,
Expand Down
4 changes: 2 additions & 2 deletions src/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ function importReplacer( matchedLine, matchedPath, annotation, context ) {
importedPaths,
ignoredFiles
} = context;
const cwd = path.posix.resolve(context.cwd || process.cwd());
const nodeModules = path.posix.resolve( cwd, context.nodeModules || 'node_modules');
const cwd = path.resolve(context.cwd || process.cwd());
const nodeModules = path.resolve( cwd, context.nodeModules || 'node_modules');
const result = [];
let url;
let directive;
Expand Down

0 comments on commit 068e4b2

Please sign in to comment.