@jsonic/multisource 0.1.0 → 0.2.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/jest.config.js CHANGED
@@ -1,7 +1,9 @@
1
1
  /** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */
2
2
  module.exports = {
3
- preset: 'ts-jest',
3
+ transform: {
4
+ "^.+\\.tsx?$": "esbuild-jest"
5
+ },
4
6
  testEnvironment: 'node',
5
7
  testMatch: ['**/test/**/*.test.ts'],
6
8
  watchPathIgnorePatterns: ['.*.js$'],
7
- };
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsonic/multisource",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "",
5
5
  "main": "dist/multisource.js",
6
6
  "type": "commonjs",
@@ -29,7 +29,7 @@
29
29
  "reset": "npm run clean && npm i && npm test",
30
30
  "repo-tag": "REPO_VERSION=`node -e \"console.log(require('./package').version)\"` && echo TAG: v$REPO_VERSION && git commit -a -m v$REPO_VERSION && git push && git tag v$REPO_VERSION && git push --tags;",
31
31
  "repo-publish": "npm run clean && npm i && npm run repo-publish-quick",
32
- "repo-publish-quick": "npm run prettier && npm run build && npm run test && npm run repo-tag && npm publish --access public --registry http://registry.npmjs.org "
32
+ "repo-publish-quick": "npm run prettier && npm run build && npm run test && npm run repo-tag && npm publish --access public --registry https://registry.npmjs.org "
33
33
  },
34
34
  "license": "MIT",
35
35
  "files": [
@@ -41,15 +41,18 @@
41
41
  "dist"
42
42
  ],
43
43
  "devDependencies": {
44
- "@types/jest": "^27.0.1",
45
- "jest": "^27.1.1",
44
+ "@types/jest": "^27.4.1",
45
+ "browserify": "^17.0.0",
46
+ "esbuild": "^0.14.28",
47
+ "esbuild-jest": "^0.5.0",
48
+ "jest": "^27.5.1",
46
49
  "jsonic": "github:jsonicjs/jsonic#nextgen",
47
- "prettier": "^2.4.0",
50
+ "prettier": "^2.6.1",
48
51
  "tinyify": "^3.0.0",
49
- "ts-jest": "^27.0.5",
50
- "typescript": "^4.4.2"
52
+ "ts-jest": "^27.1.4",
53
+ "typescript": "^4.6.3"
51
54
  },
52
55
  "dependencies": {
53
- "@jsonic/directive": "^0.3.0"
56
+ "@jsonic/directive": "^0.4.1"
54
57
  }
55
58
  }
@@ -1,49 +0,0 @@
1
-
2
- import Fs from 'fs'
3
- import Path from 'path'
4
-
5
-
6
-
7
- import { Context } from 'jsonic'
8
- import { Resolver, Resolution } from '../multisource'
9
-
10
-
11
- function makeFileResolver(): Resolver {
12
-
13
- return function FileResolver(path: string, ctx?: Context): Resolution {
14
- let msmeta = ctx && ctx.meta && ctx.meta.multisource || {}
15
- let popts = ctx && ctx.opts && ctx.opts &&
16
- ctx.opts.plugin && ctx.opts.plugin.multisource || {}
17
-
18
- let basefile =
19
- null == msmeta.path ?
20
- null == popts.path ?
21
- path : popts.path : msmeta.path
22
-
23
- let fstats = Fs.statSync(basefile)
24
- let basepath = basefile
25
-
26
- if (fstats.isFile()) {
27
- let basedesc = Path.parse(basefile)
28
- basepath = basedesc.dir
29
- }
30
-
31
- let isabsolute = Path.isAbsolute(path)
32
- let fullpath = isabsolute ? path :
33
- (null == basepath ? path : Path.resolve(basepath, path))
34
-
35
- let src = Fs.readFileSync(fullpath).toString()
36
-
37
- return {
38
- path: path,
39
- full: fullpath,
40
- base: basepath,
41
- src,
42
- }
43
- }
44
- }
45
-
46
-
47
- export {
48
- makeFileResolver
49
- }