@modernpoacher/halacious 6.2.6 → 6.2.8

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/README.md CHANGED
@@ -42,7 +42,7 @@ yarn add @modernpoacher/halacious --dev
42
42
  Register the plugin with the app server
43
43
  ```javascript
44
44
  const hapi = require('@hapi/hapi');
45
- const halacious = require('@modernpoacher/halacious');
45
+ const halacious = require('#halacious');
46
46
 
47
47
  const server = hapi.server({ port: 8080 });
48
48
 
@@ -376,7 +376,7 @@ happily let you be lazy but its much better if we do things the Right Way.
376
376
  Halacious exposes its api to your Hapi server so that you may configure it at runtime like so:
377
377
  ```javascript
378
378
  const hapi = require('@hapi/hapi');
379
- const halacious = require('@modernpoacher/halacious');
379
+ const halacious = require('#halacious');
380
380
 
381
381
  async function init () {
382
382
  await server.register(halacious);
@@ -441,7 +441,7 @@ company's namespace. We can suck all these into the system in one fell swoop:
441
441
 
442
442
  ```javascript
443
443
  const hapi = require('@hapi/hapi');
444
- const halacious = require('@modernpoacher/halacious');
444
+ const halacious = require('#halacious');
445
445
 
446
446
  async function init () {
447
447
  const server = hapi.server({ port: 8080 });
@@ -472,7 +472,7 @@ configuration option. For example:
472
472
 
473
473
  ```javascript
474
474
  const hapi = require('@hapi/hapi');
475
- const halacious = require('@modernpoacher/halacious');
475
+ const halacious = require('#halacious');
476
476
 
477
477
  async function init () {
478
478
  const server = hapi.server({ port: 8080 });
@@ -1,10 +1,8 @@
1
- require('module-alias/register')
2
-
3
1
  const hapi = require('@hapi/hapi')
4
2
  const vision = require('@hapi/vision')
5
- const halacious = require('halacious')
3
+ const halacious = require('#halacious')
6
4
 
7
- const { name: PLUGIN } = require('halacious/package.json')
5
+ const { name: PLUGIN } = require('#halacious/package.json')
8
6
 
9
7
  async function init () {
10
8
  const server = hapi.server({ port: 8080 })
@@ -1,8 +1,6 @@
1
- require('module-alias/register')
2
-
3
1
  const hapi = require('@hapi/hapi')
4
2
  const vision = require('@hapi/vision')
5
- const halacious = require('halacious')
3
+ const halacious = require('#halacious')
6
4
 
7
5
  async function init () {
8
6
  const server = hapi.server({ port: 8080 })
@@ -1,12 +1,10 @@
1
- require('module-alias/register')
2
-
3
1
  const path = require('path')
4
2
 
5
3
  const hapi = require('@hapi/hapi')
6
4
  const vision = require('@hapi/vision')
7
- const halacious = require('halacious')
5
+ const halacious = require('#halacious')
8
6
 
9
- const { name: PLUGIN } = require('halacious/package.json')
7
+ const { name: PLUGIN } = require('#halacious/package.json')
10
8
 
11
9
  async function init () {
12
10
  const server = hapi.server({ port: 8080 })
@@ -1,8 +1,6 @@
1
- require('module-alias/register')
2
-
3
1
  const hapi = require('@hapi/hapi')
4
2
  const vision = require('@hapi/vision')
5
- const halacious = require('halacious')
3
+ const halacious = require('#halacious')
6
4
 
7
5
  async function init () {
8
6
  const server = hapi.server({ port: 8080 })
@@ -1,8 +1,6 @@
1
- require('module-alias/register')
2
-
3
1
  const hapi = require('@hapi/hapi')
4
2
  const vision = require('@hapi/vision')
5
- const halacious = require('halacious')
3
+ const halacious = require('#halacious')
6
4
 
7
5
  async function init () {
8
6
  const server = hapi.server({ port: 8080 })
@@ -1,10 +1,8 @@
1
- require('module-alias/register')
2
-
3
1
  const hapi = require('@hapi/hapi')
4
2
  const vision = require('@hapi/vision')
5
- const halacious = require('halacious')
3
+ const halacious = require('#halacious')
6
4
 
7
- const { name: PLUGIN } = require('halacious/package')
5
+ const { name: PLUGIN } = require('#halacious/package')
8
6
 
9
7
  async function init () {
10
8
  const server = hapi.server({ port: 8080 })
@@ -1,8 +1,6 @@
1
- require('module-alias/register')
2
-
3
1
  const hapi = require('@hapi/hapi')
4
2
  const vision = require('@hapi/vision')
5
- const halacious = require('halacious')
3
+ const halacious = require('#halacious')
6
4
 
7
5
  async function init () {
8
6
  const server = hapi.server({ port: 8080 })
@@ -1,12 +1,10 @@
1
- require('module-alias/register')
2
-
3
1
  const hapi = require('@hapi/hapi')
4
2
  const vision = require('@hapi/vision')
5
3
  const hoek = require('@hapi/hoek')
6
4
  const Uri = require('urijs')
7
- const halacious = require('halacious')
5
+ const halacious = require('#halacious')
8
6
 
9
- const { name: PLUGIN } = require('halacious/package')
7
+ const { name: PLUGIN } = require('#halacious/package')
10
8
 
11
9
  const users = []
12
10
 
@@ -1,8 +1,6 @@
1
- require('module-alias/register')
2
-
3
1
  const hapi = require('@hapi/hapi')
4
2
  const vision = require('@hapi/vision')
5
- const halacious = require('halacious')
3
+ const halacious = require('#halacious')
6
4
 
7
5
  function User (id, firstName, lastName, googlePlusId) {
8
6
  this.id = id
@@ -1,8 +1,6 @@
1
- require('module-alias/register')
2
-
3
1
  const hapi = require('@hapi/hapi')
4
2
  const vision = require('@hapi/vision')
5
- const halacious = require('halacious')
3
+ const halacious = require('#halacious')
6
4
 
7
5
  async function init () {
8
6
  const server = hapi.server({ port: 8080 })
@@ -1,12 +1,10 @@
1
- require('module-alias/register')
2
-
3
1
  const path = require('path')
4
2
 
5
3
  const hapi = require('@hapi/hapi')
6
4
  const vision = require('@hapi/vision')
7
- const halacious = require('halacious')
5
+ const halacious = require('#halacious')
8
6
 
9
- const { name: PLUGIN } = require('halacious/package')
7
+ const { name: PLUGIN } = require('#halacious/package')
10
8
 
11
9
  async function init () {
12
10
  const server = hapi.server({ port: 8080 })
@@ -1,8 +1,6 @@
1
- require('module-alias/register')
2
-
3
1
  const hapi = require('@hapi/hapi')
4
2
  const vision = require('@hapi/vision')
5
- const halacious = require('halacious')
3
+ const halacious = require('#halacious')
6
4
 
7
5
  async function init () {
8
6
  const server = hapi.server({ port: 8080 })
@@ -1,8 +1,6 @@
1
- require('module-alias/register')
2
-
3
1
  const hapi = require('@hapi/hapi')
4
2
  const vision = require('@hapi/vision')
5
- const halacious = require('halacious')
3
+ const halacious = require('#halacious')
6
4
 
7
5
  async function init () {
8
6
  const server = hapi.server({ port: 8080 })
package/index.d.ts CHANGED
@@ -1,3 +1,7 @@
1
1
  declare module '@modernpoacher/halacious' {
2
- export const plugin: object
2
+ const plugin: object
3
+
4
+ export {
5
+ plugin
6
+ }
3
7
  }
package/lib/plugin.js CHANGED
@@ -10,6 +10,12 @@ const async = require('async')
10
10
  const {
11
11
  marked
12
12
  } = require('marked')
13
+ const {
14
+ mangle
15
+ } = require('marked-mangle')
16
+ const {
17
+ gfmHeadingId
18
+ } = require('marked-gfm-heading-id')
13
19
  const urlTemplate = require('url-template')
14
20
  const Negotiator = require('negotiator')
15
21
  const URITemplate = require('urijs/src/URITemplate')
@@ -98,7 +104,8 @@ exports.plugin = {
98
104
  settings = validated
99
105
  })
100
106
 
101
- marked.setOptions(settings.marked)
107
+ marked.use(gfmHeadingId(settings.marked))
108
+ marked.use(mangle(settings.marked))
102
109
 
103
110
  const selection = settings.apiServerLabel
104
111
  ? server.select(settings.apiServerLabel)
@@ -2,8 +2,8 @@
2
2
  const _ = require('lodash')
3
3
  const hoek = require('@hapi/hoek')
4
4
 
5
- const templatedRE = new RegExp('{*}')
6
5
  const URI = require('urijs')
6
+ const templatedRE = /{*}/
7
7
 
8
8
  /**
9
9
  * A HAL wrapper interface around an entity. Provides an api for adding new links and recursively embedding child
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modernpoacher/halacious",
3
- "version": "6.2.6",
3
+ "version": "6.2.8",
4
4
  "description": "A HAL processor for Hapi",
5
5
  "keywords": [
6
6
  "HAL",
@@ -30,15 +30,20 @@
30
30
  "lint": "eslint .",
31
31
  "lint:fix": "npm run lint -- --fix",
32
32
  "test": "cross-env NODE_ENV=test mocha test",
33
- "pre-commit": "npm run lint && npm test"
33
+ "prepare": "husky install"
34
34
  },
35
35
  "dependencies": {
36
36
  "@hapi/boom": "9.1.0",
37
37
  "@hapi/hoek": "9.0.4",
38
38
  "@hapi/joi": "15.1.1",
39
+ "@typescript-eslint/eslint-plugin": "^5.59.7",
40
+ "@typescript-eslint/parser": "^5.59.7",
39
41
  "async": "^3.2.4",
42
+ "eslint-config-standard-with-typescript": "^34.0.1",
40
43
  "lodash": "^4.17.21",
41
44
  "marked": "^5.0.3",
45
+ "marked-gfm-heading-id": "^3.0.3",
46
+ "marked-mangle": "^1.0.1",
42
47
  "negotiator": "^0.6.3",
43
48
  "pug": "^3.0.2",
44
49
  "urijs": "^1.19.11",
@@ -49,7 +54,6 @@
49
54
  "@babel/eslint-parser": "^7.21.8",
50
55
  "@hapi/hapi": "18.4.1",
51
56
  "@hapi/vision": "6.0.1",
52
- "babel-loader": "^9.1.2",
53
57
  "chai": "^4.3.7",
54
58
  "chai-string": "^1.5.0",
55
59
  "cross-env": "^7.0.3",
@@ -61,11 +65,16 @@
61
65
  "eslint-plugin-promise": "^6.1.1",
62
66
  "husky": "^8.0.3",
63
67
  "mocha": "^10.2.0",
64
- "module-alias": "^2.2.2",
65
68
  "sinon": "^15.1.0",
66
69
  "sinon-chai": "^3.7.0"
67
70
  },
68
- "_moduleAliases": {
69
- "halacious": "."
71
+ "imports": {
72
+ "#halacious/package.json": "./package.json",
73
+ "#halacious/lib/*": "./lib/*.js",
74
+ "#halacious": "./lib/index.js"
75
+ },
76
+ "exports": {
77
+ "./lib": "./lib/*.js",
78
+ ".": "./lib/index.js"
70
79
  }
71
80
  }
@@ -1,5 +1,3 @@
1
- require('module-alias/register')
2
-
3
1
  const path = require('path')
4
2
 
5
3
  const chai = require('chai')
@@ -10,15 +8,15 @@ const vision = require('@hapi/vision')
10
8
  const sinon = require('sinon')
11
9
  const sinonChai = require('sinon-chai')
12
10
  const chaiString = require('chai-string')
13
- const halacious = require('halacious')
14
- const { plugin } = require('halacious/lib/plugin')
11
+ const halacious = require('#halacious')
12
+ const { plugin } = require('#halacious/lib/plugin')
15
13
  const _ = require('lodash')
16
14
  const url = require('url')
17
15
 
18
16
  chai.use(sinonChai)
19
17
  chai.use(chaiString)
20
18
 
21
- const { name: PLUGIN } = require('halacious/package')
19
+ const { name: PLUGIN } = require('#halacious/package.json')
22
20
 
23
21
  describe('Halacious Plugin', () => {
24
22
  let server
@@ -1,14 +1,12 @@
1
- require('module-alias/register')
2
-
3
1
  const chai = require('chai')
4
2
 
5
3
  const should = chai.should()
6
4
  const hapi = require('@hapi/hapi')
7
- const halacious = require('halacious')
5
+ const halacious = require('#halacious')
8
6
 
9
- const { RepresentationFactory } = require('halacious/lib/representation')
7
+ const { RepresentationFactory } = require('#halacious/lib/representation')
10
8
 
11
- const { name: PLUGIN } = require('halacious/package')
9
+ const { name: PLUGIN } = require('#halacious/package.json')
12
10
 
13
11
  describe('Representation Factory', () => {
14
12
  let server
package/tsconfig.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "NodeNext",
4
+ "target": "ESNext",
5
+ "moduleResolution": "NodeNext",
6
+ "noEmit": true,
7
+ "strict": true,
8
+ "isolatedModules": true,
9
+ "baseUrl": "."
10
+ }
11
+ }
package/types/index.d.ts CHANGED
@@ -1,4 +1,12 @@
1
1
  declare namespace halacious {
2
+ export interface Collection {
3
+ uid: string
4
+ }
5
+
6
+ export interface Member {
7
+ uid: string
8
+ }
9
+
2
10
  export interface Representation {
3
11
  request: {
4
12
  route: {
@@ -11,8 +19,8 @@ declare namespace halacious {
11
19
  }
12
20
  }
13
21
  entity: {
14
- collections?: Array<{ uid: string }>
15
- members?: Array<{ uid: string }>
22
+ collections?: Collection[]
23
+ members?: Member[]
16
24
  }
17
25
  ignore: (v: string) => void
18
26
  embed: (v: string, u: string, m: object) => void
package/views/rel.jade CHANGED
@@ -4,4 +4,4 @@ head
4
4
  body
5
5
  h1=rel.name
6
6
  =rel.description
7
- !=relData
7
+ !=relData