-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
error: Uncaught AssertionError: Unexpected skip of the emit. #6082
Comments
Here's a more isolated example. I took a module I wrote about a month ago that performs base64 encoding, removed any external modules from it (was only using the path module prior), and then tried to import it and run it, and it throw the above error:
/**
* Encodes a Uint8Array into a base64 string
*
* @private
*
* @param {any} uint8arr a Uint8Array
* @returns {string} a base64 encoded string
*/
function _encodeU8intToBase64String(uint8arr: any) : string {
const CHUNK_SIZE = 0x8000;
const charArray: string[] = [];
for (let i = 0; i < uint8arr.length; i += CHUNK_SIZE) {
charArray.push(String.fromCharCode.apply(null, uint8arr.subarray(i, i + CHUNK_SIZE)));
}
return btoa(charArray.join(""));
}
/**
* Converts a string to a Uint8Array
*
* @private
*
* @param {string} str a string
* @returns {Uint8Array} a Uint8Array from the string
*/
function _convertStringToUint8(str: string) : Uint8Array {
return new Uint8Array(new TextEncoder().encode(str))
}
/**
* Decodes a UInt8Array that contains base64 data into a base64 decoded string
*
* @private
*
* @param {Uint8Array} bytes a Uint8Array that contains base64 encoded data
* @returns {string} an base64 unencoded string
*/
function _decodeBase64Bytes(bytes: Uint8Array) : string {
return new TextDecoder().decode(Uint8Array.from(atob(new TextDecoder().decode(bytes)), c => c.charCodeAt(0)))
}
/**
* Decodes a Uint8Array that contains base64 data into a base64 decoded Uint8Array
*
* @private
*
* @param {Uint8Array} bytes a Uint8Array that contains base64 encoded data
* @returns {Uint8Array} an base64 unencoded Uint8Array
*/
function _decodeBase64BytesToUint8(bytes: Uint8Array) : Uint8Array {
return Uint8Array.from(atob(new TextDecoder().decode(bytes)), c => c.charCodeAt(0));
}
/**
* This class provides an easy interface to perform base64 encoding on strings
* and files.
*/
export class Base64 {
private bytes: Uint8Array;
private mime: string;
private isBase64Encoded: boolean;
public constructor(data: any) {
this.bytes = data.bytes;
this.mime = data.mime;
this.isBase64Encoded = data.isBase64Encoded;
}
/**
* Creates a Base64 object from a string
*
* @public
* @static
*
* @param {string} unencodedString a string that will be base64 encoded
* @returns {Base64} a Base64 object
*/
public static fromString(unencodedString: string) : Base64 {
return new Base64({
bytes: _convertStringToUint8(unencodedString),
mime: null,
isBase64Encoded: false,
});
}
/**
* Creates a Base64 object from an already base64 encoded string
*
* @public
* @static
*
* @param {string} encodedString a string that is already base64 encoded
* @returns {Base64} a Base64 object
*/
public static fromBase64String(encodedString: string) : Base64 {
return new Base64({
bytes: _convertStringToUint8(encodedString),
mime: null,
isBase64Encoded: true,
});
}
/**
* Creates a Base64 object from a Uint8Array
*
* @public
* @static
*
* @param {Uint8Array} uint8arr a Uint8Array that will be base64 encoded
* @returns {Base64} a Base64 object
*/
public static fromUint8Array(uint8arr: Uint8Array) : Base64 {
return new Base64({
bytes: uint8arr,
mime: null,
isBase64Encoded: false,
});
}
/**
* Creates a Base64 object from a base64 encoded Uint8Array
*
* @public
* @static
*
* @param {Uint8Array} uint8arr a Uint8Array that contains base64 encoded data
* @returns {Base64} a Base64 object
*/
public static fromBase64Uint8Array(uint8arr: Uint8Array) : Base64 {
return new Base64({
bytes: uint8arr,
mime: null,
isBase64Encoded: true,
});
}
/**
* Returns the base64 encoded string from the Base64 object
*
* @public
*
* @returns {Base64} a base64 encoded string
*/
public toString() : string {
if (this.isBase64Encoded) {
return _decodeBase64Bytes(this.bytes);
} else {
return _encodeU8intToBase64String(this.bytes);
}
}
/**
* Returns the base64 encoded string from the Base64 object, with the
* inclusion of the MIME type if the Base64 object was created from a file
* (and if not created from a file, works the same as the .toString() method)
*
* @public
*
* @returns {string} a base64 encoded string with MIME type included when from a file
*/
public toStringWithMime() : string {
if (this.mime) {
if (this.isBase64Encoded) {
return _decodeBase64Bytes(this.bytes);
} else {
return this.mime + _encodeU8intToBase64String(this.bytes);
}
} else {
if (this.isBase64Encoded) {
return _decodeBase64Bytes(this.bytes);
} else {
return _encodeU8intToBase64String(this.bytes);
}
}
}
}
import { Base64 } from "./mod.ts";
console.log(Base64.fromString("hello world").toString()); |
I reproduced this here: #5982 (comment). I put it in that issue because it seems connected. |
I can reproduce on windows
|
Getting the same on mac:
|
This is the minimum error code. (save as "test.js", and "deno run test.js")
test_mod.ts is the just bellow
import ts from js -- NG 1.0.3 -- OK |
Update: I'm looking into this issue and found root cause. Fix will be released in Deno 1.1 in a few days. |
Im also geting this error on windows Compile file:///D:/Deno/diplodocus/app.js
error: Uncaught AssertionError: Unexpected skip of the emit.
at Object.assert ($deno$/util.ts:33:11)
at compile ($deno$/compiler.ts:1170:7)
at tsCompilerOnMessage ($deno$/compiler.ts:1338:22)
at workerMessageRecvCallback ($deno$/runtime_worker.ts:72:33)
at file:///D:/Deno/diplodocus/__anonymous__:1:1 |
error: Uncaught AssertionError: Unexpected skip of the emit. Facing same issue for "https://deno.land/x/abc@v1.0.0-rc10/mod.ts" |
same in mac $ deno run deno2.js |
Windows using Deno 1.0.5 import "https://deno.land/std/examples/welcome.ts" $ deno run --allow-net deno2.js output: |
It's happening to me when I import ts file into file with js extension.
Renaming to .ts helped me |
1.1 update fixed it for me! Thanks, Bartek! |
deno-lambda too! 👍 |
Got the emit error too but upgrading to Deno 1.1.1 fixed it. Compile file:///Users/frankukachukwu/oss/dso/deps.ts |
Receiving this error when importing a file. It looks like the issue is isolated to Linux
Code to reproduce this error on Linux:
Will look into it further and see if I can isolate the bug a bit.
The text was updated successfully, but these errors were encountered: