space-router 0.8.5 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/tasks/build.js CHANGED
@@ -1,4 +1,10 @@
1
- const execa = require('execa')
1
+ import fs from 'fs'
2
+ import path from 'path'
3
+ import { fileURLToPath } from 'url'
4
+ import { execa } from 'execa'
5
+
6
+ const __filename = fileURLToPath(import.meta.url)
7
+ const __dirname = path.dirname(__filename)
2
8
 
3
9
  const sh = (...args) => execa(...args, { stdio: 'inherit', shell: true })
4
10
 
@@ -6,9 +12,9 @@ const sh = (...args) => execa(...args, { stdio: 'inherit', shell: true })
6
12
  await sh('rm -rf dist')
7
13
  await sh('mkdir -p dist')
8
14
 
9
- const pkg = require('../package.json')
15
+ const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json')))
10
16
 
11
- const babel = './node_modules/.bin/babel'
12
- await sh(`${babel} --no-babelrc src -d ${pkg.main} --config-file=./.babelrc-cjs`)
13
- await sh(`${babel} --no-babelrc src -d ${pkg.module} --config-file=./.babelrc-esm`)
17
+ const swc = './node_modules/.bin/swc'
18
+ await sh(`${swc} --no-swcrc src -d ${pkg.main} --config-file=./.swc-cjs`)
19
+ await sh(`${swc} --no-swcrc src -d ${pkg.module} --config-file=./.swc-esm`)
14
20
  })()
@@ -1,5 +1,5 @@
1
1
  import test from 'ava'
2
- import { flatten } from '../src/router'
2
+ import { flatten } from '../src/router.js'
3
3
 
4
4
  test('converts array of routes to array of internal route descriptors', (t) => {
5
5
  t.deepEqual(
@@ -1,6 +1,6 @@
1
1
  import test from 'ava'
2
- import { qs } from '../src'
3
- import { matchOne as match } from '../src/match'
2
+ import { qs } from '../src/index.js'
3
+ import { matchOne as match } from '../src/match.js'
4
4
 
5
5
  test('match explicit equality', (t) => {
6
6
  t.deepEqual(match('/', '/').params, {})
@@ -1,5 +1,5 @@
1
1
  import test from 'ava'
2
- import { qs, createRouter } from '../src'
2
+ import { qs, createRouter } from '../src/index.js'
3
3
 
4
4
  test('createRouter, listen, navigate and dispose', (t) => {
5
5
  const calls = []
package/.babelrc-cjs DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "presets": [
3
- [
4
- "@babel/preset-env",
5
- {
6
- "loose": true,
7
- "targets": {
8
- "browsers": [
9
- "last 2 versions",
10
- "IE >= 9"
11
- ]
12
- },
13
- "exclude": ["transform-regenerator"]
14
- }
15
- ]
16
- ]
17
- }
File without changes