Skip to content

Commit 8e8984b

Browse files
committed
fix: module resolution error
1 parent 6c7da75 commit 8e8984b

File tree

6 files changed

+26
-28
lines changed

6 files changed

+26
-28
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
"type": "module",
77
"scripts": {
88
"clean": "rimraf dist",
9-
"build": "npm run clean && npm run make-dist && npm run transpile",
9+
"build": "npm run clean && npm run clean-proto && npm run proto && npm run transpileProto && npm run make-dist && npm run transpile",
1010
"make-dist": "mkdirp dist",
11-
"clean-proto": "rimraf src/generated && mkdirp src/generated",
12-
"proto": "pbjs --target static-module -w es6 --path substrait-spec/proto -o src/generated/definitions.js substrait/plan.proto",
11+
"clean-proto": "rimraf src/generated && mkdirp src/generated && mkdirp dist/generated",
12+
"proto": "pbjs -w scripts/wrapper.js --target static-module --path substrait-spec/proto -o dist/generated/definitions.js substrait/plan.proto",
1313
"transpile": "tsc",
14-
"transpileProto": "pbts -o src/generated/definitions.d.ts src/generated/definitions.js",
14+
"transpileProto": "pbts -o src/generated/definitions.d.ts dist/generated/definitions.js",
1515
"prepare": "npm run clean-proto && npm run proto && npm run transpileProto",
1616
"lint": "eslint '**/*.ts'",
1717
"test": "echo \"Error: no test specified\" && exit 1"

scripts/wrapper.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};

scripts/wrapper.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import $protobuf from "protobufjs/minimal.js";
2+
3+
$OUTPUT;
4+
5+
const substrait = $root.substrait;
6+
export { substrait as substrait };

src/graph.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use strict";
22

33
import * as d3 from "d3";
4-
import icons from "./assets/icons.json";
4+
import icons from "./assets/icons.json" assert { type: "json" };
55
import { PrintNode } from "./parser"
66

77
interface Node extends d3.SimulationNodeDatum {

src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
export * from "./parser";
2-
export * as proto from "./generated/definitions";
32
export * from "./cli"
43
export * from "./graph"

tsconfig.json

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
{
22
"compilerOptions": {
33
/* Visit https://aka.ms/tsconfig to read more about this file */
4-
54
/* Projects */
65
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
76
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
87
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
98
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
109
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
1110
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12-
1311
/* Language and Environment */
14-
"target": "ES6", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
12+
"target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
1513
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
1614
// "jsx": "preserve", /* Specify what JSX code is generated. */
1715
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
@@ -23,11 +21,10 @@
2321
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
2422
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
2523
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26-
2724
/* Modules */
28-
"module": "ES6", /* Specify what module code is generated. */
29-
"rootDir": "./src", /* Specify the root folder within your source files. */
30-
"moduleResolution": "Node", /* Specify how TypeScript looks up a file from a given module specifier. */
25+
"module": "ESNext", /* Specify what module code is generated. */
26+
"rootDir": "./src", /* Specify the root folder within your source files. */
27+
"moduleResolution": "Node", /* Specify how TypeScript looks up a file from a given module specifier. */
3128
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
3229
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
3330
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
@@ -39,23 +36,21 @@
3936
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
4037
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
4138
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
42-
"resolveJsonModule": true, /* Enable importing .json files. */
39+
"resolveJsonModule": true, /* Enable importing .json files. */
4340
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
4441
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
45-
4642
/* JavaScript Support */
47-
"allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
48-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
43+
"allowJs": false, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
44+
"checkJs": false, /* Enable error reporting in type-checked JavaScript files. */
4945
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
50-
5146
/* Emit */
52-
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
47+
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
5348
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
5449
// // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
5550
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
5651
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
5752
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
58-
"outDir": "./dist", /* Specify an output folder for all emitted files. */
53+
"outDir": "./dist", /* Specify an output folder for all emitted files. */
5954
// "removeComments": true, /* Disable emitting comments. */
6055
// "noEmit": true, /* Disable emitting files from a compilation. */
6156
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
@@ -72,18 +67,16 @@
7267
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
7368
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
7469
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
75-
7670
/* Interop Constraints */
7771
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
7872
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
7973
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
80-
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
74+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
8175
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
82-
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
83-
76+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
8477
/* Type Checking */
85-
"strict": true, /* Enable all strict type-checking options. */
86-
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
78+
"strict": true, /* Enable all strict type-checking options. */
79+
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
8780
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
8881
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
8982
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
@@ -101,9 +94,8 @@
10194
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
10295
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
10396
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
104-
10597
/* Completeness */
10698
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
107-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
99+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
108100
}
109101
}

0 commit comments

Comments
 (0)