Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
stepankuzmin committed Aug 8, 2024
1 parent 45e4028 commit dd479fe
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions compile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import {readFileSync} from 'fs';
import {fileURLToPath} from 'url';

const version = JSON.parse(readFileSync(new URL('package.json', import.meta.url))).version;

Expand All @@ -12,7 +12,7 @@ export function compileRaw(proto, options = {}) {

let output = options.dev ? '' : `// code generated by pbf v${version}\n`;
if (options.jsDoc) {
output += typeDef(`import("${options.dev ? fileURLToPath(new URL('index.js', import.meta.url)) : 'pbf'}").default`, 'Pbf');
output += typeDef(`import("${options.dev ? '../../index.js' : 'pbf'}").default`, 'Pbf');
}
output += writeContext(context, options);
return output;
Expand Down
2 changes: 1 addition & 1 deletion test/compile.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test('compiles all proto files to proper js', () => {
const js = compileRaw(proto, {dev: true, jsDoc: true});

// uncomment to update the fixtures
// fs.writeFileSync(new URL(`fixtures/${path}`.replace('.proto', '.js'), import.meta.url), js);
fs.writeFileSync(new URL(`fixtures/${path}`.replace('.proto', '.js'), import.meta.url), js);

const expectedJS = fs.readFileSync(new URL(`fixtures/${path}`.replace('.proto', '.js'), import.meta.url), 'utf8');
assert.equal(js, expectedJS);
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/defaults.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import("/Users/stepan/Code/pbf/index.js").default} Pbf
* @typedef {import("../../index.js").default} Pbf
*/

/** @enum {number} */
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/defaults_implicit.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import("/Users/stepan/Code/pbf/index.js").default} Pbf
* @typedef {import("../../index.js").default} Pbf
*/

/** @enum {number} */
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/defaults_proto3.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import("/Users/stepan/Code/pbf/index.js").default} Pbf
* @typedef {import("../../index.js").default} Pbf
*/

/** @enum {number} */
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/embedded_type.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import("/Users/stepan/Code/pbf/index.js").default} Pbf
* @typedef {import("../../index.js").default} Pbf
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/map.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import("/Users/stepan/Code/pbf/index.js").default} Pbf
* @typedef {import("../../index.js").default} Pbf
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/oneof.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import("/Users/stepan/Code/pbf/index.js").default} Pbf
* @typedef {import("../../index.js").default} Pbf
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/packed.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import("/Users/stepan/Code/pbf/index.js").default} Pbf
* @typedef {import("../../index.js").default} Pbf
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/packed_proto3.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import("/Users/stepan/Code/pbf/index.js").default} Pbf
* @typedef {import("../../index.js").default} Pbf
*/

/** @enum {number} */
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/type_string.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import("/Users/stepan/Code/pbf/index.js").default} Pbf
* @typedef {import("../../index.js").default} Pbf
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/varint.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import("/Users/stepan/Code/pbf/index.js").default} Pbf
* @typedef {import("../../index.js").default} Pbf
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/vector_tile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import("/Users/stepan/Code/pbf/index.js").default} Pbf
* @typedef {import("../../index.js").default} Pbf
*/

/**
Expand Down

0 comments on commit dd479fe

Please sign in to comment.