Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
6b34308
Node-like module resolution
ark120202 Jul 27, 2020
781c286
Basic node_modules resolution support
ark120202 Sep 12, 2020
42537d6
Fix binary files git type
ark120202 Sep 12, 2020
f168977
Move resolutions tests to `transpile` directory
ark120202 Oct 2, 2020
3dd2c7e
Implement `unescapeLuaString`
ark120202 Oct 2, 2020
a5597b6
Use `enhanced-resolve` for module resolution
ark120202 Oct 2, 2020
113cd29
Add in-memory resolution testing util setup
ark120202 Oct 6, 2020
fa25e24
Remove `transpileAndExecuteProjectReturningMainExport` legacy util
ark120202 Oct 6, 2020
0695475
Make absolute/relative paths handling more consistent
ark120202 Oct 10, 2020
d494d6f
Error on resolution to script files that aren't included in the project
ark120202 Oct 10, 2020
6afdc45
Simplify concepts used in module id generation
ark120202 Oct 10, 2020
e1a3dfd
Improve terminology
ark120202 Oct 10, 2020
1ff2963
Move high-level API to managed.ts
ark120202 Oct 10, 2020
f405f67
Refactor
ark120202 Oct 14, 2020
ae52da3
Extract Transpilation class into its own file
ark120202 Oct 14, 2020
f90befb
EmitHost -> TranspilerHost
ark120202 Oct 14, 2020
53ba64e
Pass Transpilation instance as a context
ark120202 Oct 14, 2020
deefc88
Move plugin handling to Transpilation class
ark120202 Oct 14, 2020
3567987
Add transpilation-related plugin hooks
ark120202 Oct 15, 2020
68e7ffa
Treat all resolved extensions expect `.lua` as project members
ark120202 Oct 16, 2020
ceff8f2
Move sourcemap handling to chunk level
ark120202 Oct 16, 2020
2fa14b8
Refactor
ark120202 Oct 16, 2020
a23eeb2
Require `ts-node` on behalf of itself
ark120202 Oct 16, 2020
08f8b06
Fix plugin tests
ark120202 Oct 16, 2020
7e11569
Remove `resolve` dependency
ark120202 Oct 17, 2020
b83e170
Merge remote-tracking branch 'upstream/master' into node-module-resol…
ark120202 Oct 17, 2020
6d594a2
Include source snippet in resolution errors
ark120202 Oct 17, 2020
db06b6d
modules.spec.ts
ark120202 Oct 17, 2020
d2e4172
`load-config-import.spec.ts`
ark120202 Oct 17, 2020
c98a98a
Resolve lualib_bundle as a dependency
ark120202 Oct 17, 2020
640ff33
Add jest-watch-typeahead
ark120202 Oct 17, 2020
52f9fd7
`resolution.spec.ts`
ark120202 Oct 17, 2020
70a01a6
Move test fixtures into __fixtures__ directories
ark120202 Oct 17, 2020
cf6fdff
Update .eslintignore and .prettierignore
ark120202 Oct 17, 2020
d129b3c
Move `lualib_bundle` chunk back to root
ark120202 Oct 17, 2020
5bcafb9
Fix sourcemaps when lualib_bundle is used
ark120202 Oct 18, 2020
052ac1f
Fix few tests
ark120202 Oct 18, 2020
a0fd091
Merge remote-tracking branch 'upstream/master' into node-module-resol…
ark120202 Oct 18, 2020
9081fff
Refactor modules.spec.ts
ark120202 Oct 18, 2020
1252265
Move some translation tests to unit
ark120202 Oct 19, 2020
fbb9f23
Remove `baseUrl` tests
ark120202 Oct 19, 2020
260c71d
Use typescript internal api over "path" module for better windows compat
ark120202 Oct 20, 2020
f728c17
Move managed-api out of transpilation module
ark120202 Oct 20, 2020
f5cdf2c
Remove index from transformation module to signify that it's not public
ark120202 Oct 20, 2020
3783d92
Prefer to use options on context objects
ark120202 Oct 20, 2020
41dafdd
Move asset emission to Transpilation
ark120202 Oct 20, 2020
5e2bbdf
--mode lib
ark120202 Oct 20, 2020
cd9f9a6
Transpiler -> Compiler
ark120202 Oct 20, 2020
64280d5
Return main transpiled file from `transpileString` itself
ark120202 Oct 23, 2020
c042185
`transpileDiagnostics` -> `emitDiagnostics`
ark120202 Oct 23, 2020
db9b60a
Make Compilation a public API
ark120202 Oct 23, 2020
1d03830
Rename `Module.request` to `Module.fileName`
ark120202 Nov 19, 2020
9ccb503
Fix Compilation fail to find unchanged source files in watch mode
ark120202 Nov 19, 2020
18fe206
Rename plugin application functions
ark120202 Nov 19, 2020
0696901
Use snapshot for printer plugin test
ark120202 Nov 19, 2020
5d44f06
Move `executeCommandLine` to `src/cli/execute.ts`
ark120202 Nov 19, 2020
7dbb0f7
Fix resolution error diagnostic source file missing some methods
ark120202 Nov 19, 2020
2eda42a
Move chunk to files mapping to `chunkToAssets`
ark120202 Nov 19, 2020
7f6f2f0
Move out-of-project dependency error to lua resolver error handler
ark120202 Nov 19, 2020
f137738
Add JSDoc to `Module` and `Chunk` declarations
ark120202 Nov 19, 2020
bbb0c8a
Merge remote-tracking branch 'upstream/master' into node-module-resol…
ark120202 Nov 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/dist
/test/translation/transformation
/test/cli/errors
/test/cli/watch
/test/transpile/directories
/test/transpile/outFile
/test/translation/__fixtures__
/test/cli/__fixtures__
/test/transpile/__fixtures__/directories
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/dist
/coverage
/test/translation/transformation/characterEscapeSequence.ts
/test/translation/__fixtures__/characterEscapeSequence.ts
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ module.exports = {
// https://github.com/facebook/jest/issues/5274
"!<rootDir>/src/tstl.ts",
],
watchPathIgnorePatterns: ["cli/watch/[^/]+$", "src/lualib"],
watchPathIgnorePatterns: ["cli/__fixtures__", "src/lualib"],
watchPlugins: ["jest-watch-typeahead/filename", "jest-watch-typeahead/testname"],

