Skip to content

Trouble with "export async function"? #136

Description

@lll000111

Output

I'll just show errors for one file. There are several. but the location always is an export async function line.

mha@mint-virtual-machine ~/Projects/one.moddable/DEVICE $ mcconfig -d -m -p lin
# xsc module-importer.xsb
# xsc instance.xsb
.../one.core/lib/module-importer.js:34: error: invalid export identifier!
.../one.core/lib/module-importer.js:42: error: missing ;!
.../one.core/lib/module-importer.js:62: error: missing ;!
### 3 error(s)
# xsc microdata-to-id-hash.xsb
/home/mha/Projects/moddable/build/tmp/lin/debug/mc/DEVICE/makefile:315: recipe for target '/home/mha/Projects/moddable/build/tmp/lin/debug/mc/DEVICE/modules/module-importer.xsb' failed
make: *** [/home/mha/Projects/moddable/build/tmp/lin/debug/mc/DEVICE/modules/module-importer.xsb] Error 22
make: *** Waiting for unfinished jobs....
...

Code

In module-importer, starting from line 34:

...
// NEXT LINE: #34
export async function createObjects(WriteStorage, {
  moduleName,
  version = '1.0',
  code
}) {
  let clobResult;

  try {
    clobResult = await WriteStorage.storeUTF8Clob(code);
  } catch (err) {
    err.stack += new Error().stack;
    throw err;
  }

  if (clobResult.status === CREATION_STATUS.EXISTS) {
    MessageBus.send('log', `Code CLOB ${clobResult.hash} already exists`);
  }

  const module = {
    type: 'Module',
    name: '@module/' + moduleName.replace(/\.js$/, ''),
    provides: [],
    requires: extractRequires(code),
    version,
    code: clobResult.hash
  };

  try {
    return await WriteStorage.storeVersionedObject(module);
  } catch (err) {
    err.stack += new Error().stack;
    throw err;
  }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions