@rocket.chat/apps-compiler
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -86,2 +86,3 @@ "use strict"; | ||
}); | ||
const modulesNotFound = []; | ||
const host = { | ||
@@ -113,3 +114,14 @@ getScriptFileNames: () => Object.keys(result.files), | ||
for (const moduleName of moduleNames) { | ||
this.resolver(moduleName, resolvedModules, containingFile, result, this.wd, moduleResHost); | ||
const index = this.resolver(moduleName, resolvedModules, containingFile, result, this.wd, moduleResHost); | ||
if (index === -1) { | ||
modulesNotFound.push({ | ||
filename: containingFile, | ||
line: 0, | ||
character: 0, | ||
lineText: '', | ||
message: `Failed to resolve module: ${moduleName}`, | ||
originalMessage: `Module not found: ${moduleName}`, | ||
originalDiagnostic: undefined, | ||
}); | ||
} | ||
} | ||
@@ -120,8 +132,18 @@ return resolvedModules; | ||
const languageService = this.ts.createLanguageService(host, this.ts.createDocumentRegistry()); | ||
const coDiag = languageService.getCompilerOptionsDiagnostics(); | ||
if (coDiag.length !== 0) { | ||
console.log(coDiag); | ||
console.error('A VERY UNEXPECTED ERROR HAPPENED THAT SHOULD NOT!'); | ||
throw new Error(`Language Service's Compiler Options Diagnostics contains ${coDiag.length} diagnostics.`); | ||
try { | ||
const coDiag = languageService.getCompilerOptionsDiagnostics(); | ||
if (coDiag.length !== 0) { | ||
console.log(coDiag); | ||
console.error('A VERY UNEXPECTED ERROR HAPPENED THAT SHOULD NOT!'); | ||
throw new Error(`Language Service's Compiler Options Diagnostics contains ${coDiag.length} diagnostics.`); | ||
} | ||
} | ||
catch (e) { | ||
if (modulesNotFound.length !== 0) { | ||
result.diagnostics = modulesNotFound; | ||
result.duration = Date.now() - startTime; | ||
return result; | ||
} | ||
throw e; | ||
} | ||
const src = languageService.getProgram().getSourceFile(appInfo.classFile); | ||
@@ -213,3 +235,3 @@ this.ts.forEachChild(src, (n) => { | ||
} | ||
console.log(`Failed to resolve module: ${moduleName}`); | ||
return -1; | ||
} | ||
@@ -216,0 +238,0 @@ getLibraryFile(fileName) { |
@@ -50,4 +50,3 @@ "use strict"; | ||
try { | ||
const { name, version, classFile } = JSON.parse(appJson.content); | ||
return { name, version, classFile }; | ||
return JSON.parse(appJson.content); | ||
} | ||
@@ -54,0 +53,0 @@ catch (error) { |
@@ -0,3 +1,3 @@ | ||
import { IAppInfo } from '@rocket.chat/apps-engine/definition/metadata'; | ||
import { ICompilerFile } from './ICompilerFile'; | ||
import { IAppInfo } from './IAppInfo'; | ||
export interface IAppSource { | ||
@@ -4,0 +4,0 @@ appInfo: IAppInfo; |
@@ -1,2 +0,1 @@ | ||
import { IAppInfo } from './IAppInfo'; | ||
import { IAppSource } from './IAppSource'; | ||
@@ -11,2 +10,2 @@ import { ICompilerDescriptor } from './ICompilerDescriptor'; | ||
import { CompilerFileNotFoundError } from './CompilerFileNotFoundError'; | ||
export { CompilerFileNotFoundError, IAppInfo, IAppSource, ICompilerDescriptor, ICompilerDiagnostic, ICompilerError, ICompilerFile, IFiles, IMapCompilerFile, ICompilerResult, }; | ||
export { CompilerFileNotFoundError, IAppSource, ICompilerDescriptor, ICompilerDiagnostic, ICompilerError, ICompilerFile, IFiles, IMapCompilerFile, ICompilerResult, }; |
{ | ||
"name": "@rocket.chat/apps-compiler", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "The Rocket.Chat apps compiler", | ||
@@ -9,9 +9,9 @@ "main": "index.js", | ||
"test:watch": "mocha --require ts-node/register --watch --watch-files src, 'tests/**/*.ts'", | ||
"build": "rm -rf dist && mkdir dist && cp package.json dist/package.json && tsc", | ||
"build:prod": "npm run build -- --sourceMap false --declarationMap false ", | ||
"build": "rm -rf dist && mkdir dist && cp package.json dist && tsc", | ||
"build:prod": "npm run build -- --sourceMap false --declarationMap false && cp LICENSE dist && cp README.md dist", | ||
"lint": "npx eslint src/**/*.ts", | ||
"dev": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' ./index.ts", | ||
"dev:debug": "nodemon --watch 'src/**/*.ts' --exec node -r ts-node/register --inspect --inspect=0.0.0.0:9229 ./index.ts", | ||
"publish": "npm run build:prod && cp LICENSE dist/LICENSE && cd dist && npm publish --access public", | ||
"pack": "npm run build:prod && cp LICENSE dist/LICENSE && cd dist && npm pack" | ||
"publish": "npm run build:prod && cd dist && npm publish --access public", | ||
"pack": "npm run build:prod && cd dist && npm pack" | ||
}, | ||
@@ -54,3 +54,3 @@ "repository": { | ||
"dependencies": { | ||
"@rocket.chat/apps-engine": "^1.18.0-alpha.3754", | ||
"@rocket.chat/apps-engine": "^1.19.0-alpha.4006", | ||
"figures": "^3.0.0", | ||
@@ -57,0 +57,0 @@ "fs-extra": "^8.1.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
44717
1011
1
8
0
39