shinkansen-rails 1.0.18 → 1.0.21
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/.husky/post-commit +4 -0
- package/.husky/post-commit.cjs +8 -0
- package/.husky/post-commit.mjs +5 -0
- package/.husky/pre-commit +2 -1
- package/{babel.config.js → babel.config.cjs} +3 -4
- package/nvm.sh +42 -0
- package/package.json +35 -34
- package/src/index.cjs +13 -0
- package/src/index.mjs +7 -0
- package/src/rails/{index.js → index.mjs} +9 -3
- package/index.js +0 -7
- package/lib/index.js +0 -1
- package/lib/rails/index.js +0 -1
- package/src/index.js +0 -1
package/.husky/pre-commit
CHANGED
|
@@ -22,7 +22,7 @@ const presets = [
|
|
|
22
22
|
[
|
|
23
23
|
'@babel/env', {
|
|
24
24
|
targets: {
|
|
25
|
-
node: '
|
|
25
|
+
node: 'current',
|
|
26
26
|
browsers: [
|
|
27
27
|
'last 4 versions',
|
|
28
28
|
'safari >= 9',
|
|
@@ -43,7 +43,8 @@ const plugins = [
|
|
|
43
43
|
[
|
|
44
44
|
'module-resolver', {
|
|
45
45
|
alias: {
|
|
46
|
-
'shinkansen-rails': './src'
|
|
46
|
+
'shinkansen-rails/rails': './src/rails/index.mjs',
|
|
47
|
+
'shinkansen-rails': './src/index.cjs'
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
]
|
|
@@ -53,8 +54,6 @@ module.exports = (api) => {
|
|
|
53
54
|
if (api) api.cache.using(env)
|
|
54
55
|
|
|
55
56
|
return {
|
|
56
|
-
compact: true,
|
|
57
|
-
comments: false,
|
|
58
57
|
presets,
|
|
59
58
|
plugins
|
|
60
59
|
}
|
package/nvm.sh
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
NVM=~/.nvm
|
|
4
|
+
|
|
5
|
+
if [ -f "$NVM/nvm.sh" ];
|
|
6
|
+
then
|
|
7
|
+
unset npm_package_scripts_nvm
|
|
8
|
+
unset npm_config_prefix
|
|
9
|
+
unset npm_lifecycle_script
|
|
10
|
+
|
|
11
|
+
source $NVM/nvm.sh
|
|
12
|
+
else
|
|
13
|
+
NVM=$(brew --prefix nvm)
|
|
14
|
+
if [ -f "$NVM/nvm.sh" ];
|
|
15
|
+
then
|
|
16
|
+
unset npm_package_scripts_nvm
|
|
17
|
+
unset npm_config_prefix
|
|
18
|
+
unset npm_lifecycle_script
|
|
19
|
+
|
|
20
|
+
source $NVM/nvm.sh
|
|
21
|
+
fi
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
VERSION=$(nvm --version)
|
|
25
|
+
|
|
26
|
+
if [ -z "$VERSION" ];
|
|
27
|
+
then
|
|
28
|
+
echo Environment does not have NVM installed
|
|
29
|
+
else
|
|
30
|
+
echo Environment has NVM version $VERSION installed
|
|
31
|
+
|
|
32
|
+
set -e
|
|
33
|
+
|
|
34
|
+
nvm use
|
|
35
|
+
|
|
36
|
+
if [[ $? != 0 ]];
|
|
37
|
+
then
|
|
38
|
+
echo Environment does not have NVM configured
|
|
39
|
+
else
|
|
40
|
+
echo Environment has NVM version $VERSION configured
|
|
41
|
+
fi
|
|
42
|
+
fi
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinkansen-rails",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.21",
|
|
4
4
|
"description": "Shinkansen Rails",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Shinkansen",
|
|
@@ -9,55 +9,56 @@
|
|
|
9
9
|
"Zashiki",
|
|
10
10
|
"Karakuri"
|
|
11
11
|
],
|
|
12
|
-
"main": "./index.
|
|
12
|
+
"main": "./src/index.cjs",
|
|
13
13
|
"author": "Jonathan Perry for Modern Poacher Limited <modernpoacher@modernpoacher.com>",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"engines": {
|
|
16
|
-
"node": ">=
|
|
16
|
+
"node": ">=18.5.0"
|
|
17
17
|
},
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
20
|
"url": "git@github.com/modernpoacher/shinkansen-rails.git"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"build": "npm run babel",
|
|
26
|
-
"build:watch": "npm run babel:watch",
|
|
27
|
-
"clean": "rimraf lib",
|
|
28
|
-
"babel": "babel src -d lib",
|
|
29
|
-
"babel:watch": "npm run build -- -w",
|
|
30
|
-
"lint": "eslint .",
|
|
23
|
+
"prelint": "npm run nvm",
|
|
24
|
+
"lint": "eslint . --ext .mjs --ext .cjs",
|
|
31
25
|
"lint:fix": "npm run lint -- --fix",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
26
|
+
"pretest": "npm run nvm",
|
|
27
|
+
"test": "cross-env NODE_ENV=test mocha test --recursive",
|
|
28
|
+
"nvm": "bash nvm.sh"
|
|
34
29
|
},
|
|
35
30
|
"dependencies": {
|
|
36
|
-
"debug": "^4.3.
|
|
31
|
+
"debug": "^4.3.4"
|
|
37
32
|
},
|
|
38
33
|
"devDependencies": {
|
|
39
|
-
"@babel/
|
|
40
|
-
"@babel/
|
|
41
|
-
"@babel/
|
|
42
|
-
"@babel/plugin-proposal-
|
|
43
|
-
"@babel/
|
|
44
|
-
"@babel/
|
|
45
|
-
"@
|
|
46
|
-
"babel-
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"core-js": "^3.17.3",
|
|
34
|
+
"@babel/core": "^7.21.8",
|
|
35
|
+
"@babel/eslint-parser": "^7.21.8",
|
|
36
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
37
|
+
"@babel/plugin-proposal-export-default-from": "^7.18.10",
|
|
38
|
+
"@babel/preset-env": "^7.21.5",
|
|
39
|
+
"@babel/register": "^7.21.0",
|
|
40
|
+
"@modernpoacher/hooks": "^1.0.392",
|
|
41
|
+
"babel-plugin-module-resolver": "^5.0.0",
|
|
42
|
+
"chai": "^4.3.7",
|
|
43
|
+
"core-js": "^3.30.1",
|
|
50
44
|
"cross-env": "^7.0.3",
|
|
51
|
-
"eslint": "^
|
|
52
|
-
"eslint-config-standard": "^
|
|
53
|
-
"eslint-import-resolver-babel-module": "^5.3.
|
|
54
|
-
"eslint-plugin-import": "^2.
|
|
45
|
+
"eslint": "^8.39.0",
|
|
46
|
+
"eslint-config-standard": "^17.0.0",
|
|
47
|
+
"eslint-import-resolver-babel-module": "^5.3.2",
|
|
48
|
+
"eslint-plugin-import": "^2.27.5",
|
|
55
49
|
"eslint-plugin-node": "^11.1.0",
|
|
56
|
-
"eslint-plugin-promise": "^
|
|
57
|
-
"husky": "^
|
|
58
|
-
"mocha": "^
|
|
59
|
-
"rimraf": "^
|
|
60
|
-
"sinon": "^
|
|
50
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
51
|
+
"husky": "^8.0.3",
|
|
52
|
+
"mocha": "^10.2.0",
|
|
53
|
+
"rimraf": "^5.0.0",
|
|
54
|
+
"sinon": "^15.0.4",
|
|
61
55
|
"sinon-chai": "^3.7.0"
|
|
56
|
+
},
|
|
57
|
+
"exports": {
|
|
58
|
+
".": {
|
|
59
|
+
"require": "./src/index.cjs",
|
|
60
|
+
"import": "./src/index.mjs"
|
|
61
|
+
},
|
|
62
|
+
"./rails": "./src/rails/index.mjs"
|
|
62
63
|
}
|
|
63
64
|
}
|
package/src/index.cjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require('@babel/register')({ ignore: [/node_modules/], configFile: require.resolve('../babel.config.cjs') })
|
|
2
|
+
|
|
3
|
+
const debug = require('debug')
|
|
4
|
+
|
|
5
|
+
const log = debug('shinkansen-rails')
|
|
6
|
+
|
|
7
|
+
log('`shinkansen` is awake')
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
default: Rails
|
|
11
|
+
} = require('./rails/index.mjs')
|
|
12
|
+
|
|
13
|
+
module.exports.Rails = Rails
|
package/src/index.mjs
ADDED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import debug from 'debug'
|
|
2
|
+
|
|
3
|
+
const log = debug('shinkansen-rails')
|
|
4
|
+
|
|
5
|
+
log('`shinkansen` is awake')
|
|
6
|
+
|
|
1
7
|
let pattern
|
|
2
8
|
|
|
3
9
|
const map = new Map()
|
|
@@ -18,7 +24,7 @@ export const get = (o, k) => Reflect.get(o, k)
|
|
|
18
24
|
* @return {String} The string, converted
|
|
19
25
|
*/
|
|
20
26
|
export function rail (s) {
|
|
21
|
-
return (
|
|
27
|
+
return ( // eslint-disable-next-line no-useless-escape
|
|
22
28
|
s.toLowerCase().replace(/[^\w\-\d]/g, CHAR32).trim().replace(/[\s]+/g, CHAR45).replace(/[\s\s|\-\-]+/g, CHAR45)
|
|
23
29
|
)
|
|
24
30
|
}
|
|
@@ -99,13 +105,13 @@ export default class Rails {
|
|
|
99
105
|
}
|
|
100
106
|
|
|
101
107
|
static go (o = {}, s = Rails.pattern()) {
|
|
102
|
-
return (
|
|
108
|
+
return ( // eslint-disable-next-line no-cond-assign
|
|
103
109
|
any(o) ? (s = String(s)) ? go(o, s) : false : false // return is s is truthy true then go else false
|
|
104
110
|
)
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
static to (o = {}, s = Rails.pattern()) {
|
|
108
|
-
return (
|
|
114
|
+
return ( // eslint-disable-next-line no-cond-assign
|
|
109
115
|
any(o) ? (s = String(s)) ? to(o, s) : s : s
|
|
110
116
|
)
|
|
111
117
|
}
|
package/index.js
DELETED
package/lib/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";require("core-js/modules/es.object.define-property.js");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Rails",{enumerable:true,get:function get(){return _rails["default"];}});var _rails=_interopRequireDefault(require("./rails"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj};}
|
package/lib/rails/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";require("core-js/modules/es.object.define-property.js");Object.defineProperty(exports,"__esModule",{value:true});exports.rail=_rail;exports.go=_go;exports.to=_to;exports["default"]=exports.get=exports.has=exports.any=void 0;require("core-js/modules/es.array.iterator.js");require("core-js/modules/es.map.js");require("core-js/modules/es.object.to-string.js");require("core-js/modules/es.string.iterator.js");require("core-js/modules/web.dom-collections.iterator.js");require("core-js/modules/es.reflect.own-keys.js");require("core-js/modules/es.reflect.has.js");require("core-js/modules/es.reflect.get.js");require("core-js/modules/es.regexp.exec.js");require("core-js/modules/es.string.replace.js");require("core-js/modules/es.string.trim.js");require("core-js/modules/es.string.match.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}var _pattern;var map=new Map();var PATTERN='/:alpha/:omega';var CHAR32=String.fromCharCode(32);var CHAR45=String.fromCharCode(45);var any=function any(o){return!!Reflect.ownKeys(o).length;};exports.any=any;var has=function has(o,k){return Reflect.has(o,k);};exports.has=has;var get=function get(o,k){return Reflect.get(o,k);};exports.get=get;function _rail(s){return s.toLowerCase().replace(/[^\w\-\d]/g,CHAR32).trim().replace(/[\s]+/g,CHAR45).replace(/[\s\s|\-\-]+/g,CHAR45);}function _go(o,s){var b=any(o);if(b){var k;var a=s.match(/(\w+)/g);while(b&&(k=a.shift())){b=has(o,k);}}return b;}function _to(o,s){return s.replace(/(?::)(\w+)/g,function(m,k){return m?has(o,k)?get(o,k):m:m;});}var Rails=function(){function Rails(){_classCallCheck(this,Rails);}_createClass(Rails,null,[{key:"pattern",value:function pattern(p){return p?_pattern=String(p):_pattern||(_pattern=PATTERN);}},{key:"rail",value:function rail(s){var k=String(s);if(map.has(k))return map.get(k);var S=_rail(k);map.set(k,S);return S;}},{key:"go",value:function go(){var o=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var s=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Rails.pattern();return any(o)?(s=String(s))?_go(o,s):false:false;}},{key:"to",value:function to(){var o=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var s=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Rails.pattern();return any(o)?(s=String(s))?_to(o,s):s:s;}}]);return Rails;}();exports["default"]=Rails;
|
package/src/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export Rails from './rails'
|