-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(compiler): migrate referential integrity into lwc-compiler #109
Merged
Merged
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0a88b3f
feat(packages): enable typescript
apapko 732aec0
feat(jest): run tests for both js and ts
apapko 4d439ce
feat(jest): run tests for both js and ts
apapko e9fc521
compiler-references
apapko 1518d2e
Merge branch 'master' into apapko/compiler-references
apapko 1d2e404
wip: remove unused import and stale comment
apapko b037274
wip: review comments
apapko 20bc151
Merge branch 'master' into apapko/compiler-references
apapko 65aee92
wip: change module imports and jest transform format
apapko b02ac32
wip: review comment - removed unused package
apapko 5373a3d
wip: correction to rollup-replace import
apapko 63382ee
wip: merge conflict w master
apapko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
/* eslint-env node */ | ||
|
||
module.exports = { | ||
testMatch: [ | ||
'**/?(*.)(spec|test).js' | ||
] | ||
} | ||
testRegex: "\\.spec\\.(js|ts)$", | ||
transform: { | ||
"^.+\\.(js|ts)$": "ts-jest" | ||
}, | ||
moduleFileExtensions: ["ts", "js", "json", "node"], | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
"license": "ISC", | ||
"scripts": { | ||
"clean": "rimraf dist/", | ||
"build": "babel src/ --out-dir dist/commonjs", | ||
"build": "tsc", | ||
"build:umd": "webpack --progress", | ||
"test": "jest --coverage --maxWorkers=2" | ||
}, | ||
|
@@ -17,6 +17,9 @@ | |
"power-assert": "^1.4.2", | ||
"rimraf": "^2.6.1", | ||
"string-replace-webpack-plugin": "0.1.3", | ||
"ts-jest": "^21.2.4", | ||
"tslint": "^5.2.0", | ||
"typescript": "^2.7.1", | ||
"webpack": "^3.7.1", | ||
"webpack-closure-compiler": "2.1.5" | ||
}, | ||
|
@@ -55,10 +58,14 @@ | |
"babel-plugin-transform-runtime": "^6.23.0", | ||
"babel-preset-env": "^1.6.0", | ||
"babel-preset-minify": "~0.2.0", | ||
"babel-traverse": "^6.26.0", | ||
"babylon": "^6.18.0", | ||
"cssnano": "^3.10.0", | ||
"lwc-template-compiler": "0.17.15", | ||
"parse5": "^3.0.3", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you make sure the versions of the packages align with the other packages? |
||
"postcss": "^6.0.13", | ||
"postcss-plugin-lwc": "0.17.15", | ||
"postcss-selector-parser": "^3.1.1", | ||
"rollup": "0.50.0", | ||
"rollup-plugin-babel": "^3.0.2", | ||
"rollup-plugin-replace": "^2.0.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/lwc-compiler/src/diagnostics/diagnostic-collector.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Diagnostic, DiagnosticLevel } from './diagnostic'; | ||
|
||
export class DiagnosticCollector { | ||
private diagnostics: Diagnostic[] = []; | ||
|
||
constructor(diagnostics?: Diagnostic[]) { | ||
if (diagnostics) { | ||
this.addAll(diagnostics); | ||
} | ||
} | ||
public getAll() { | ||
return this.diagnostics; | ||
} | ||
|
||
public addAll(items: Diagnostic[]) { | ||
if (!Array.isArray(items)) { | ||
return; | ||
} | ||
for (const item of items) { | ||
this.add(item); | ||
} | ||
} | ||
|
||
public add(item: Diagnostic) { | ||
this.diagnostics.push(item); | ||
} | ||
|
||
public hasError() { | ||
return this.diagnostics.some(d => { | ||
return d.level <= DiagnosticLevel.Error; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
export interface Diagnostic { | ||
/** Level of the diagnostic */ | ||
level: DiagnosticLevel; | ||
|
||
/** Relative path location of the file in the bundle. */ | ||
filename: string; | ||
|
||
/** Error messages that should be outputed */ | ||
message: string; | ||
|
||
/** | ||
* Location in the code affected by the diagnostic. | ||
* This field is optional, for example when the compiler throws an uncaught exception. | ||
*/ | ||
location?: Location; | ||
} | ||
|
||
export enum DiagnosticLevel { | ||
/** Unexpected error, parsing error, bundling error */ | ||
Fatal = 0, | ||
/** Linting error with error level, invalid external reference, invalid import, invalid transform */ | ||
Error = 1, | ||
/** Linting error with warning level, usage of an API to be deprecated */ | ||
Warning = 2, | ||
/** Logging messages */ | ||
Log = 3, | ||
} | ||
|
||
export interface Location { | ||
/** 0-base character index in the file */ | ||
start: number; | ||
|
||
/** Number of character after the start index */ | ||
length: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface LwcBundle { | ||
entry: string; | ||
sources: [{ filename: string }]; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will probably need to keep the
build:umd
for now until we update the delivery mechanism of the compiler into Aura.