setupFilesAfterEnv: ["<rootDir>/test/setup.ts"],
testEnvironment: "node",
Expand Down
217 changes: 207 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"node": ">=12.13.0"
},
"dependencies": {
"resolve": "^1.15.1",
"enhanced-resolve": "^5.2.0",
"source-map": "^0.7.3",
"typescript": ">=4.0.2"
},
Expand All @@ -45,7 +45,6 @@
"@types/glob": "^7.1.1",
"@types/jest": "^25.1.3",
"@types/node": "^13.7.7",
"@types/resolve": "1.14.0",
"@typescript-eslint/eslint-plugin": "^2.31.0",
"@typescript-eslint/parser": "^4.1.0",
"eslint": "^6.8.0",
Expand All @@ -56,9 +55,19 @@
"javascript-stringify": "^2.0.1",
"jest": "^26.0.1",
"jest-circus": "^25.1.0",
"jest-watch-typeahead": "^0.6.1",
"lua-types": "^2.8.0",
"memfs": "^3.2.0",
"prettier": "^2.0.5",
"ts-jest": "^26.3.0",
"ts-node": "^8.6.2"
},
"peerDependencies": {
"ts-node": "*"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this as peer dependency? isn't the regular dev dependency enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an optional peer dependency. It is required for Yarn 2, since it doesn't allow importing unreferenced packages

},
"peerDependenciesMeta": {
"ts-node": {
"optional": true
}
}
}
12 changes: 10 additions & 2 deletions src/CompilerOptions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as ts from "typescript";
import * as diagnosticFactories from "./transpilation/diagnostics";
import * as diagnosticFactories from "./compiler/diagnostics";

type KnownKeys<T> = { [K in keyof T]: string extends K ? never : number extends K ? never : K } extends {
[K in keyof T]: infer U;
Expand All @@ -25,6 +25,7 @@ export interface LuaPluginImport {
}

export type CompilerOptions = OmitIndexSignature<ts.CompilerOptions> & {
mode?: CompilerMode;
noImplicitSelf?: boolean;
noHeader?: boolean;
luaBundle?: string;
Expand All @@ -37,6 +38,11 @@ export type CompilerOptions = OmitIndexSignature<ts.CompilerOptions> & {
[option: string]: any;
};

export enum CompilerMode {
App = "app",
Lib = "lib",
}

export enum LuaLibImportKind {
None = "none",
Always = "always",
Expand All @@ -52,7 +58,9 @@ export enum LuaTarget {
LuaJIT = "JIT",
}

export const isBundleEnabled = (options: CompilerOptions) =>
export const isBundleEnabled = (
options: CompilerOptions
): options is CompilerOptions & Required<Pick<CompilerOptions, "luaBundle" | "luaBundleEntry">> =>
options.luaBundle !== undefined && options.luaBundleEntry !== undefined;

export function validateOptions(options: CompilerOptions): ts.Diagnostic[] {
Expand Down
Loading