Skip to content

Commit

Permalink
Change to use exports
Browse files Browse the repository at this point in the history
Closes GH-217.

Co-authored-by: Remco Haszing <remcohaszing@gmail.com>
  • Loading branch information
wooorm and remcohaszing committed Aug 9, 2023
1 parent 620ccf9 commit 932c140
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 21 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
],
"sideEffects": false,
"type": "module",
"main": "index.js",
"types": "index.d.ts",
"exports": "./index.js",
"files": [
"lib/",
"index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions test/async-function.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import {VFile} from 'vfile'
import {unified} from '../index.js'
import {unified} from 'unified'

test('async function transformer () {}', () => {
const givenFile = new VFile('alpha')
Expand All @@ -16,7 +16,7 @@ test('async function transformer () {}', () => {
.use(() => async function () {})
.use(
// Note: TS JS doesn’t understand the `Promise<undefined>` w/o explicit type.
/** @type {import('../index.js').Plugin<[]>} */
/** @type {import('unified').Plugin<[]>} */
() =>
async function () {
return undefined
Expand Down
2 changes: 1 addition & 1 deletion test/core.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import {unified} from '../index.js'
import {unified} from 'unified'

test('unified()', () => {
/** @type {number} */
Expand Down
2 changes: 1 addition & 1 deletion test/data.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import {unified} from '../index.js'
import {unified} from 'unified'

test('data(key[, value])', () => {
const processor = unified()
Expand Down
6 changes: 3 additions & 3 deletions test/freeze.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* @typedef {import('../index.js').Plugin} Plugin
* @typedef {import('unified').Plugin} Plugin
*/

import assert from 'node:assert/strict'
import test from 'node:test'
import {unified} from '../index.js'
import {unified} from 'unified'
import {SimpleCompiler, SimpleParser} from './util/simple.js'

test('freeze()', async (t) => {
Expand Down Expand Up @@ -78,7 +78,7 @@ test('freeze()', async (t) => {
processor().freeze()

/**
* @this {import('../index.js').Processor}
* @this {import('unified').Processor}
* @type {Plugin}
*/
function freezingPlugin() {
Expand Down
2 changes: 1 addition & 1 deletion test/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import assert from 'node:assert/strict'
import test from 'node:test'
import {unified} from '../index.js'
import {unified} from 'unified'

test('parse(file)', () => {
const processor = unified()
Expand Down
6 changes: 3 additions & 3 deletions test/process.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* @typedef {import('unist').Literal} Literal
* @typedef {import('../index.js').Parser} Parser
* @typedef {import('../index.js').Compiler} Compiler
* @typedef {import('unified').Parser} Parser
* @typedef {import('unified').Compiler} Compiler
*/

import {Buffer} from 'node:buffer'
import assert from 'node:assert/strict'
import test from 'node:test'
import {VFile} from 'vfile'
import {unified} from '../index.js'
import {unified} from 'unified'
import {SimpleCompiler, SimpleParser} from './util/simple.js'

test('process(file, done)', () => {
Expand Down
8 changes: 4 additions & 4 deletions test/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import process from 'node:process'
import assert from 'node:assert/strict'
import test from 'node:test'
import {VFile} from 'vfile'
import {unified} from '../index.js'
import {unified} from 'unified'

test('run(node[, file], done)', async () => {
const givenFile = new VFile('alpha')
Expand Down Expand Up @@ -144,7 +144,7 @@ test('run(node[, file], done)', async () => {
unified()
.use(
// Note: TS JS doesn’t understand the promise w/o explicit type.
/** @type {import('../index.js').Plugin<[]>} */
/** @type {import('unified').Plugin<[]>} */
() =>
function () {
return new Promise((resolve) => {
Expand Down Expand Up @@ -436,7 +436,7 @@ test('run(node[, file])', async () => {
unified()
.use(
// Note: TS JS doesn’t understand the promise w/o explicit type.
/** @type {import('../index.js').Plugin<[]>} */
/** @type {import('unified').Plugin<[]>} */
() =>
function () {
return new Promise((resolve) => {
Expand Down Expand Up @@ -661,7 +661,7 @@ test('runSync(node[, file])', async () => {
unified()
.use(
// Note: TS JS doesn’t understand the promise w/o explicit type.
/** @type {import('../index.js').Plugin<[]>} */
/** @type {import('unified').Plugin<[]>} */
() =>
function () {
return new Promise((resolve) => {
Expand Down
2 changes: 1 addition & 1 deletion test/stringify.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import {VFile} from 'vfile'
import {unified} from '../index.js'
import {unified} from 'unified'

test('stringify(node[, file])', () => {
const processor = unified()
Expand Down
2 changes: 1 addition & 1 deletion test/use.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import {unified} from '../index.js'
import {unified} from 'unified'

test('use(plugin[, options])', async (t) => {
await t.test('should ignore missing values', () => {
Expand Down
4 changes: 2 additions & 2 deletions test/util/simple.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @typedef {import('unist').Literal} Literal
* @typedef {import('../../index.js').Parser} Parser
* @typedef {import('../../index.js').Compiler} Compiler
* @typedef {import('unified').Parser} Parser
* @typedef {import('unified').Compiler} Compiler
*/

/** @type {Parser} */
Expand Down

0 comments on commit 932c140

Please sign in to comment.