@h3ravel/shared 0.15.3 → 0.16.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/CHANGELOG.md +12 -0
- package/dist/index.cjs +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/package.json +11 -3
- package/src/Utils/PathLoader.ts +6 -3
- package/tsconfig.json +2 -4
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -59,10 +59,13 @@ var PathLoader = class {
|
|
|
59
59
|
* @returns
|
|
60
60
|
*/
|
|
61
61
|
getPath(name, base) {
|
|
62
|
+
let path;
|
|
62
63
|
if (base && name !== "base") {
|
|
63
|
-
|
|
64
|
+
path = import_path.default.join(base, this.paths[name]);
|
|
65
|
+
} else {
|
|
66
|
+
path = this.paths[name];
|
|
64
67
|
}
|
|
65
|
-
return
|
|
68
|
+
return path.replace("/src/", `/${process.env.SRC_PATH ?? "src"}/`.replace(/([^:]\/)\/+/g, "$1"));
|
|
66
69
|
}
|
|
67
70
|
/**
|
|
68
71
|
* Programatically set the paths.
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/Utils/PathLoader.ts"],"sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from './Contracts/BindingsContract';\nexport * from './Contracts/IApplication';\nexport * from './Contracts/IContainer';\nexport * from './Contracts/IHttp';\nexport * from './Contracts/IRequest';\nexport * from './Contracts/IResponse';\nexport * from './Contracts/IServiceProvider';\nexport * from './Contracts/ObjContract';\nexport * from './Utils/PathLoader';\n","import { IPathName } from '../Contracts/IApplication'\nimport nodepath from 'path'\n\nexport class PathLoader {\n private paths = {\n base: '',\n views: '/src/resources/views',\n assets: '/public/assets',\n routes: '/src/routes',\n config: '/src/config',\n public: '/public',\n storage: '/storage',\n }\n\n /**\n * Dynamically retrieves a path property from the class.\n * Any property ending with \"Path\" is accessible automatically.\n *\n * @param name - The base name of the path property\n * @param base - The base path to include to the path\n * @returns \n */\n getPath (name: IPathName, base?: string): string {\n if (base && name !== 'base') {\n
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/Utils/PathLoader.ts"],"sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from './Contracts/BindingsContract';\nexport * from './Contracts/IApplication';\nexport * from './Contracts/IContainer';\nexport * from './Contracts/IHttp';\nexport * from './Contracts/IRequest';\nexport * from './Contracts/IResponse';\nexport * from './Contracts/IServiceProvider';\nexport * from './Contracts/ObjContract';\nexport * from './Utils/PathLoader';\n","import { IPathName } from '../Contracts/IApplication'\nimport nodepath from 'path'\n\nexport class PathLoader {\n private paths = {\n base: '',\n views: '/src/resources/views',\n assets: '/public/assets',\n routes: '/src/routes',\n config: '/src/config',\n public: '/public',\n storage: '/storage',\n }\n\n /**\n * Dynamically retrieves a path property from the class.\n * Any property ending with \"Path\" is accessible automatically.\n *\n * @param name - The base name of the path property\n * @param base - The base path to include to the path\n * @returns \n */\n getPath (name: IPathName, base?: string): string {\n let path: string;\n\n if (base && name !== 'base') {\n path = nodepath.join(base, this.paths[name])\n } else {\n path = this.paths[name]\n }\n return path.replace('/src/', `/${process.env.SRC_PATH ?? 'src'}/`.replace(/([^:]\\/)\\/+/g, \"$1\"))\n }\n\n /**\n * Programatically set the paths.\n *\n * @param name - The base name of the path property\n * @param path - The new path\n * @param base - The base path to include to the path\n */\n setPath (name: IPathName, path: string, base?: string) {\n if (base && name !== 'base') {\n this.paths[name] = nodepath.join(base, path)\n }\n\n this.paths[name] = path\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACCA,kBAAqB;AAEd,IAAMA,aAAN,MAAMA;EAFb,OAEaA;;;EACDC,QAAQ;IACZC,MAAM;IACNC,OAAO;IACPC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,SAAS;EACb;;;;;;;;;EAUAC,QAASC,MAAiBR,MAAuB;AAC7C,QAAIS;AAEJ,QAAIT,QAAQQ,SAAS,QAAQ;AACzBC,aAAOC,YAAAA,QAASC,KAAKX,MAAM,KAAKD,MAAMS,IAAAA,CAAK;IAC/C,OAAO;AACHC,aAAO,KAAKV,MAAMS,IAAAA;IACtB;AACA,WAAOC,KAAKG,QAAQ,SAAS,IAAIC,QAAQC,IAAIC,YAAY,KAAA,IAASH,QAAQ,gBAAgB,IAAA,CAAA;EAC9F;;;;;;;;EASAI,QAASR,MAAiBC,MAAcT,MAAe;AACnD,QAAIA,QAAQQ,SAAS,QAAQ;AACzB,WAAKT,MAAMS,IAAAA,IAAQE,YAAAA,QAASC,KAAKX,MAAMS,IAAAA;IAC3C;AAEA,SAAKV,MAAMS,IAAAA,IAAQC;EACvB;AACJ;","names":["PathLoader","paths","base","views","assets","routes","config","public","storage","getPath","name","path","nodepath","join","replace","process","env","SRC_PATH","setPath"]}
|
package/dist/index.js
CHANGED
|
@@ -25,10 +25,13 @@ var PathLoader = class {
|
|
|
25
25
|
* @returns
|
|
26
26
|
*/
|
|
27
27
|
getPath(name, base) {
|
|
28
|
+
let path;
|
|
28
29
|
if (base && name !== "base") {
|
|
29
|
-
|
|
30
|
+
path = nodepath.join(base, this.paths[name]);
|
|
31
|
+
} else {
|
|
32
|
+
path = this.paths[name];
|
|
30
33
|
}
|
|
31
|
-
return
|
|
34
|
+
return path.replace("/src/", `/${process.env.SRC_PATH ?? "src"}/`.replace(/([^:]\/)\/+/g, "$1"));
|
|
32
35
|
}
|
|
33
36
|
/**
|
|
34
37
|
* Programatically set the paths.
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Utils/PathLoader.ts"],"sourcesContent":["import { IPathName } from '../Contracts/IApplication'\nimport nodepath from 'path'\n\nexport class PathLoader {\n private paths = {\n base: '',\n views: '/src/resources/views',\n assets: '/public/assets',\n routes: '/src/routes',\n config: '/src/config',\n public: '/public',\n storage: '/storage',\n }\n\n /**\n * Dynamically retrieves a path property from the class.\n * Any property ending with \"Path\" is accessible automatically.\n *\n * @param name - The base name of the path property\n * @param base - The base path to include to the path\n * @returns \n */\n getPath (name: IPathName, base?: string): string {\n if (base && name !== 'base') {\n
|
|
1
|
+
{"version":3,"sources":["../src/Utils/PathLoader.ts"],"sourcesContent":["import { IPathName } from '../Contracts/IApplication'\nimport nodepath from 'path'\n\nexport class PathLoader {\n private paths = {\n base: '',\n views: '/src/resources/views',\n assets: '/public/assets',\n routes: '/src/routes',\n config: '/src/config',\n public: '/public',\n storage: '/storage',\n }\n\n /**\n * Dynamically retrieves a path property from the class.\n * Any property ending with \"Path\" is accessible automatically.\n *\n * @param name - The base name of the path property\n * @param base - The base path to include to the path\n * @returns \n */\n getPath (name: IPathName, base?: string): string {\n let path: string;\n\n if (base && name !== 'base') {\n path = nodepath.join(base, this.paths[name])\n } else {\n path = this.paths[name]\n }\n return path.replace('/src/', `/${process.env.SRC_PATH ?? 'src'}/`.replace(/([^:]\\/)\\/+/g, \"$1\"))\n }\n\n /**\n * Programatically set the paths.\n *\n * @param name - The base name of the path property\n * @param path - The new path\n * @param base - The base path to include to the path\n */\n setPath (name: IPathName, path: string, base?: string) {\n if (base && name !== 'base') {\n this.paths[name] = nodepath.join(base, path)\n }\n\n this.paths[name] = path\n }\n}\n"],"mappings":";;;;AACA,OAAOA,cAAc;AAEd,IAAMC,aAAN,MAAMA;EAFb,OAEaA;;;EACDC,QAAQ;IACZC,MAAM;IACNC,OAAO;IACPC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,SAAS;EACb;;;;;;;;;EAUAC,QAASC,MAAiBR,MAAuB;AAC7C,QAAIS;AAEJ,QAAIT,QAAQQ,SAAS,QAAQ;AACzBC,aAAOC,SAASC,KAAKX,MAAM,KAAKD,MAAMS,IAAAA,CAAK;IAC/C,OAAO;AACHC,aAAO,KAAKV,MAAMS,IAAAA;IACtB;AACA,WAAOC,KAAKG,QAAQ,SAAS,IAAIC,QAAQC,IAAIC,YAAY,KAAA,IAASH,QAAQ,gBAAgB,IAAA,CAAA;EAC9F;;;;;;;;EASAI,QAASR,MAAiBC,MAAcT,MAAe;AACnD,QAAIA,QAAQQ,SAAS,QAAQ;AACzB,WAAKT,MAAMS,IAAAA,IAAQE,SAASC,KAAKX,MAAMS,IAAAA;IAC3C;AAEA,SAAKV,MAAMS,IAAAA,IAAQC;EACvB;AACJ;","names":["nodepath","PathLoader","paths","base","views","assets","routes","config","public","storage","getPath","name","path","nodepath","join","replace","process","env","SRC_PATH","setPath"]}
|
package/package.json
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h3ravel/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Shared Utilities.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
8
16
|
"publishConfig": {
|
|
9
17
|
"access": "public"
|
|
10
18
|
},
|
package/src/Utils/PathLoader.ts
CHANGED
|
@@ -21,11 +21,14 @@ export class PathLoader {
|
|
|
21
21
|
* @returns
|
|
22
22
|
*/
|
|
23
23
|
getPath (name: IPathName, base?: string): string {
|
|
24
|
+
let path: string;
|
|
25
|
+
|
|
24
26
|
if (base && name !== 'base') {
|
|
25
|
-
|
|
27
|
+
path = nodepath.join(base, this.paths[name])
|
|
28
|
+
} else {
|
|
29
|
+
path = this.paths[name]
|
|
26
30
|
}
|
|
27
|
-
|
|
28
|
-
return this.paths[name]
|
|
31
|
+
return path.replace('/src/', `/${process.env.SRC_PATH ?? 'src'}/`.replace(/([^:]\/)\/+/g, "$1"))
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
/**
|
package/tsconfig.json
CHANGED
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"experimentalDecorators": true,
|
|
4
4
|
"emitDecoratorMetadata": true,
|
|
5
|
-
"target": "
|
|
6
|
-
"module": "
|
|
5
|
+
"target": "es2022",
|
|
6
|
+
"module": "es2022",
|
|
7
7
|
"moduleResolution": "Node",
|
|
8
8
|
"esModuleInterop": true,
|
|
9
9
|
"strict": true,
|
|
10
10
|
"allowJs": true,
|
|
11
11
|
"skipLibCheck": true,
|
|
12
12
|
"resolveJsonModule": true
|
|
13
|
-
// "target": "ES2022",
|
|
14
|
-
// "module": "ESNext",
|
|
15
13
|
},
|
|
16
14
|
"exclude": ["./dist", "./**/dist", "/.node_modules"]
|
|
17
15
|
}
|