@itee/tasks 1.0.13 → 1.1.1
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 +10 -0
- package/configs/builds/build.conf.mjs +3 -1
- package/package.json +2 -3
- package/sources/_utils.mjs +338 -126
- package/sources/builds/build.task.mjs +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
# [v1.1.1](https://github.com/Itee/tasks/compare/v1.1.0...v1.1.1) (2026-01-15)
|
|
2
|
+
|
|
3
|
+
# [v1.1.0](https://github.com/Itee/tasks/compare/v1.0.13...v1.1.0) (2026-01-15)
|
|
4
|
+
|
|
5
|
+
## ✨ New Features
|
|
6
|
+
- [`f6c941a`](https://github.com/Itee/tasks/commit/f6c941a) (builds) add default config for build task
|
|
7
|
+
|
|
8
|
+
## 🐛 Bug Fixes
|
|
9
|
+
- [`231bd19`](https://github.com/Itee/tasks/commit/231bd19) (utils) fix strict usage with complex options
|
|
10
|
+
|
|
1
11
|
# [v1.0.13](https://github.com/Itee/tasks/compare/v1.0.12...v1.0.13) (2026-01-15)
|
|
2
12
|
|
|
3
13
|
# [v1.0.12](https://github.com/Itee/itee-tasks/compare/v1.0.11...v1.0.12) (2026-01-14)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itee/tasks",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Allow to manage all commons itee gulp tasks into one place ",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"itee",
|
|
@@ -49,8 +49,7 @@
|
|
|
49
49
|
"tests:units:run:back": "gulp run-unit-tests-for-backend",
|
|
50
50
|
"tests:units:run:front": "gulp run-unit-tests-for-frontend",
|
|
51
51
|
"release": "gulp release",
|
|
52
|
-
"semantic-release": "semantic-release --dry-run --no-ci"
|
|
53
|
-
"postversion": "gulp build"
|
|
52
|
+
"semantic-release": "semantic-release --dry-run --no-ci"
|
|
54
53
|
},
|
|
55
54
|
"devDependencies": {
|
|
56
55
|
"@semantic-release/changelog": "^6.0.3",
|
package/sources/_utils.mjs
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import commonjs from '@rollup/plugin-commonjs'
|
|
2
|
+
import nodeResolve from '@rollup/plugin-node-resolve'
|
|
3
|
+
import terser from '@rollup/plugin-terser'
|
|
1
4
|
import colors from 'ansi-colors'
|
|
2
5
|
import childProcess from 'child_process'
|
|
3
6
|
import log from 'fancy-log'
|
|
7
|
+
import figlet from 'figlet'
|
|
4
8
|
import { glob } from 'glob'
|
|
5
9
|
import {
|
|
6
10
|
parallel,
|
|
@@ -21,6 +25,7 @@ import {
|
|
|
21
25
|
relative,
|
|
22
26
|
} from 'node:path'
|
|
23
27
|
import { fileURLToPath } from 'node:url'
|
|
28
|
+
import replace from 'rollup-plugin-re'
|
|
24
29
|
|
|
25
30
|
const {
|
|
26
31
|
red,
|
|
@@ -31,124 +36,13 @@ const {
|
|
|
31
36
|
cyan
|
|
32
37
|
} = colors
|
|
33
38
|
|
|
34
|
-
///
|
|
35
|
-
|
|
36
|
-
function createDirectoryIfNotExist( directoryPath ) {
|
|
37
|
-
|
|
38
|
-
if ( !existsSync( directoryPath ) ) {
|
|
39
|
-
log( 'Creating', green( directoryPath ) )
|
|
40
|
-
mkdirSync( directoryPath, { recursive: true } )
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function getJsonFrom( path ) {
|
|
46
|
-
|
|
47
|
-
const buffer = readFileSync( path )
|
|
48
|
-
return JSON.parse( buffer.toString() )
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function getTaskConfigurationPathFor( filename ) {
|
|
53
|
-
|
|
54
|
-
// Get relative path of the task between internal or user defined
|
|
55
|
-
let relativeTaskPath = filename.includes( iteePackageSourcesDirectory )
|
|
56
|
-
? relative( iteePackageSourcesDirectory, filename )
|
|
57
|
-
: relative( packageTasksDirectory, filename )
|
|
58
|
-
|
|
59
|
-
// Generate all possible config file path depending on file extension and default or user defined
|
|
60
|
-
const terminalExtension = extname( relativeTaskPath )
|
|
61
|
-
const searchValue = relativeTaskPath.includes( '.task.' ) ? `.task${ terminalExtension }` : terminalExtension
|
|
62
|
-
const replaceValues = [
|
|
63
|
-
'.conf.json',
|
|
64
|
-
'.conf.js',
|
|
65
|
-
'.conf.mjs',
|
|
66
|
-
]
|
|
67
|
-
|
|
68
|
-
const packageConfigurationPaths = []
|
|
69
|
-
const defaultConfigurationPaths = []
|
|
70
|
-
|
|
71
|
-
for ( const replaceValue of replaceValues ) {
|
|
72
|
-
const configurationLocation = relativeTaskPath.replace( searchValue, replaceValue )
|
|
73
|
-
const packageConfigurationPath = join( packageTasksConfigurationsDirectory, configurationLocation )
|
|
74
|
-
const defaultConfigurationPath = join( iteePackageConfigurationsDirectory, configurationLocation )
|
|
75
|
-
|
|
76
|
-
packageConfigurationPaths.push( packageConfigurationPath )
|
|
77
|
-
defaultConfigurationPaths.push( defaultConfigurationPath )
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Take care of the configuration search order (package first then default !)
|
|
81
|
-
const configurationPaths = [ ...packageConfigurationPaths, ...defaultConfigurationPaths ]
|
|
82
|
-
let configurationPath = undefined
|
|
83
|
-
|
|
84
|
-
// Looking for existing configuration file
|
|
85
|
-
for ( const packageConfigurationPath of configurationPaths ) {
|
|
86
|
-
|
|
87
|
-
if ( existsSync( packageConfigurationPath ) ) {
|
|
88
|
-
configurationPath = packageConfigurationPath
|
|
89
|
-
break
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Else throw an error
|
|
95
|
-
if ( !configurationPath ) {
|
|
96
|
-
throw new Error( `Unable to find configuration in package configuration paths ${ configurationPaths.join( ', ' ) }.` )
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return configurationPath
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
async function getTaskConfigurationFor( filename ) {
|
|
104
|
-
|
|
105
|
-
const configurationFilePath = getTaskConfigurationPathFor( filename )
|
|
106
|
-
|
|
107
|
-
log( `Loading configuration from ${ cyan( configurationFilePath ) }` )
|
|
39
|
+
/// Debugging
|
|
108
40
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
try {
|
|
112
|
-
|
|
113
|
-
if ( extname( configurationFilePath ) === '.json' ) {
|
|
114
|
-
|
|
115
|
-
configuration = getJsonFrom( configurationFilePath )
|
|
116
|
-
|
|
117
|
-
} else {
|
|
118
|
-
|
|
119
|
-
const moduleData = await import( configurationFilePath )
|
|
120
|
-
configuration = moduleData.default
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
} catch ( e ) {
|
|
125
|
-
|
|
126
|
-
log( red( e ) )
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return configuration
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function createFile( filePath, fileContent ) {
|
|
135
|
-
|
|
136
|
-
log( 'Creating', green( filePath ) )
|
|
137
|
-
writeFileSync( filePath, fileContent )
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function getFilesFrom( globPattern, filter = ( any ) => true ) {
|
|
142
|
-
|
|
143
|
-
return glob.sync( globPattern )
|
|
144
|
-
.map( filePath => normalize( filePath ) )
|
|
145
|
-
.filter( filter )
|
|
41
|
+
const isDebugging = ( process.env.RUNNER_DEBUG && process.env.RUNNER_DEBUG === '1' )
|
|
146
42
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
///
|
|
43
|
+
/// Package paths and data
|
|
150
44
|
|
|
151
|
-
function
|
|
45
|
+
function _getPackageRootDirectory() {
|
|
152
46
|
|
|
153
47
|
let __dirname
|
|
154
48
|
|
|
@@ -167,13 +61,13 @@ function getPackageRootDirectory() {
|
|
|
167
61
|
|
|
168
62
|
}
|
|
169
63
|
|
|
170
|
-
const iteePackageRootDirectory =
|
|
64
|
+
const iteePackageRootDirectory = _getPackageRootDirectory()
|
|
171
65
|
const iteePackageJsonPath = join( iteePackageRootDirectory, 'package.json' )
|
|
172
66
|
const iteePackageConfigurationsDirectory = join( iteePackageRootDirectory, 'configs' )
|
|
173
67
|
const iteePackageNodeModulesDirectory = join( iteePackageRootDirectory, 'node_modules' )
|
|
174
68
|
const iteePackageSourcesDirectory = join( iteePackageRootDirectory, 'sources' )
|
|
175
69
|
|
|
176
|
-
const packageRootDirectory = iteePackageRootDirectory.includes( 'node_modules' ) ? join( iteePackageRootDirectory, '
|
|
70
|
+
const packageRootDirectory = iteePackageRootDirectory.includes( 'node_modules' ) ? join( iteePackageRootDirectory, '../../../' ) : iteePackageRootDirectory
|
|
177
71
|
const packageTasksDirectory = join( packageRootDirectory, '.tasks' )
|
|
178
72
|
const packageTasksConfigurationsDirectory = join( packageTasksDirectory, 'configs' )
|
|
179
73
|
const packageNodeModulesDirectory = join( packageRootDirectory, 'node_modules' )
|
|
@@ -196,6 +90,8 @@ const packageJson = getJsonFrom( packageJsonPath )
|
|
|
196
90
|
const packageName = packageJson.name
|
|
197
91
|
const packageVersion = packageJson.version
|
|
198
92
|
const packageDescription = packageJson.description
|
|
93
|
+
const packageAuthor = packageJson.author
|
|
94
|
+
const packageLicense = packageJson.license
|
|
199
95
|
|
|
200
96
|
function getPrettyPackageName( separator = ' ' ) {
|
|
201
97
|
|
|
@@ -257,7 +153,40 @@ function getPrettyNpmVersion() {
|
|
|
257
153
|
|
|
258
154
|
}
|
|
259
155
|
|
|
260
|
-
///
|
|
156
|
+
/// File system Management
|
|
157
|
+
|
|
158
|
+
function createDirectoryIfNotExist( directoryPath ) {
|
|
159
|
+
|
|
160
|
+
if ( !existsSync( directoryPath ) ) {
|
|
161
|
+
log( 'Creating', green( directoryPath ) )
|
|
162
|
+
mkdirSync( directoryPath, { recursive: true } )
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function getJsonFrom( path ) {
|
|
168
|
+
|
|
169
|
+
const buffer = readFileSync( path )
|
|
170
|
+
return JSON.parse( buffer.toString() )
|
|
171
|
+
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function createFile( filePath, fileContent ) {
|
|
175
|
+
|
|
176
|
+
log( 'Creating', green( filePath ) )
|
|
177
|
+
writeFileSync( filePath, fileContent )
|
|
178
|
+
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function getFilesFrom( globPattern, filter = ( any ) => true ) {
|
|
182
|
+
|
|
183
|
+
return glob.sync( globPattern )
|
|
184
|
+
.map( filePath => normalize( filePath ) )
|
|
185
|
+
.filter( filter )
|
|
186
|
+
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/// Task Management
|
|
261
190
|
|
|
262
191
|
async function getTasksFrom( taskFiles = [] ) {
|
|
263
192
|
|
|
@@ -310,10 +239,281 @@ async function parallelizeTasksFrom( taskFiles = [] ) {
|
|
|
310
239
|
|
|
311
240
|
}
|
|
312
241
|
|
|
313
|
-
///
|
|
242
|
+
/// Task configuration management
|
|
243
|
+
|
|
244
|
+
function getTaskConfigurationPathFor( filename ) {
|
|
245
|
+
|
|
246
|
+
// Get relative path of the task between internal or user defined
|
|
247
|
+
let relativeTaskPath = filename.includes( iteePackageSourcesDirectory )
|
|
248
|
+
? relative( iteePackageSourcesDirectory, filename )
|
|
249
|
+
: relative( packageTasksDirectory, filename )
|
|
250
|
+
|
|
251
|
+
// Generate all possible config file path depending on file extension and default or user defined
|
|
252
|
+
const terminalExtension = extname( relativeTaskPath )
|
|
253
|
+
const searchValue = relativeTaskPath.includes( '.task.' ) ? `.task${ terminalExtension }` : terminalExtension
|
|
254
|
+
const replaceValues = [
|
|
255
|
+
'.conf.json',
|
|
256
|
+
'.conf.js',
|
|
257
|
+
'.conf.mjs',
|
|
258
|
+
]
|
|
259
|
+
|
|
260
|
+
const packageConfigurationPaths = []
|
|
261
|
+
const defaultConfigurationPaths = []
|
|
262
|
+
|
|
263
|
+
for ( const replaceValue of replaceValues ) {
|
|
264
|
+
const configurationLocation = relativeTaskPath.replace( searchValue, replaceValue )
|
|
265
|
+
const packageConfigurationPath = join( packageTasksConfigurationsDirectory, configurationLocation )
|
|
266
|
+
const defaultConfigurationPath = join( iteePackageConfigurationsDirectory, configurationLocation )
|
|
267
|
+
|
|
268
|
+
packageConfigurationPaths.push( packageConfigurationPath )
|
|
269
|
+
defaultConfigurationPaths.push( defaultConfigurationPath )
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Take care of the configuration search order (package first then default !)
|
|
273
|
+
const configurationPaths = [ ...packageConfigurationPaths, ...defaultConfigurationPaths ]
|
|
274
|
+
let configurationPath = undefined
|
|
275
|
+
|
|
276
|
+
// Looking for existing configuration file
|
|
277
|
+
for ( const packageConfigurationPath of configurationPaths ) {
|
|
278
|
+
|
|
279
|
+
if ( existsSync( packageConfigurationPath ) ) {
|
|
280
|
+
configurationPath = packageConfigurationPath
|
|
281
|
+
break
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Else throw an error
|
|
287
|
+
if ( !configurationPath ) {
|
|
288
|
+
throw new Error( `Unable to find configuration in package configuration paths ${ configurationPaths.join( ', ' ) }.` )
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return configurationPath
|
|
292
|
+
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
async function getTaskConfigurationFor( filename ) {
|
|
296
|
+
|
|
297
|
+
const configurationFilePath = getTaskConfigurationPathFor( filename )
|
|
298
|
+
|
|
299
|
+
log( `Loading configuration from ${ cyan( configurationFilePath ) }` )
|
|
300
|
+
|
|
301
|
+
let configuration = null
|
|
302
|
+
|
|
303
|
+
try {
|
|
304
|
+
|
|
305
|
+
if ( extname( configurationFilePath ) === '.json' ) {
|
|
306
|
+
|
|
307
|
+
configuration = getJsonFrom( configurationFilePath )
|
|
308
|
+
|
|
309
|
+
} else {
|
|
310
|
+
|
|
311
|
+
const moduleData = await import( configurationFilePath )
|
|
312
|
+
configuration = moduleData.default
|
|
313
|
+
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
} catch ( e ) {
|
|
317
|
+
|
|
318
|
+
log( red( e ) )
|
|
319
|
+
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
return configuration
|
|
323
|
+
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/// Build management
|
|
327
|
+
|
|
328
|
+
function getPrettyFormatForBanner( format ) {
|
|
329
|
+
|
|
330
|
+
let prettyFormat = ''
|
|
331
|
+
|
|
332
|
+
switch ( format ) {
|
|
333
|
+
|
|
334
|
+
case 'cjs':
|
|
335
|
+
prettyFormat = 'CommonJs'
|
|
336
|
+
break
|
|
337
|
+
|
|
338
|
+
case 'esm':
|
|
339
|
+
prettyFormat = 'EsModule'
|
|
340
|
+
break
|
|
341
|
+
|
|
342
|
+
case 'iife':
|
|
343
|
+
prettyFormat = 'Standalone'
|
|
344
|
+
break
|
|
345
|
+
|
|
346
|
+
case 'umd':
|
|
347
|
+
prettyFormat = 'Universal'
|
|
348
|
+
break
|
|
349
|
+
|
|
350
|
+
default:
|
|
351
|
+
throw new RangeError( `Invalid switch parameter: ${ format }` )
|
|
352
|
+
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
return prettyFormat
|
|
356
|
+
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function convertBannerIntoComment( banner ) {
|
|
360
|
+
|
|
361
|
+
let bannerCommented = '/**\n'
|
|
362
|
+
bannerCommented += ' * '
|
|
363
|
+
bannerCommented += banner.replaceAll( '\n', '\n * ' )
|
|
364
|
+
bannerCommented += '\n'
|
|
365
|
+
bannerCommented += ` * @desc ${ packageDescription }\n`
|
|
366
|
+
bannerCommented += ' * @author [Tristan Valcke]{@link https://github.com/Itee}\n'
|
|
367
|
+
bannerCommented += ' * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}\n'
|
|
368
|
+
bannerCommented += ' * \n'
|
|
369
|
+
bannerCommented += ' */'
|
|
370
|
+
|
|
371
|
+
return bannerCommented
|
|
372
|
+
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
function computeBannerFor( format ) {
|
|
376
|
+
|
|
377
|
+
const packageName = getPrettyPackageName( '.' )
|
|
378
|
+
const packageVersion = getPrettyPackageVersion()
|
|
379
|
+
const prettyFormat = getPrettyFormatForBanner( format )
|
|
380
|
+
|
|
381
|
+
const figText = figlet.textSync(
|
|
382
|
+
`${ packageName } ${ packageVersion } - ${ prettyFormat }`,
|
|
383
|
+
{
|
|
384
|
+
font: 'Tmplr',
|
|
385
|
+
horizontalLayout: 'default',
|
|
386
|
+
verticalLayout: 'default',
|
|
387
|
+
whitespaceBreak: true,
|
|
388
|
+
}
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
return convertBannerIntoComment( figText )
|
|
392
|
+
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function computeIntroFor( requestPackages ) {
|
|
396
|
+
|
|
397
|
+
return ''
|
|
398
|
+
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Will create an appropriate configuration object for rollup, related to the given arguments.
|
|
403
|
+
*
|
|
404
|
+
* @generator
|
|
405
|
+
* @param options
|
|
406
|
+
* @return {Array.<json>} An array of rollup configuration
|
|
407
|
+
*/
|
|
408
|
+
function createRollupConfigs( options = undefined ) {
|
|
409
|
+
|
|
410
|
+
const _options = options ? options : {
|
|
411
|
+
input: join( packageSourcesDirectory, `${ packageName }.js` ),
|
|
412
|
+
output: packageBuildsDirectory,
|
|
413
|
+
formats: [ 'esm', 'cjs', 'iife' ],
|
|
414
|
+
envs: [ 'dev', 'prod' ],
|
|
415
|
+
treeshake: true
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
const {
|
|
419
|
+
input,
|
|
420
|
+
output,
|
|
421
|
+
formats,
|
|
422
|
+
envs,
|
|
423
|
+
treeshake
|
|
424
|
+
} = _options
|
|
425
|
+
const name = getPrettyPackageName( '.' )
|
|
426
|
+
const fileName = basename( input, '.js' )
|
|
427
|
+
|
|
428
|
+
const configs = []
|
|
429
|
+
|
|
430
|
+
for ( let formatIndex = 0, numberOfFormats = formats.length ; formatIndex < numberOfFormats ; ++formatIndex ) {
|
|
431
|
+
|
|
432
|
+
for ( let envIndex = 0, numberOfEnvs = envs.length ; envIndex < numberOfEnvs ; envIndex++ ) {
|
|
433
|
+
|
|
434
|
+
const env = envs[ envIndex ]
|
|
435
|
+
const isProd = ( env.includes( 'prod' ) )
|
|
436
|
+
const format = formats[ formatIndex ]
|
|
437
|
+
const outputPath = ( isProd ) ? join( output, `${ fileName }.${ format }.min.js` ) : join( output, `${ fileName }.${ format }.js` )
|
|
438
|
+
|
|
439
|
+
configs.push( {
|
|
440
|
+
input: input,
|
|
441
|
+
external: ( format === 'cjs' ) ? [
|
|
442
|
+
'fs'
|
|
443
|
+
] : [],
|
|
444
|
+
plugins: [
|
|
445
|
+
replace( {
|
|
446
|
+
defines: {
|
|
447
|
+
IS_REMOVE_ON_BUILD: false,
|
|
448
|
+
IS_BACKEND_SPECIFIC: ( format === 'cjs' )
|
|
449
|
+
}
|
|
450
|
+
} ),
|
|
451
|
+
commonjs( {
|
|
452
|
+
include: 'node_modules/**'
|
|
453
|
+
} ),
|
|
454
|
+
nodeResolve( {
|
|
455
|
+
preferBuiltins: true
|
|
456
|
+
} ),
|
|
457
|
+
isProd && terser()
|
|
458
|
+
],
|
|
459
|
+
onwarn: ( {
|
|
460
|
+
loc,
|
|
461
|
+
frame,
|
|
462
|
+
message
|
|
463
|
+
} ) => {
|
|
464
|
+
|
|
465
|
+
// Ignore some errors
|
|
466
|
+
if ( message.includes( 'Circular dependency' ) ) { return }
|
|
467
|
+
if ( message.includes( 'plugin uglify is deprecated' ) ) { return }
|
|
468
|
+
|
|
469
|
+
if ( loc ) {
|
|
470
|
+
process.stderr.write( `/!\\ ${ loc.file } (${ loc.line }:${ loc.column }) ${ frame } ${ message }\n` )
|
|
471
|
+
} else {
|
|
472
|
+
process.stderr.write( `/!\\ ${ message }\n` )
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
},
|
|
476
|
+
treeshake: treeshake,
|
|
477
|
+
output: {
|
|
478
|
+
// core options
|
|
479
|
+
file: outputPath,
|
|
480
|
+
format: format,
|
|
481
|
+
name: name,
|
|
482
|
+
globals: {},
|
|
483
|
+
|
|
484
|
+
// advanced options
|
|
485
|
+
paths: {},
|
|
486
|
+
banner: ( isProd ) ? '' : computeBannerFor( format ),
|
|
487
|
+
footer: '',
|
|
488
|
+
intro: ( !isProd && format === 'iife' ) ? computeIntroFor() : '',
|
|
489
|
+
outro: '',
|
|
490
|
+
sourcemap: !isProd,
|
|
491
|
+
interop: 'auto',
|
|
492
|
+
|
|
493
|
+
// danger zone
|
|
494
|
+
exports: 'auto',
|
|
495
|
+
amd: {},
|
|
496
|
+
indent: '\t',
|
|
497
|
+
strict: true
|
|
498
|
+
}
|
|
499
|
+
} )
|
|
500
|
+
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
return configs
|
|
506
|
+
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/// Log Management
|
|
314
510
|
|
|
315
511
|
function logLoadingTask( filename ) {
|
|
316
512
|
|
|
513
|
+
if ( !isDebugging ) {
|
|
514
|
+
return
|
|
515
|
+
}
|
|
516
|
+
|
|
317
517
|
const taskPath = relative( packageRootDirectory, filename )
|
|
318
518
|
const taskName = basename( filename, '.task.mjs' )
|
|
319
519
|
|
|
@@ -365,13 +565,6 @@ class Indenter {
|
|
|
365
565
|
///
|
|
366
566
|
|
|
367
567
|
export {
|
|
368
|
-
createDirectoryIfNotExist,
|
|
369
|
-
getJsonFrom,
|
|
370
|
-
getTaskConfigurationPathFor,
|
|
371
|
-
getTaskConfigurationFor,
|
|
372
|
-
createFile,
|
|
373
|
-
getFilesFrom,
|
|
374
|
-
|
|
375
568
|
iteePackageRootDirectory,
|
|
376
569
|
iteePackageJsonPath,
|
|
377
570
|
iteePackageConfigurationsDirectory,
|
|
@@ -394,18 +587,37 @@ export {
|
|
|
394
587
|
packageDocsDirectory,
|
|
395
588
|
packageTutorialsDirectory,
|
|
396
589
|
packageJsonPath,
|
|
590
|
+
|
|
397
591
|
packageJson,
|
|
398
592
|
packageName,
|
|
399
593
|
packageVersion,
|
|
400
594
|
packageDescription,
|
|
595
|
+
packageAuthor,
|
|
596
|
+
packageLicense,
|
|
401
597
|
getPrettyPackageName,
|
|
402
598
|
getPrettyPackageVersion,
|
|
403
599
|
getPrettyNodeVersion,
|
|
404
600
|
getPrettyNpmVersion,
|
|
405
601
|
|
|
602
|
+
|
|
603
|
+
createDirectoryIfNotExist,
|
|
604
|
+
getJsonFrom,
|
|
605
|
+
createFile,
|
|
606
|
+
getFilesFrom,
|
|
607
|
+
|
|
406
608
|
getTasksFrom,
|
|
407
609
|
serializeTasksFrom,
|
|
408
610
|
parallelizeTasksFrom,
|
|
611
|
+
|
|
612
|
+
getTaskConfigurationPathFor,
|
|
613
|
+
getTaskConfigurationFor,
|
|
614
|
+
|
|
615
|
+
getPrettyFormatForBanner,
|
|
616
|
+
convertBannerIntoComment,
|
|
617
|
+
computeBannerFor,
|
|
618
|
+
computeIntroFor,
|
|
619
|
+
createRollupConfigs,
|
|
620
|
+
|
|
409
621
|
logLoadingTask,
|
|
410
622
|
|
|
411
623
|
IndenterFactory as Indenter
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import colors
|
|
2
|
-
import log
|
|
1
|
+
import colors from 'ansi-colors'
|
|
2
|
+
import log from 'fancy-log'
|
|
3
3
|
import { basename } from 'node:path'
|
|
4
|
-
import { rollup }
|
|
4
|
+
import { rollup } from 'rollup'
|
|
5
5
|
import {
|
|
6
6
|
getTaskConfigurationFor,
|
|
7
7
|
logLoadingTask
|
|
8
|
-
}
|
|
8
|
+
} from '../_utils.mjs'
|
|
9
9
|
|
|
10
10
|
logLoadingTask( import.meta.filename )
|
|
11
11
|
|