Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cadl-lang/html-program-viewer",
"comment": "",
"type": "none"
}
],
"packageName": "@cadl-lang/html-program-viewer"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cadl-lang/library-linter",
"comment": "",
"type": "none"
}
],
"packageName": "@cadl-lang/library-linter"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cadl-lang/lint",
"comment": "",
"type": "none"
}
],
"packageName": "@cadl-lang/lint"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cadl-lang/migrate",
"comment": "",
"type": "none"
}
],
"packageName": "@cadl-lang/migrate"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cadl-lang/openapi",
"comment": "",
"type": "none"
}
],
"packageName": "@cadl-lang/openapi"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cadl-lang/openapi3",
"comment": "",
"type": "none"
}
],
"packageName": "@cadl-lang/openapi3"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cadl-lang/prettier-plugin-cadl",
"comment": "",
"type": "none"
}
],
"packageName": "@cadl-lang/prettier-plugin-cadl"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cadl-lang/rest",
"comment": "",
"type": "none"
}
],
"packageName": "@cadl-lang/rest"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cadl-lang/versioning",
"comment": "",
"type": "none"
}
],
"packageName": "@cadl-lang/versioning"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "cadl-vscode",
"comment": "",
"type": "none"
}
],
"packageName": "cadl-vscode"
}
2 changes: 1 addition & 1 deletion packages/bundler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"!dist/test/**"
],
"dependencies": {
"@cadl-lang/compiler": "~0.38.4",
"@cadl-lang/compiler": "~0.38.5",
"@rollup/plugin-virtual": "~3.0.1",
"@rollup/plugin-commonjs": "~23.0.2",
"@rollup/plugin-json": "~5.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/cadl-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"@types/mocha": "~10.0.0",
"@types/node": "~18.11.9",
"@types/vscode": "~1.53.0",
"@cadl-lang/compiler": "~0.38.4",
"@cadl-lang/compiler": "~0.38.5",
"@cadl-lang/eslint-config-cadl": "~0.5.0",
"@cadl-lang/internal-build-utils": "~0.3.2",
"eslint": "^8.12.0",
Expand Down
12 changes: 12 additions & 0 deletions packages/compiler/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{
"name": "@cadl-lang/compiler",
"entries": [
{
"version": "0.38.5",
"tag": "@cadl-lang/compiler_v0.38.5",
"date": "Fri, 16 Dec 2022 22:02:45 GMT",
"comments": {
"patch": [
{
"comment": "emitter not found validation in emitter options is a warning"
}
]
}
},
{
"version": "0.38.4",
"tag": "@cadl-lang/compiler_v0.38.4",
Expand Down
9 changes: 8 additions & 1 deletion packages/compiler/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Change Log - @cadl-lang/compiler

This log was last generated on Thu, 15 Dec 2022 02:21:08 GMT and should not be manually modified.
This log was last generated on Fri, 16 Dec 2022 22:02:45 GMT and should not be manually modified.

## 0.38.5
Fri, 16 Dec 2022 22:02:45 GMT

### Patches

- emitter not found validation in emitter options is a warning

## 0.38.4
Thu, 15 Dec 2022 02:21:08 GMT
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/core/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ const diagnostics = {
},
},
"emitter-not-found": {
severity: "error",
severity: "warning",
messages: {
default: paramMessage`Emitter with name ${"emitterName"} is not found.`,
},
Expand Down
59 changes: 35 additions & 24 deletions packages/compiler/core/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ export async function compile(
// This is the emitter names under options that haven't been used. We need to check if it points to an emitter that wasn't loaded
for (const emitterName of emitterThatShouldExists) {
// attempt to resolve a node module with this name
const module = await resolveEmitterModuleAndEntrypoint(mainFile, emitterName);
const [module, _] = await resolveEmitterModuleAndEntrypoint(mainFile, emitterName);
if (module?.entrypoint === undefined) {
program.reportDiagnostic(
createDiagnostic({
Expand All @@ -640,29 +640,36 @@ export async function compile(
mainFile: string,
emitterNameOrPath: string
): Promise<
{ module: ModuleResolutionResult; entrypoint: JsSourceFileNode | undefined } | undefined
[
{ module: ModuleResolutionResult; entrypoint: JsSourceFileNode | undefined } | undefined,
readonly Diagnostic[]
]
> {
const basedir = getDirectoryPath(mainFile);

// attempt to resolve a node module with this name
const module = await resolveJSLibrary(emitterNameOrPath, basedir);
const [module, diagnostics] = await resolveJSLibrary(emitterNameOrPath, basedir);
if (!module) {
return undefined;
return [undefined, diagnostics];
}

const entrypoint = module.type === "file" ? module.path : module.mainFile;
const file = await loadJsFile(entrypoint, NoTarget);

return { module, entrypoint: file };
return [{ module, entrypoint: file }, []];
}
async function loadEmitter(
mainFile: string,
emitterNameOrPath: string,
emittersOptions: Record<string, EmitterOptions>
): Promise<EmitterRef | undefined> {
const resolution = await resolveEmitterModuleAndEntrypoint(mainFile, emitterNameOrPath);
const [resolution, diagnostics] = await resolveEmitterModuleAndEntrypoint(
mainFile,
emitterNameOrPath
);

if (resolution === undefined) {
program.reportDiagnostics(diagnostics);
return undefined;
}
const { module, entrypoint } = resolution;
Expand Down Expand Up @@ -818,28 +825,32 @@ export async function compile(
async function resolveJSLibrary(
specifier: string,
baseDir: string
): Promise<ModuleResolutionResult | undefined> {
): Promise<[ModuleResolutionResult | undefined, readonly Diagnostic[]]> {
try {
return await resolveModule(getResolveModuleHost(), specifier, { baseDir });
return [await resolveModule(getResolveModuleHost(), specifier, { baseDir }), []];
} catch (e: any) {
if (e.code === "MODULE_NOT_FOUND") {
program.reportDiagnostic(
createDiagnostic({
code: "import-not-found",
format: { path: specifier },
target: NoTarget,
})
);
return undefined;
return [
undefined,
[
createDiagnostic({
code: "import-not-found",
format: { path: specifier },
target: NoTarget,
}),
],
];
} else if (e.code === "INVALID_MAIN") {
program.reportDiagnostic(
createDiagnostic({
code: "library-invalid",
format: { path: specifier },
target: NoTarget,
})
);
return undefined;
return [
undefined,
[
createDiagnostic({
code: "library-invalid",
format: { path: specifier },
target: NoTarget,
}),
],
];
} else {
throw e;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cadl-lang/compiler",
"version": "0.38.4",
"version": "0.38.5",
"description": "Cadl Compiler Preview",
"author": "Microsoft Corporation",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions packages/html-program-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"!dist/test/**"
],
"peerDependencies": {
"@cadl-lang/compiler": "~0.38.4"
"@cadl-lang/compiler": "~0.38.5"
},
"dependencies": {
"prettier": "~2.7.1",
Expand All @@ -66,7 +66,7 @@
"@types/prettier": "2.6.0",
"@types/react": "~18.0.5",
"@types/react-dom": "~18.0.1",
"@cadl-lang/compiler": "~0.38.4",
"@cadl-lang/compiler": "~0.38.5",
"@cadl-lang/eslint-config-cadl": "~0.5.0",
"@babel/core": "^7.0.0",
"eslint": "^8.12.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/library-linter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
"!dist/test/**"
],
"peerDependencies": {
"@cadl-lang/compiler": "~0.38.4"
"@cadl-lang/compiler": "~0.38.5"
},
"devDependencies": {
"@types/mocha": "~10.0.0",
"@types/node": "~18.11.9",
"@cadl-lang/compiler": "~0.38.4",
"@cadl-lang/compiler": "~0.38.5",
"@cadl-lang/eslint-config-cadl": "~0.5.0",
"eslint": "^8.12.0",
"mocha": "~10.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/lint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@
"!dist/test/**"
],
"peerDependencies": {
"@cadl-lang/compiler": "~0.38.4"
"@cadl-lang/compiler": "~0.38.5"
},
"devDependencies": {
"@types/mocha": "~10.0.0",
"@types/node": "~18.11.9",
"@cadl-lang/compiler": "~0.38.4",
"@cadl-lang/compiler": "~0.38.5",
"@cadl-lang/eslint-config-cadl": "~0.5.0",
"@cadl-lang/eslint-plugin": "~0.38.0",
"eslint": "^8.12.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/migrate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
],
"dependencies": {
"globby": "~13.1.1",
"@cadl-lang/compiler": "~0.38.4",
"@cadl-lang/compiler": "~0.38.5",
"@cadl-lang/compiler-v0.37": "npm:@cadl-lang/compiler@0.37.0"
},
"devDependencies": {
"@types/mocha": "~10.0.0",
"@types/node": "~18.11.9",
"@cadl-lang/compiler": "~0.38.4",
"@cadl-lang/compiler": "~0.38.5",
"@cadl-lang/eslint-config-cadl": "~0.5.0",
"@cadl-lang/eslint-plugin": "~0.38.0",
"eslint": "^8.12.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@
"!dist/test/**"
],
"peerDependencies": {
"@cadl-lang/compiler": "~0.38.4",
"@cadl-lang/compiler": "~0.38.5",
"@cadl-lang/rest": "~0.38.1"
},
"devDependencies": {
"@types/mocha": "~10.0.0",
"@types/node": "~18.11.9",
"@cadl-lang/compiler": "~0.38.4",
"@cadl-lang/compiler": "~0.38.5",
"@cadl-lang/rest": "~0.38.1",
"@cadl-lang/eslint-config-cadl": "~0.5.0",
"@cadl-lang/library-linter": "~0.38.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/openapi3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@
],
"peerDependencies": {
"@cadl-lang/versioning": "~0.38.0",
"@cadl-lang/compiler": "~0.38.4",
"@cadl-lang/compiler": "~0.38.5",
"@cadl-lang/rest": "~0.38.1",
"@cadl-lang/openapi": "~0.38.0"
},
"devDependencies": {
"@types/mocha": "~10.0.0",
"@types/node": "~18.11.9",
"@cadl-lang/compiler": "~0.38.4",
"@cadl-lang/compiler": "~0.38.5",
"@cadl-lang/rest": "~0.38.1",
"@cadl-lang/openapi": "~0.38.0",
"@cadl-lang/versioning": "~0.38.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
],
"dependencies": {
"@cadl-lang/versioning": "~0.38.0",
"@cadl-lang/compiler": "~0.38.4",
"@cadl-lang/compiler": "~0.38.5",
"@cadl-lang/rest": "~0.38.1",
"@cadl-lang/openapi3": "~0.38.0",
"@cadl-lang/openapi": "~0.38.0",
Expand Down
Loading