json-6 1.1.3 → 1.1.5

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.
@@ -0,0 +1,11 @@
1
+ // register.mjs
2
+ // Registers the .json6 ESM loader hooks from lib/import.mjs.
3
+ //
4
+ // Usage:
5
+ // node --import json-6/lib/register.mjs app.mjs
6
+ //
7
+ // The loader is resolved relative to this file, not the working directory,
8
+ // so this works from a consuming package as well as from this repository.
9
+ import { register } from 'node:module';
10
+
11
+ register('./import.mjs', import.meta.url);
package/lib/require.js CHANGED
@@ -13,6 +13,12 @@ const JSON6 = require('./json6');
13
13
 
14
14
  // Modeled off of (v0.6.18 link; check latest too):
15
15
  // https://github.com/joyent/node/blob/v0.6.18/lib/module.js#L468-L472
16
+
17
+ /**
18
+ * @param {any} module
19
+ * @param {string} filename
20
+ * @returns {void}
21
+ */
16
22
  require.extensions['.json6'] = function (module, filename) {
17
23
  const content = FS.readFileSync(filename, 'utf8');
18
24
  module.exports = JSON6.parse(content);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-6",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "JSON for the ES6 era.",
5
5
  "keywords": [
6
6
  "json",
@@ -8,33 +8,70 @@
8
8
  ],
9
9
  "author": "d3x0r <d3x0r@github.com>",
10
10
  "contributors": [],
11
- "module": "dist/index.mjs",
11
+ "type": "commonjs",
12
12
  "main": "lib/json6.js",
13
- "bin": "lib/cli.js",
14
13
  "browser": "dist/index.js",
14
+ "exports": {
15
+ ".": {
16
+ "browser": "./dist/index.js",
17
+ "import": {
18
+ "types": "./dist/index-esm.d.mts",
19
+ "default": "./lib/index-esm.mjs"
20
+ },
21
+ "require": {
22
+ "types": "./dist/json6.d.ts",
23
+ "default": "./lib/json6.js"
24
+ }
25
+ },
26
+ "./lib/require": {
27
+ "types": "./dist/require.d.ts",
28
+ "default": "./lib/require.js"
29
+ },
30
+ "./lib/*.js": {
31
+ "types": "./dist/*.d.ts",
32
+ "default": "./lib/*.js"
33
+ },
34
+ "./lib/*.mjs": {
35
+ "types": "./dist/*.d.mts",
36
+ "default": "./lib/*.mjs"
37
+ },
38
+ "./dist/*": "./dist/*",
39
+ "./package.json": "./package.json"
40
+ },
41
+ "bin": "lib/cli.js",
15
42
  "files": [
16
43
  "dist/",
17
44
  "lib/"
18
45
  ],
19
46
  "dependencies": {},
20
47
  "devDependencies": {
21
- "@babel/preset-env": "latest",
48
+ "@arethetypeswrong/cli": "latest",
49
+ "@babel/core": "^7.0.0",
50
+ "@babel/preset-env": "^7.0.0",
51
+ "@eslint/js": "latest",
22
52
  "@rollup/plugin-babel": "latest",
23
53
  "@rollup/plugin-commonjs": "latest",
24
- "@rollup/plugin-node-resolve": "^7",
54
+ "@rollup/plugin-node-resolve": "latest",
25
55
  "@rollup/plugin-strip": "latest",
56
+ "@rollup/plugin-terser": "latest",
57
+ "@types/babel__core": "latest",
58
+ "@types/node": "latest",
59
+ "@types/mocha": "latest",
60
+ "@types/chai": "latest",
26
61
  "acorn": "latest",
27
62
  "chai": "latest",
28
63
  "core-js": "latest",
29
64
  "eslint": "latest",
65
+ "globals": "latest",
30
66
  "husky": "latest",
31
67
  "lint-staged": "latest",
32
68
  "mocha": "latest",
33
69
  "nyc": "latest",
34
70
  "rollup": "latest",
35
- "rollup-plugin-terser": "latest"
71
+ "typescript": "latest"
36
72
  },
37
73
  "nyc": {
74
+ "check-coverage": true,
38
75
  "statements": 100,
39
76
  "branches": 100,
40
77
  "functions": 100,
@@ -48,11 +85,14 @@
48
85
  ]
49
86
  },
50
87
  "scripts": {
88
+ "attw": "attw --profile node16 --pack .",
89
+ "tsc": "tsc",
90
+ "tsc-prod": "tsc -p tsconfig-prod.json",
51
91
  "prepack": "npm run test-lite",
52
92
  "lint": "eslint --cache .",
53
- "build": "node ./lib/cli.js -c package.json6 && rollup -c",
54
- "mocha-lite": "mocha --require chai/register-expect --experimental-loader=./lib/import.mjs --require ./lib/require.js ",
55
- "mocha": "mocha --require chai/register-expect --require ./lib/require.js --experimental-loader=./lib/import.mjs --recursive",
93
+ "build": "node build/src-to-lib.js && node ./lib/cli.js -c package.json6 && rollup -c && tsc -p tsconfig-prod.json",
94
+ "mocha-lite": "mocha --require ./lib/require.js \"test/**/*.js\"",
95
+ "mocha": "node --import ./lib/register.mjs ./node_modules/mocha/lib/cli/cli.js --require ./lib/require.js --recursive",
56
96
  "nyc-lite": "nyc npm run mocha-lite",
57
97
  "nyc": "nyc npm run mocha",
58
98
  "test-lite": "npm run lint && npm run build && npm run nyc-lite",
@@ -76,5 +116,9 @@
76
116
  },
77
117
  "lint-staged": {
78
118
  "*.js": "eslint --cache --fix"
119
+ },
120
+ "allowScripts": {
121
+ "core-js@3.50.0": true,
122
+ "fsevents@2.3.3": true
79
123
  }
80
124
  }