@tachybase/requirejs 0.23.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/lib/types.d.ts ADDED
@@ -0,0 +1,322 @@
1
+ /** vim: et:ts=4:sw=4:sts=4
2
+ * @license RequireJS 2.3.6 Copyright jQuery Foundation and other contributors.
3
+ * Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
4
+ */
5
+ interface RequireModule {
6
+ /** */
7
+ config(): {};
8
+ }
9
+ interface RequireMap {
10
+ /** */
11
+ prefix: string;
12
+ /** */
13
+ name: string;
14
+ /** */
15
+ parentMap: RequireMap;
16
+ /** */
17
+ url: string;
18
+ /** */
19
+ originalName: string;
20
+ /** */
21
+ fullName: string;
22
+ }
23
+ interface RequireError extends Error {
24
+ /**
25
+ * The error ID that maps to an ID on a web page.
26
+ */
27
+ requireType: string;
28
+ /**
29
+ * Required modules.
30
+ */
31
+ requireModules: string[] | null;
32
+ /**
33
+ * The original error, if there is one (might be null).
34
+ */
35
+ originalError: Error;
36
+ }
37
+ interface RequireShim {
38
+ /**
39
+ * List of dependencies.
40
+ */
41
+ deps?: string[] | undefined;
42
+ /**
43
+ * Name the module will be exported as.
44
+ */
45
+ exports?: string | undefined;
46
+ /**
47
+ * Initialize function with all dependcies passed in,
48
+ * if the function returns a value then that value is used
49
+ * as the module export value instead of the object
50
+ * found via the 'exports' string.
51
+ * @param dependencies
52
+ * @return
53
+ */
54
+ init?: ((...dependencies: any[]) => any) | undefined;
55
+ }
56
+ interface RequireConfig {
57
+ /**
58
+ * The root path to use for all module lookups.
59
+ */
60
+ baseUrl?: string | undefined;
61
+ /**
62
+ * Path mappings for module names not found directly under
63
+ * baseUrl.
64
+ */
65
+ paths?: {
66
+ [key: string]: any;
67
+ } | undefined;
68
+ /**
69
+ * Dictionary of Shim's.
70
+ * Can be of type RequireShim or string[] of dependencies
71
+ */
72
+ shim?: {
73
+ [key: string]: RequireShim | string[];
74
+ } | undefined;
75
+ /**
76
+ * For the given module prefix, instead of loading the
77
+ * module with the given ID, substitude a different
78
+ * module ID.
79
+ *
80
+ * @example
81
+ * requirejs.config({
82
+ * map: {
83
+ * 'some/newmodule': {
84
+ * 'foo': 'foo1.2'
85
+ * },
86
+ * 'some/oldmodule': {
87
+ * 'foo': 'foo1.0'
88
+ * }
89
+ * }
90
+ * });
91
+ */
92
+ map?: {
93
+ [id: string]: {
94
+ [id: string]: string;
95
+ };
96
+ } | undefined;
97
+ /**
98
+ * Allows pointing multiple module IDs to a module ID that contains a bundle of modules.
99
+ *
100
+ * @example
101
+ * requirejs.config({
102
+ * bundles: {
103
+ * 'primary': ['main', 'util', 'text', 'text!template.html'],
104
+ * 'secondary': ['text!secondary.html']
105
+ * }
106
+ * });
107
+ */
108
+ bundles?: {
109
+ [key: string]: string[];
110
+ } | undefined;
111
+ /**
112
+ * AMD configurations, use module.config() to access in
113
+ * define() functions
114
+ */
115
+ config?: {
116
+ [id: string]: {};
117
+ } | undefined;
118
+ /**
119
+ * Configures loading modules from CommonJS packages.
120
+ */
121
+ packages?: {} | undefined;
122
+ /**
123
+ * The number of seconds to wait before giving up on loading
124
+ * a script. The default is 7 seconds.
125
+ */
126
+ waitSeconds?: number | undefined;
127
+ /**
128
+ * A name to give to a loading context. This allows require.js
129
+ * to load multiple versions of modules in a page, as long as
130
+ * each top-level require call specifies a unique context string.
131
+ */
132
+ context?: string | undefined;
133
+ /**
134
+ * An array of dependencies to load.
135
+ */
136
+ deps?: string[] | undefined;
137
+ /**
138
+ * A function to pass to require that should be require after
139
+ * deps have been loaded.
140
+ * @param modules
141
+ */
142
+ callback?: ((...modules: any[]) => void) | undefined;
143
+ /**
144
+ * If set to true, an error will be thrown if a script loads
145
+ * that does not call define() or have shim exports string
146
+ * value that can be checked.
147
+ */
148
+ enforceDefine?: boolean | undefined;
149
+ /**
150
+ * If set to true, document.createElementNS() will be used
151
+ * to create script elements.
152
+ */
153
+ xhtml?: boolean | undefined;
154
+ /**
155
+ * Extra query string arguments appended to URLs that RequireJS
156
+ * uses to fetch resources. Most useful to cache bust when
157
+ * the browser or server is not configured correctly.
158
+ *
159
+ * As of RequireJS 2.2.0, urlArgs can be a function. If a
160
+ * function, it will receive the module ID and the URL as
161
+ * parameters, and it should return a string that will be added
162
+ * to the end of the URL. Return an empty string if no args.
163
+ * Be sure to take care of adding the '?' or '&' depending on
164
+ * the existing state of the URL.
165
+ *
166
+ * @example
167
+ *
168
+ * urlArgs: "bust=" + (new Date()).getTime()
169
+ *
170
+ * @example
171
+ *
172
+ * requirejs.config({
173
+ * urlArgs: function(id, url) {
174
+ * var args = 'v=1';
175
+ * if (url.indexOf('view.html') !== -1) {
176
+ * args = 'v=2'
177
+ * }
178
+ *
179
+ * return (url.indexOf('?') === -1 ? '?' : '&') + args;
180
+ * }
181
+ * });
182
+ */
183
+ urlArgs?: string | ((id: string, url: string) => string) | undefined;
184
+ /**
185
+ * Specify the value for the type="" attribute used for script
186
+ * tags inserted into the document by RequireJS. Default is
187
+ * "text/javascript". To use Firefox's JavasScript 1.8
188
+ * features, use "text/javascript;version=1.8".
189
+ */
190
+ scriptType?: string | undefined;
191
+ /**
192
+ * If set to true, skips the data-main attribute scanning done
193
+ * to start module loading. Useful if RequireJS is embedded in
194
+ * a utility library that may interact with other RequireJS
195
+ * library on the page, and the embedded version should not do
196
+ * data-main loading.
197
+ */
198
+ skipDataMain?: boolean | undefined;
199
+ /**
200
+ * Allow extending requirejs to support Subresource Integrity
201
+ * (SRI).
202
+ */
203
+ onNodeCreated?: ((node: HTMLScriptElement, config: RequireConfig, moduleName: string, url: string) => void) | undefined;
204
+ }
205
+ export interface Require {
206
+ /**
207
+ * Configure require.js
208
+ */
209
+ config(config: RequireConfig): Require;
210
+ /**
211
+ * CommonJS require call
212
+ * @param module Module to load
213
+ * @return The loaded module
214
+ */
215
+ (module: string): any;
216
+ /**
217
+ * Start the main app logic.
218
+ * Callback is optional.
219
+ * Can alternatively use deps and callback.
220
+ * @param modules Required modules to load.
221
+ */
222
+ (modules: string[]): void;
223
+ /**
224
+ * @see Require()
225
+ * @param ready Called when required modules are ready.
226
+ */
227
+ (modules: string[], ready: Function): void;
228
+ /**
229
+ * @see http://requirejs.org/docs/api.html#errbacks
230
+ * @param ready Called when required modules are ready.
231
+ */
232
+ (modules: string[], ready: Function, errback: Function): void;
233
+ /**
234
+ * Generate URLs from require module
235
+ * @param module Module to URL
236
+ * @return URL string
237
+ */
238
+ toUrl(module: string): string;
239
+ /**
240
+ * Returns true if the module has already been loaded and defined.
241
+ * @param module Module to check
242
+ */
243
+ defined(module: string): boolean;
244
+ /**
245
+ * Returns true if the module has already been requested or is in the process of loading and should be available at some point.
246
+ * @param module Module to check
247
+ */
248
+ specified(module: string): boolean;
249
+ /**
250
+ * On Error override
251
+ * @param err
252
+ */
253
+ onError(err: RequireError, errback?: (err: RequireError) => void): void;
254
+ /**
255
+ * Undefine a module
256
+ * @param module Module to undefine.
257
+ */
258
+ undef(module: string): void;
259
+ /**
260
+ * Semi-private function, overload in special instance of undef()
261
+ */
262
+ onResourceLoad(context: object, map: RequireMap, depArray: RequireMap[]): void;
263
+ }
264
+ export interface RequireDefine {
265
+ /**
266
+ * Define Simple Name/Value Pairs
267
+ * @param config Dictionary of Named/Value pairs for the config.
268
+ */
269
+ (config: {
270
+ [key: string]: any;
271
+ }): void;
272
+ /**
273
+ * Define function.
274
+ * @param func: The function module.
275
+ */
276
+ (func: () => any): void;
277
+ /**
278
+ * Define function with dependencies.
279
+ * @param deps List of dependencies module IDs.
280
+ * @param ready Callback function when the dependencies are loaded.
281
+ * callback param deps module dependencies
282
+ * callback return module definition
283
+ */
284
+ (deps: string[], ready: Function): void;
285
+ /**
286
+ * Define module with simplified CommonJS wrapper.
287
+ * @param ready
288
+ * callback require requirejs instance
289
+ * callback exports exports object
290
+ * callback module module
291
+ * callback return module definition
292
+ */
293
+ (ready: (require: Require, exports: {
294
+ [key: string]: any;
295
+ }, module: RequireModule) => any): void;
296
+ /**
297
+ * Define a module with a name and dependencies.
298
+ * @param name The name of the module.
299
+ * @param deps List of dependencies module IDs.
300
+ * @param ready Callback function when the dependencies are loaded.
301
+ * callback deps module dependencies
302
+ * callback return module definition
303
+ */
304
+ (name: string, deps: string[], ready: Function): void;
305
+ /**
306
+ * Define a module with a name.
307
+ * @param name The name of the module.
308
+ * @param ready Callback function when the dependencies are loaded.
309
+ * callback return module definition
310
+ */
311
+ (name: string, ready: Function): void;
312
+ /**
313
+ * Used to allow a clear indicator that a global define function (as needed for script src browser loading) conforms
314
+ * to the AMD API, any global define function SHOULD have a property called "amd" whose value is an object.
315
+ * This helps avoid conflict with any other existing JavaScript code that could have defined a define() function
316
+ * that does not conform to the AMD API.
317
+ * define.amd.jQuery is specific to jQuery and indicates that the loader is able to account for multiple version
318
+ * of jQuery being loaded simultaneously.
319
+ */
320
+ amd: object;
321
+ }
322
+ export {};
package/lib/types.js ADDED
@@ -0,0 +1,19 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var types_exports = {};
15
+ module.exports = __toCommonJS(types_exports);
16
+ /** vim: et:ts=4:sw=4:sts=4
17
+ * @license RequireJS 2.3.6 Copyright jQuery Foundation and other contributors.
18
+ * Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
19
+ */
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@tachybase/requirejs",
3
+ "version": "0.23.8",
4
+ "license": "Apache-2.0",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "dependencies": {},
8
+ "devDependencies": {},
9
+ "scripts": {
10
+ "build": "tachybase-build --no-dts @tachybase/requirejs"
11
+ }
12
+ }