Skip to content
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

Initial Spec #9

Merged
merged 17 commits into from
May 13, 2024
16 changes: 10 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
name: Build spec
name: Deploy spec

on: [pull_request, push]
on: [push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: ljharb/actions/node/install@main
name: 'nvm install lts/* && npm install'
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: lts/*
node-version: '12.x'
- run: npm install
- run: npm run build
- name: commit changes
uses: elstudio/actions-js-build/commit@v3
with:
commitMessage: "fixup: [spec] `npm run build`"
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,3 @@ yarn.lock
package-lock.json
npm-shrinkwrap.json
pnpm-lock.yaml

# Build directory
build
30 changes: 8 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,42 +123,28 @@ These helper methods are designed to allow for determining the static public exp
imports of a module, but do not give information about the internal module identifiers or dynamic
import.

### `ModuleSource.prototype.imports()`
### `AbstractModuleSource.prototype.imports()`

Returns the ordered list of the dependencies `Import[]`, defined by:
Returns a list of the imports of the module of the form `Import[]` defined by:

```ts
interface Import {
specifier: string,
attributes: null | {
[key: string]: string
},
phase: null | 'source'
}
```

Note that all `export` statements with a `from` clause are reflected as imports as well as
being reflected on exports.
### `AbstractModuleSource.prototype.hasDynamicImport`

### `ModuleSource.prototype.exports()`
A boolean getter property indicating if the module may call dynamic import.

Returns the list of public exports `(Export | StarReexport)[]`, defined by:
### `AbstractModuleSource.prototype.hasImportMeta`

```ts
interface Export {
type: 'export',
name: string,
}
A boolean getter property indicating if the module accesses the module `import.meta`.

interface StarReexport {
type: 'star-reexport',
from: Import
}
```
### `AbstractModuleSource.prototype.hasTopLevelAwait`

`Export` is provided for both re-exports and local exports. For example,
`export * as X from './x.js'` would be reflected as the export `{ type: 'export', name: 'x' }`,
and then also appear in the `Import` dependency list separately.
A boolean getter property indicating if the module contains use of top-level await.

### Dynamic Import

Expand Down
Loading
Loading