@jsarc/pajo 0.0.0 → 0.0.1-beta.0.2
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 +2 -2
- package/index.ts +2 -36
- package/js/index.js +2 -24
- package/package.json +1 -1
- package/web/pajo.js +2 -16
- package/web/pajo.min.js +1 -1
package/README.md
CHANGED
|
@@ -73,7 +73,7 @@ const { Pajo } = require('@jsarc/pajo');
|
|
|
73
73
|
```html
|
|
74
74
|
<script src="@jsarc/pajo/pajo.all.js"></script>
|
|
75
75
|
<script>
|
|
76
|
-
// Disponible globalement via window.Pajo
|
|
76
|
+
// Disponible globalement via (window as any).Pajo
|
|
77
77
|
console.log(Pajo.join('path', 'to', 'file.txt'));
|
|
78
78
|
</script>
|
|
79
79
|
```
|
|
@@ -247,7 +247,7 @@ Expose la classe Pajo à l'objet global (window) pour une utilisation dans les n
|
|
|
247
247
|
```javascript
|
|
248
248
|
// Dans un navigateur, après avoir chargé le script
|
|
249
249
|
Pajo.exposeToGlobal();
|
|
250
|
-
console.log(window.Pajo); // La classe Pajo est disponible
|
|
250
|
+
console.log((window as any).Pajo); // La classe Pajo est disponible
|
|
251
251
|
```
|
|
252
252
|
|
|
253
253
|
## 🔧 Utilisation Détaillée
|
package/index.ts
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
default: typeof defaultElementGF;
|
|
5
|
-
Pajo: any;
|
|
6
|
-
__bundledModules: any;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const globalFunct = (function(global: any) {
|
|
3
|
+
const globalFunct = (function() {
|
|
10
4
|
'use strict';
|
|
11
5
|
|
|
12
6
|
|
|
13
|
-
|
|
14
|
-
|
|
15
7
|
class Pajo {
|
|
16
8
|
private static readonly PROTOCOL_REGEX = new RegExp('^[a-zA-Z]+://');
|
|
17
9
|
private static readonly DOUBLE_SLASH_REGEX = new RegExp('/+', 'g');
|
|
@@ -212,16 +204,6 @@ const globalFunct = (function(global: any) {
|
|
|
212
204
|
static toWindowsPath(path: string): string {
|
|
213
205
|
return path.replace(new RegExp('/', 'g'), '\\\\');
|
|
214
206
|
}
|
|
215
|
-
|
|
216
|
-
static exposeToGlobal(): void {
|
|
217
|
-
if (typeof window !== "undefined") {
|
|
218
|
-
window.Pajo = Pajo;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
if (typeof window !== "undefined") {
|
|
224
|
-
Pajo.exposeToGlobal();
|
|
225
207
|
}
|
|
226
208
|
|
|
227
209
|
|
|
@@ -235,29 +217,13 @@ const globalFunct = (function(global: any) {
|
|
|
235
217
|
|
|
236
218
|
const __bundledModules = globalFunctModule;
|
|
237
219
|
|
|
238
|
-
if (typeof global !== 'undefined') {
|
|
239
|
-
(global as any).default = Pajo;
|
|
240
|
-
(global as any).Pajo = Pajo;
|
|
241
|
-
(global as any).__bundledModules = __bundledModules;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
if (typeof window !== "undefined") {
|
|
245
|
-
(window as any).default = Pajo;
|
|
246
|
-
(window as any).Pajo = Pajo;
|
|
247
|
-
(window as any).__bundledModules = __bundledModules;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
220
|
if (typeof exports !== 'undefined') {
|
|
251
221
|
exports.default = Pajo;
|
|
252
222
|
exports.Pajo = Pajo;
|
|
253
223
|
}
|
|
254
224
|
return globalFunctModule;
|
|
255
225
|
|
|
256
|
-
})(
|
|
257
|
-
typeof window !== 'undefined' ? window :
|
|
258
|
-
typeof self !== 'undefined' ? self :
|
|
259
|
-
typeof globalThis !== 'undefined' ? globalThis :
|
|
260
|
-
{});
|
|
226
|
+
})();
|
|
261
227
|
|
|
262
228
|
type PajoElementTypeGF = typeof globalFunct.Pajo;
|
|
263
229
|
|
package/js/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const globalFunct = (function (
|
|
1
|
+
const globalFunct = (function () {
|
|
2
2
|
'use strict';
|
|
3
3
|
class Pajo {
|
|
4
4
|
static PROTOCOL_REGEX = new RegExp('^[a-zA-Z]+://');
|
|
@@ -177,40 +177,18 @@ const globalFunct = (function (global) {
|
|
|
177
177
|
static toWindowsPath(path) {
|
|
178
178
|
return path.replace(new RegExp('/', 'g'), '\\\\');
|
|
179
179
|
}
|
|
180
|
-
static exposeToGlobal() {
|
|
181
|
-
if (typeof window !== "undefined") {
|
|
182
|
-
window.Pajo = Pajo;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
if (typeof window !== "undefined") {
|
|
187
|
-
Pajo.exposeToGlobal();
|
|
188
180
|
}
|
|
189
181
|
const globalFunctModule = {
|
|
190
182
|
default: Pajo,
|
|
191
183
|
Pajo: Pajo,
|
|
192
184
|
};
|
|
193
185
|
const __bundledModules = globalFunctModule;
|
|
194
|
-
if (typeof global !== 'undefined') {
|
|
195
|
-
global.default = Pajo;
|
|
196
|
-
global.Pajo = Pajo;
|
|
197
|
-
global.__bundledModules = __bundledModules;
|
|
198
|
-
}
|
|
199
|
-
if (typeof window !== "undefined") {
|
|
200
|
-
window.default = Pajo;
|
|
201
|
-
window.Pajo = Pajo;
|
|
202
|
-
window.__bundledModules = __bundledModules;
|
|
203
|
-
}
|
|
204
186
|
if (typeof exports !== 'undefined') {
|
|
205
187
|
exports.default = Pajo;
|
|
206
188
|
exports.Pajo = Pajo;
|
|
207
189
|
}
|
|
208
190
|
return globalFunctModule;
|
|
209
|
-
})(
|
|
210
|
-
typeof window !== 'undefined' ? window :
|
|
211
|
-
typeof self !== 'undefined' ? self :
|
|
212
|
-
typeof globalThis !== 'undefined' ? globalThis :
|
|
213
|
-
{});
|
|
191
|
+
})();
|
|
214
192
|
const PajoElementGF = globalFunct.Pajo;
|
|
215
193
|
const defaultElementGF = globalFunct.default;
|
|
216
194
|
export { defaultElementGF as default, PajoElementGF as Pajo, };
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.0.0",
|
|
6
|
+
"version": "0.0.1-beta.0.2",
|
|
7
7
|
"description": "Pajo est une bibliothèque TypeScript légère et robuste pour la manipulation de chemins de fichiers et d'URLs. Elle offre une API unifiée et type-safe pour travailler avec des chemins de fichiers sur différentes plateformes (Windows, Linux, macOS) et pour construire des URLs de manière cohérente.",
|
|
8
8
|
"main": "index.ts",
|
|
9
9
|
"keywords": [],
|
package/web/pajo.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const globalFunct = (function (
|
|
1
|
+
const globalFunct = (function () {
|
|
2
2
|
'use strict';
|
|
3
3
|
class Pajo {
|
|
4
4
|
static PROTOCOL_REGEX = new RegExp('^[a-zA-Z]+://');
|
|
@@ -191,25 +191,11 @@ const globalFunct = (function (global) {
|
|
|
191
191
|
Pajo: Pajo,
|
|
192
192
|
};
|
|
193
193
|
const __bundledModules = globalFunctModule;
|
|
194
|
-
if (typeof global !== 'undefined') {
|
|
195
|
-
global.default = Pajo;
|
|
196
|
-
global.Pajo = Pajo;
|
|
197
|
-
global.__bundledModules = __bundledModules;
|
|
198
|
-
}
|
|
199
|
-
if (typeof window !== "undefined") {
|
|
200
|
-
window.default = Pajo;
|
|
201
|
-
window.Pajo = Pajo;
|
|
202
|
-
window.__bundledModules = __bundledModules;
|
|
203
|
-
}
|
|
204
194
|
if (typeof exports !== 'undefined') {
|
|
205
195
|
exports.default = Pajo;
|
|
206
196
|
exports.Pajo = Pajo;
|
|
207
197
|
}
|
|
208
198
|
return globalFunctModule;
|
|
209
|
-
})(
|
|
210
|
-
typeof window !== 'undefined' ? window :
|
|
211
|
-
typeof self !== 'undefined' ? self :
|
|
212
|
-
typeof globalThis !== 'undefined' ? globalThis :
|
|
213
|
-
{});
|
|
199
|
+
})();
|
|
214
200
|
const PajoElementGF = globalFunct.Pajo;
|
|
215
201
|
const defaultElementGF = globalFunct.default;
|
package/web/pajo.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let globalFunct=(
|
|
1
|
+
let globalFunct=(()=>{class t{static PROTOCOL_REGEX=new RegExp("^[a-zA-Z]+://");static DOUBLE_SLASH_REGEX=new RegExp("/+","g");static DOUBLE_BACKSLASH_REGEX=new RegExp("\\\\+","g");static TRAILING_SLASH_REGEX=new RegExp("/+$");static TRAILING_BACKSLASH_REGEX=new RegExp("\\\\+$");static LEADING_SLASH_REGEX=new RegExp("^/+");static WINDOWS_DRIVE_REGEX=new RegExp("^[a-zA-Z]:\\\\");static MIXED_SEPARATORS_REGEX=new RegExp("[\\\\/]+","g");static join(...i){if(0!==i.length){let e=i.some(t=>this.isWindowsPath(t));var s=i.filter(t=>null!=t&&0<t.trim().length).map(t=>this.normalizePathSegment(t,e));if(0!==s.length){var a=e?"\\":"/";let t=s.join(a);return e?t=t.replace(this.DOUBLE_BACKSLASH_REGEX,"\\"):(t=t.replace(this.DOUBLE_SLASH_REGEX,"/"),i[0]?.startsWith("/")&&!t.startsWith("/")&&(t="/"+t)),t||void 0}}}static joinWithHost(t,...e){var i;return t&&0!==t.trim().length?(t=t.trim().replace(this.TRAILING_SLASH_REGEX,""),t=this.PROTOCOL_REGEX.test(t)?t:"https:
|