cpp.js 0.3.0 → 0.3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cpp.js",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {
package/src/bin.js CHANGED
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import packageJSON from '../package.json' assert { type: 'json' };
4
3
  import { Command, Argument } from 'commander';
5
4
  import fs from 'fs';
6
5
  import glob from 'glob';
7
6
  import { createDir } from './utils/createTempDir.js';
8
7
 
8
+ const packageJSON = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url)));
9
+
9
10
  import CppjsCompiler from './index.js';
10
11
 
11
12
  const program = new Command();
@@ -1,18 +1,12 @@
1
+ import p from 'path';
2
+
1
3
  export default function getPathInfo(path, base) {
2
4
  let basePath = base;
3
5
 
4
6
  const output = {
5
- relative: path,
7
+ relative: p.relative(base, path),
6
8
  absolute: path,
7
9
  };
8
- if (basePath) {
9
- if (basePath.at(-1) !== '/') basePath += '/';
10
10
 
11
- if (path.substring(0, basePath.length) === basePath) {
12
- output.relative = path.substring(basePath.length);
13
- } else {
14
- output.absolute = basePath + path;
15
- }
16
- }
17
11
  return output;
18
12
  }