@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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @h3ravel/shared
2
2
 
3
+ ## 0.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 79f4045: feat: add add exports to package.json
8
+
9
+ ## 0.15.4
10
+
11
+ ### Patch Changes
12
+
13
+ - feat: implement full IoC container resolution
14
+
3
15
  ## 0.15.3
4
16
 
5
17
  ### Patch Changes
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
- return import_path.default.join(base, this.paths[name]);
64
+ path = import_path.default.join(base, this.paths[name]);
65
+ } else {
66
+ path = this.paths[name];
64
67
  }
65
- return this.paths[name];
68
+ return path.replace("/src/", `/${process.env.SRC_PATH ?? "src"}/`.replace(/([^:]\/)\/+/g, "$1"));
66
69
  }
67
70
  /**
68
71
  * Programatically set the paths.
@@ -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 return nodepath.join(base, this.paths[name])\n }\n\n return this.paths[name]\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,QAAIA,QAAQQ,SAAS,QAAQ;AACzB,aAAOC,YAAAA,QAASC,KAAKV,MAAM,KAAKD,MAAMS,IAAAA,CAAK;IAC/C;AAEA,WAAO,KAAKT,MAAMS,IAAAA;EACtB;;;;;;;;EASAG,QAASH,MAAiBI,MAAcZ,MAAe;AACnD,QAAIA,QAAQQ,SAAS,QAAQ;AACzB,WAAKT,MAAMS,IAAAA,IAAQC,YAAAA,QAASC,KAAKV,MAAMY,IAAAA;IAC3C;AAEA,SAAKb,MAAMS,IAAAA,IAAQI;EACvB;AACJ;","names":["PathLoader","paths","base","views","assets","routes","config","public","storage","getPath","name","nodepath","join","setPath","path"]}
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
- return nodepath.join(base, this.paths[name]);
30
+ path = nodepath.join(base, this.paths[name]);
31
+ } else {
32
+ path = this.paths[name];
30
33
  }
31
- return this.paths[name];
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 return nodepath.join(base, this.paths[name])\n }\n\n return this.paths[name]\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,QAAIA,QAAQQ,SAAS,QAAQ;AACzB,aAAOC,SAASC,KAAKV,MAAM,KAAKD,MAAMS,IAAAA,CAAK;IAC/C;AAEA,WAAO,KAAKT,MAAMS,IAAAA;EACtB;;;;;;;;EASAG,QAASH,MAAiBI,MAAcZ,MAAe;AACnD,QAAIA,QAAQQ,SAAS,QAAQ;AACzB,WAAKT,MAAMS,IAAAA,IAAQC,SAASC,KAAKV,MAAMY,IAAAA;IAC3C;AAEA,SAAKb,MAAMS,IAAAA,IAAQI;EACvB;AACJ;","names":["nodepath","PathLoader","paths","base","views","assets","routes","config","public","storage","getPath","name","nodepath","join","setPath","path"]}
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.15.3",
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
  },
@@ -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
- return nodepath.join(base, this.paths[name])
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": "esnext",
6
- "module": "preserve",
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
  }