@rindo/core 3.1.0 → 3.2.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/cli/index.cjs +65 -31
- package/cli/index.js +65 -31
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +63 -12
- package/compiler/rindo.min.js +2 -2
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +2 -2
- package/internal/app-data/package.json +1 -1
- package/internal/client/css-shim.js +1 -1
- package/internal/client/dom.js +1 -1
- package/internal/client/index.js +1 -1
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/client/patch-esm.js +1 -1
- package/internal/client/shadow-css.js +1 -1
- package/internal/hydrate/package.json +1 -1
- package/internal/package.json +1 -1
- package/internal/rindo-private.d.ts +17 -0
- package/internal/rindo-public-compiler.d.ts +53 -1
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +1 -1
- package/mock-doc/index.js +1 -1
- package/mock-doc/package.json +1 -1
- package/package.json +2 -2
- package/screenshot/package.json +1 -1
- package/sys/node/index.js +9 -6
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +2 -2
- package/testing/jest-preset.js +1 -1
- package/testing/package.json +1 -1
package/cli/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Rindo CLI (CommonJS) v3.
|
|
2
|
+
Rindo CLI (CommonJS) v3.2.0 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
@@ -536,12 +536,23 @@ const CLI_FLAG_ALIASES = {
|
|
|
536
536
|
h: 'help',
|
|
537
537
|
p: 'port',
|
|
538
538
|
v: 'version',
|
|
539
|
+
// JEST SPECIFIC CLI FLAGS
|
|
540
|
+
// these are defined in
|
|
541
|
+
// https://github.com/facebook/jest/blob/4156f86/packages/jest-cli/src/args.ts
|
|
542
|
+
b: 'bail',
|
|
543
|
+
e: 'expand',
|
|
544
|
+
f: 'onlyFailures',
|
|
545
|
+
i: 'runInBand',
|
|
546
|
+
o: 'onlyChanged',
|
|
547
|
+
t: 'testNamePattern',
|
|
548
|
+
u: 'updateSnapshot',
|
|
549
|
+
w: 'maxWorkers',
|
|
539
550
|
};
|
|
540
551
|
/**
|
|
541
552
|
* A regular expression which can be used to match a CLI flag for one of our
|
|
542
553
|
* short aliases.
|
|
543
554
|
*/
|
|
544
|
-
const CLI_FLAG_REGEX = new RegExp(`^-[
|
|
555
|
+
const CLI_FLAG_REGEX = new RegExp(`^-[chpvbewofitu]{1}$`);
|
|
545
556
|
/**
|
|
546
557
|
* Helper function for initializing a `ConfigFlags` object. Provide any overrides
|
|
547
558
|
* for default values and off you go!
|
|
@@ -586,13 +597,6 @@ const parseFlags = (args) => {
|
|
|
586
597
|
flags.args.splice(i, 1);
|
|
587
598
|
}
|
|
588
599
|
}
|
|
589
|
-
// to find unknown / unrecognized arguments we filter `args`, including only
|
|
590
|
-
// arguments whose normalized form is not found in `knownArgs`. `knownArgs`
|
|
591
|
-
// is populated during the call to `parseArgs` above. For arguments like
|
|
592
|
-
// `--foobar` the string `"--foobar"` will be added, while for more
|
|
593
|
-
// complicated arguments like `--bizBoz=bop` or `--bizBoz bop` just the
|
|
594
|
-
// string `"--bizBoz"` will be added.
|
|
595
|
-
flags.unknownArgs = flags.args.filter((arg) => !flags.knownArgs.includes(parseEqualsArg(arg)[0]));
|
|
596
600
|
return flags;
|
|
597
601
|
};
|
|
598
602
|
/**
|
|
@@ -670,12 +674,12 @@ const parseCLITerm = (flags, args) => {
|
|
|
670
674
|
else if (arg.startsWith('-') && arg.includes('=')) {
|
|
671
675
|
// we're dealing with an AliasEqualsArg, we have a special helper for that
|
|
672
676
|
const [originalArg, value] = parseEqualsArg(arg);
|
|
673
|
-
setCLIArg(flags,
|
|
677
|
+
setCLIArg(flags, desugarRawAlias(originalArg), normalizeFlagName(originalArg), value);
|
|
674
678
|
}
|
|
675
679
|
// AliasArg → "-" AliasName ( " " CLIValue )? ;
|
|
676
680
|
else if (CLI_FLAG_REGEX.test(arg)) {
|
|
677
681
|
// this is a short alias, like `-c` for Config
|
|
678
|
-
setCLIArg(flags, arg, normalizeFlagName(arg), parseCLIValue(args));
|
|
682
|
+
setCLIArg(flags, desugarRawAlias(arg), normalizeFlagName(arg), parseCLIValue(args));
|
|
679
683
|
}
|
|
680
684
|
// NegativeDashArg → "--no-" ArgName ;
|
|
681
685
|
else if (arg.startsWith('--no-') && arg.length > '--no-'.length) {
|
|
@@ -698,11 +702,14 @@ const parseCLITerm = (flags, args) => {
|
|
|
698
702
|
else if (arg.startsWith('--') && arg.length > '--'.length) {
|
|
699
703
|
setCLIArg(flags, arg, normalizeFlagName(arg), parseCLIValue(args));
|
|
700
704
|
}
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
705
|
+
else {
|
|
706
|
+
// if we get here then `arg` is not an argument in our list of supported
|
|
707
|
+
// arguments. This doesn't necessarily mean we want to report an error or
|
|
708
|
+
// anything though! Instead, with unknown / unrecognized arguments we want
|
|
709
|
+
// to stick them into the `unknownArgs` array, which is used when we pass
|
|
710
|
+
// CLI args to Jest, for instance.
|
|
711
|
+
flags.unknownArgs.push(arg);
|
|
712
|
+
}
|
|
706
713
|
};
|
|
707
714
|
/**
|
|
708
715
|
* Normalize a 'negative' flag name, just to do a little pre-processing before
|
|
@@ -748,7 +755,7 @@ const normalizeFlagName = (flagName) => {
|
|
|
748
755
|
* @param value the raw value to be set onto the config flags object
|
|
749
756
|
*/
|
|
750
757
|
const setCLIArg = (flags, rawArg, normalizedArg, value) => {
|
|
751
|
-
normalizedArg =
|
|
758
|
+
normalizedArg = desugarAlias(normalizedArg);
|
|
752
759
|
// We're setting a boolean!
|
|
753
760
|
if (readOnlyArrayHasStringMember(BOOLEAN_CLI_FLAGS, normalizedArg)) {
|
|
754
761
|
flags[normalizedArg] =
|
|
@@ -850,6 +857,14 @@ const setCLIArg = (flags, rawArg, normalizedArg, value) => {
|
|
|
850
857
|
throwCLIParsingError(rawArg, 'expected to receive a valid log level but received nothing');
|
|
851
858
|
}
|
|
852
859
|
}
|
|
860
|
+
else {
|
|
861
|
+
// we haven't found this flag in any of our lists of arguments, so we
|
|
862
|
+
// should put it in our list of unknown arguments
|
|
863
|
+
flags.unknownArgs.push(rawArg);
|
|
864
|
+
if (typeof value === 'string') {
|
|
865
|
+
flags.unknownArgs.push(value);
|
|
866
|
+
}
|
|
867
|
+
}
|
|
853
868
|
};
|
|
854
869
|
/**
|
|
855
870
|
* We use this regular expression to detect CLI parameters which
|
|
@@ -874,9 +889,10 @@ const Empty = Symbol('Empty');
|
|
|
874
889
|
* A little helper which tries to parse a CLI value (as opposed to a flag) off
|
|
875
890
|
* of the argument array.
|
|
876
891
|
*
|
|
877
|
-
* We support a variety of different argument formats
|
|
878
|
-
* with `-`, so we can check the first character
|
|
879
|
-
* in our array of CLI arguments is a flag name
|
|
892
|
+
* We support a variety of different argument formats for flags (as opposed to
|
|
893
|
+
* values), but all of them start with `-`, so we can check the first character
|
|
894
|
+
* to test whether the next token in our array of CLI arguments is a flag name
|
|
895
|
+
* or a value.
|
|
880
896
|
*
|
|
881
897
|
* @param args an array of CLI args
|
|
882
898
|
* @returns either a string result or an Empty sentinel
|
|
@@ -965,24 +981,36 @@ const throwNumberParsingError = (flag, value) => {
|
|
|
965
981
|
throwCLIParsingError(flag, `expected a number but received "${value}"`);
|
|
966
982
|
};
|
|
967
983
|
/**
|
|
968
|
-
* A little helper to '
|
|
969
|
-
*
|
|
970
|
-
* pointer to 'config', so here we're doing something like `*c`. Of course, this
|
|
971
|
-
* being JS, this is just a metaphor!
|
|
984
|
+
* A little helper to 'desugar' a flag alias, meaning expand it to its full
|
|
985
|
+
* name. For instance, the alias `"c"` will desugar to `"config"`.
|
|
972
986
|
*
|
|
973
|
-
* If no
|
|
974
|
-
*
|
|
987
|
+
* If no expansion is found for the possible alias we just return the passed
|
|
988
|
+
* string unmodified.
|
|
975
989
|
*
|
|
976
990
|
* @param maybeAlias a string which _could_ be an alias to a full flag name
|
|
977
991
|
* @returns the full aliased flag name, if found, or the passed string if not
|
|
978
992
|
*/
|
|
979
|
-
const
|
|
980
|
-
const
|
|
981
|
-
if (typeof
|
|
982
|
-
return
|
|
993
|
+
const desugarAlias = (maybeAlias) => {
|
|
994
|
+
const possiblyDesugared = CLI_FLAG_ALIASES[maybeAlias];
|
|
995
|
+
if (typeof possiblyDesugared === 'string') {
|
|
996
|
+
return possiblyDesugared;
|
|
983
997
|
}
|
|
984
998
|
return maybeAlias;
|
|
985
999
|
};
|
|
1000
|
+
/**
|
|
1001
|
+
* Desugar a 'raw' alias (with a leading dash) and return an equivalent,
|
|
1002
|
+
* desugared argument.
|
|
1003
|
+
*
|
|
1004
|
+
* For instance, passing `"-c` will return `"--config"`.
|
|
1005
|
+
*
|
|
1006
|
+
* The reason we'd like to do this is not so much for our own code, but so that
|
|
1007
|
+
* we can transform an alias like `"-u"` to `"--updateSnapshot"` in order to
|
|
1008
|
+
* pass it along to Jest.
|
|
1009
|
+
*
|
|
1010
|
+
* @param rawAlias a CLI flag alias as found on the command line (like `"-c"`)
|
|
1011
|
+
* @returns an equivalent full command (like `"--config"`)
|
|
1012
|
+
*/
|
|
1013
|
+
const desugarRawAlias = (rawAlias) => '--' + desugarAlias(normalizeFlagName(rawAlias));
|
|
986
1014
|
|
|
987
1015
|
const IS_NODE_ENV = typeof global !== 'undefined' &&
|
|
988
1016
|
typeof require === 'function' &&
|
|
@@ -2254,12 +2282,18 @@ const taskHelp = async (flags, logger, sys) => {
|
|
|
2254
2282
|
`);
|
|
2255
2283
|
};
|
|
2256
2284
|
|
|
2285
|
+
/**
|
|
2286
|
+
* Generate the output for Rindos 'info' task, and log that output - `npx rindo info`
|
|
2287
|
+
* @param coreCompiler the compiler instance to derive certain version information from
|
|
2288
|
+
* @param sys the compiler system instance that provides details about the system Rindo is running on
|
|
2289
|
+
* @param logger the logger instance to use to log information out to
|
|
2290
|
+
*/
|
|
2257
2291
|
const taskInfo = (coreCompiler, sys, logger) => {
|
|
2258
2292
|
const details = sys.details;
|
|
2259
2293
|
const versions = coreCompiler.versions;
|
|
2260
2294
|
console.log(``);
|
|
2261
2295
|
console.log(`${logger.cyan(' System:')} ${sys.name} ${sys.version}`);
|
|
2262
|
-
console.log(`${logger.cyan('
|
|
2296
|
+
console.log(`${logger.cyan(' Platform:')} ${details.platform} (${details.release})`);
|
|
2263
2297
|
console.log(`${logger.cyan(' CPU Model:')} ${details.cpuModel} (${sys.hardwareConcurrency} cpu${sys.hardwareConcurrency !== 1 ? 's' : ''})`);
|
|
2264
2298
|
console.log(`${logger.cyan(' Compiler:')} ${sys.getCompilerExecutingPath()}`);
|
|
2265
2299
|
console.log(`${logger.cyan(' Build:')} ${coreCompiler.buildId}`);
|
package/cli/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Rindo CLI v3.
|
|
2
|
+
Rindo CLI v3.2.0 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* Convert a string from dash-case / kebab-case to PascalCase (or CamelCase,
|
|
@@ -512,12 +512,23 @@ const CLI_FLAG_ALIASES = {
|
|
|
512
512
|
h: 'help',
|
|
513
513
|
p: 'port',
|
|
514
514
|
v: 'version',
|
|
515
|
+
// JEST SPECIFIC CLI FLAGS
|
|
516
|
+
// these are defined in
|
|
517
|
+
// https://github.com/facebook/jest/blob/4156f86/packages/jest-cli/src/args.ts
|
|
518
|
+
b: 'bail',
|
|
519
|
+
e: 'expand',
|
|
520
|
+
f: 'onlyFailures',
|
|
521
|
+
i: 'runInBand',
|
|
522
|
+
o: 'onlyChanged',
|
|
523
|
+
t: 'testNamePattern',
|
|
524
|
+
u: 'updateSnapshot',
|
|
525
|
+
w: 'maxWorkers',
|
|
515
526
|
};
|
|
516
527
|
/**
|
|
517
528
|
* A regular expression which can be used to match a CLI flag for one of our
|
|
518
529
|
* short aliases.
|
|
519
530
|
*/
|
|
520
|
-
const CLI_FLAG_REGEX = new RegExp(`^-[
|
|
531
|
+
const CLI_FLAG_REGEX = new RegExp(`^-[chpvbewofitu]{1}$`);
|
|
521
532
|
/**
|
|
522
533
|
* Helper function for initializing a `ConfigFlags` object. Provide any overrides
|
|
523
534
|
* for default values and off you go!
|
|
@@ -562,13 +573,6 @@ const parseFlags = (args) => {
|
|
|
562
573
|
flags.args.splice(i, 1);
|
|
563
574
|
}
|
|
564
575
|
}
|
|
565
|
-
// to find unknown / unrecognized arguments we filter `args`, including only
|
|
566
|
-
// arguments whose normalized form is not found in `knownArgs`. `knownArgs`
|
|
567
|
-
// is populated during the call to `parseArgs` above. For arguments like
|
|
568
|
-
// `--foobar` the string `"--foobar"` will be added, while for more
|
|
569
|
-
// complicated arguments like `--bizBoz=bop` or `--bizBoz bop` just the
|
|
570
|
-
// string `"--bizBoz"` will be added.
|
|
571
|
-
flags.unknownArgs = flags.args.filter((arg) => !flags.knownArgs.includes(parseEqualsArg(arg)[0]));
|
|
572
576
|
return flags;
|
|
573
577
|
};
|
|
574
578
|
/**
|
|
@@ -646,12 +650,12 @@ const parseCLITerm = (flags, args) => {
|
|
|
646
650
|
else if (arg.startsWith('-') && arg.includes('=')) {
|
|
647
651
|
// we're dealing with an AliasEqualsArg, we have a special helper for that
|
|
648
652
|
const [originalArg, value] = parseEqualsArg(arg);
|
|
649
|
-
setCLIArg(flags,
|
|
653
|
+
setCLIArg(flags, desugarRawAlias(originalArg), normalizeFlagName(originalArg), value);
|
|
650
654
|
}
|
|
651
655
|
// AliasArg → "-" AliasName ( " " CLIValue )? ;
|
|
652
656
|
else if (CLI_FLAG_REGEX.test(arg)) {
|
|
653
657
|
// this is a short alias, like `-c` for Config
|
|
654
|
-
setCLIArg(flags, arg, normalizeFlagName(arg), parseCLIValue(args));
|
|
658
|
+
setCLIArg(flags, desugarRawAlias(arg), normalizeFlagName(arg), parseCLIValue(args));
|
|
655
659
|
}
|
|
656
660
|
// NegativeDashArg → "--no-" ArgName ;
|
|
657
661
|
else if (arg.startsWith('--no-') && arg.length > '--no-'.length) {
|
|
@@ -674,11 +678,14 @@ const parseCLITerm = (flags, args) => {
|
|
|
674
678
|
else if (arg.startsWith('--') && arg.length > '--'.length) {
|
|
675
679
|
setCLIArg(flags, arg, normalizeFlagName(arg), parseCLIValue(args));
|
|
676
680
|
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
681
|
+
else {
|
|
682
|
+
// if we get here then `arg` is not an argument in our list of supported
|
|
683
|
+
// arguments. This doesn't necessarily mean we want to report an error or
|
|
684
|
+
// anything though! Instead, with unknown / unrecognized arguments we want
|
|
685
|
+
// to stick them into the `unknownArgs` array, which is used when we pass
|
|
686
|
+
// CLI args to Jest, for instance.
|
|
687
|
+
flags.unknownArgs.push(arg);
|
|
688
|
+
}
|
|
682
689
|
};
|
|
683
690
|
/**
|
|
684
691
|
* Normalize a 'negative' flag name, just to do a little pre-processing before
|
|
@@ -724,7 +731,7 @@ const normalizeFlagName = (flagName) => {
|
|
|
724
731
|
* @param value the raw value to be set onto the config flags object
|
|
725
732
|
*/
|
|
726
733
|
const setCLIArg = (flags, rawArg, normalizedArg, value) => {
|
|
727
|
-
normalizedArg =
|
|
734
|
+
normalizedArg = desugarAlias(normalizedArg);
|
|
728
735
|
// We're setting a boolean!
|
|
729
736
|
if (readOnlyArrayHasStringMember(BOOLEAN_CLI_FLAGS, normalizedArg)) {
|
|
730
737
|
flags[normalizedArg] =
|
|
@@ -826,6 +833,14 @@ const setCLIArg = (flags, rawArg, normalizedArg, value) => {
|
|
|
826
833
|
throwCLIParsingError(rawArg, 'expected to receive a valid log level but received nothing');
|
|
827
834
|
}
|
|
828
835
|
}
|
|
836
|
+
else {
|
|
837
|
+
// we haven't found this flag in any of our lists of arguments, so we
|
|
838
|
+
// should put it in our list of unknown arguments
|
|
839
|
+
flags.unknownArgs.push(rawArg);
|
|
840
|
+
if (typeof value === 'string') {
|
|
841
|
+
flags.unknownArgs.push(value);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
829
844
|
};
|
|
830
845
|
/**
|
|
831
846
|
* We use this regular expression to detect CLI parameters which
|
|
@@ -850,9 +865,10 @@ const Empty = Symbol('Empty');
|
|
|
850
865
|
* A little helper which tries to parse a CLI value (as opposed to a flag) off
|
|
851
866
|
* of the argument array.
|
|
852
867
|
*
|
|
853
|
-
* We support a variety of different argument formats
|
|
854
|
-
* with `-`, so we can check the first character
|
|
855
|
-
* in our array of CLI arguments is a flag name
|
|
868
|
+
* We support a variety of different argument formats for flags (as opposed to
|
|
869
|
+
* values), but all of them start with `-`, so we can check the first character
|
|
870
|
+
* to test whether the next token in our array of CLI arguments is a flag name
|
|
871
|
+
* or a value.
|
|
856
872
|
*
|
|
857
873
|
* @param args an array of CLI args
|
|
858
874
|
* @returns either a string result or an Empty sentinel
|
|
@@ -941,24 +957,36 @@ const throwNumberParsingError = (flag, value) => {
|
|
|
941
957
|
throwCLIParsingError(flag, `expected a number but received "${value}"`);
|
|
942
958
|
};
|
|
943
959
|
/**
|
|
944
|
-
* A little helper to '
|
|
945
|
-
*
|
|
946
|
-
* pointer to 'config', so here we're doing something like `*c`. Of course, this
|
|
947
|
-
* being JS, this is just a metaphor!
|
|
960
|
+
* A little helper to 'desugar' a flag alias, meaning expand it to its full
|
|
961
|
+
* name. For instance, the alias `"c"` will desugar to `"config"`.
|
|
948
962
|
*
|
|
949
|
-
* If no
|
|
950
|
-
*
|
|
963
|
+
* If no expansion is found for the possible alias we just return the passed
|
|
964
|
+
* string unmodified.
|
|
951
965
|
*
|
|
952
966
|
* @param maybeAlias a string which _could_ be an alias to a full flag name
|
|
953
967
|
* @returns the full aliased flag name, if found, or the passed string if not
|
|
954
968
|
*/
|
|
955
|
-
const
|
|
956
|
-
const
|
|
957
|
-
if (typeof
|
|
958
|
-
return
|
|
969
|
+
const desugarAlias = (maybeAlias) => {
|
|
970
|
+
const possiblyDesugared = CLI_FLAG_ALIASES[maybeAlias];
|
|
971
|
+
if (typeof possiblyDesugared === 'string') {
|
|
972
|
+
return possiblyDesugared;
|
|
959
973
|
}
|
|
960
974
|
return maybeAlias;
|
|
961
975
|
};
|
|
976
|
+
/**
|
|
977
|
+
* Desugar a 'raw' alias (with a leading dash) and return an equivalent,
|
|
978
|
+
* desugared argument.
|
|
979
|
+
*
|
|
980
|
+
* For instance, passing `"-c` will return `"--config"`.
|
|
981
|
+
*
|
|
982
|
+
* The reason we'd like to do this is not so much for our own code, but so that
|
|
983
|
+
* we can transform an alias like `"-u"` to `"--updateSnapshot"` in order to
|
|
984
|
+
* pass it along to Jest.
|
|
985
|
+
*
|
|
986
|
+
* @param rawAlias a CLI flag alias as found on the command line (like `"-c"`)
|
|
987
|
+
* @returns an equivalent full command (like `"--config"`)
|
|
988
|
+
*/
|
|
989
|
+
const desugarRawAlias = (rawAlias) => '--' + desugarAlias(normalizeFlagName(rawAlias));
|
|
962
990
|
|
|
963
991
|
const IS_NODE_ENV = typeof global !== 'undefined' &&
|
|
964
992
|
typeof require === 'function' &&
|
|
@@ -2230,12 +2258,18 @@ const taskHelp = async (flags, logger, sys) => {
|
|
|
2230
2258
|
`);
|
|
2231
2259
|
};
|
|
2232
2260
|
|
|
2261
|
+
/**
|
|
2262
|
+
* Generate the output for Rindos 'info' task, and log that output - `npx rindo info`
|
|
2263
|
+
* @param coreCompiler the compiler instance to derive certain version information from
|
|
2264
|
+
* @param sys the compiler system instance that provides details about the system Rindo is running on
|
|
2265
|
+
* @param logger the logger instance to use to log information out to
|
|
2266
|
+
*/
|
|
2233
2267
|
const taskInfo = (coreCompiler, sys, logger) => {
|
|
2234
2268
|
const details = sys.details;
|
|
2235
2269
|
const versions = coreCompiler.versions;
|
|
2236
2270
|
console.log(``);
|
|
2237
2271
|
console.log(`${logger.cyan(' System:')} ${sys.name} ${sys.version}`);
|
|
2238
|
-
console.log(`${logger.cyan('
|
|
2272
|
+
console.log(`${logger.cyan(' Platform:')} ${details.platform} (${details.release})`);
|
|
2239
2273
|
console.log(`${logger.cyan(' CPU Model:')} ${details.cpuModel} (${sys.hardwareConcurrency} cpu${sys.hardwareConcurrency !== 1 ? 's' : ''})`);
|
|
2240
2274
|
console.log(`${logger.cyan(' Compiler:')} ${sys.getCompilerExecutingPath()}`);
|
|
2241
2275
|
console.log(`${logger.cyan(' Build:')} ${coreCompiler.buildId}`);
|
package/cli/package.json
CHANGED
package/compiler/package.json
CHANGED
package/compiler/rindo.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Rindo Compiler v3.
|
|
2
|
+
Rindo Compiler v3.2.0 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
(function(exports) {
|
|
5
5
|
'use strict';
|
|
@@ -2155,7 +2155,7 @@ const process$3 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(null), p
|
|
|
2155
2155
|
'default': process_1
|
|
2156
2156
|
});
|
|
2157
2157
|
|
|
2158
|
-
const buildId = '
|
|
2158
|
+
const buildId = '1680872033';
|
|
2159
2159
|
const minfyJsId = 'terser5.16.1_7';
|
|
2160
2160
|
const optimizeCssId = 'autoprefixer10.4.13_postcss8.4.21_7';
|
|
2161
2161
|
const parse5Version = '7.1.2';
|
|
@@ -2163,8 +2163,8 @@ const rollupVersion = '2.42.3';
|
|
|
2163
2163
|
const sizzleVersion = '2.42.3';
|
|
2164
2164
|
const terserVersion = '5.16.1';
|
|
2165
2165
|
const typescriptVersion = '4.9.4';
|
|
2166
|
-
const vermoji = '
|
|
2167
|
-
const version$3 = '3.
|
|
2166
|
+
const vermoji = '🏙';
|
|
2167
|
+
const version$3 = '3.2.0';
|
|
2168
2168
|
const versions = {
|
|
2169
2169
|
rindo: version$3,
|
|
2170
2170
|
parse5: parse5Version,
|
|
@@ -11644,6 +11644,7 @@ class MagicString$3 {
|
|
|
11644
11644
|
sourcemapLocations: { writable: true, value: new BitSet$3() },
|
|
11645
11645
|
storedNames: { writable: true, value: {} },
|
|
11646
11646
|
indentStr: { writable: true, value: undefined },
|
|
11647
|
+
ignoreList: { writable: true, value: options.ignoreList },
|
|
11647
11648
|
});
|
|
11648
11649
|
|
|
11649
11650
|
this.byStart[0] = chunk;
|
|
@@ -11761,11 +11762,12 @@ class MagicString$3 {
|
|
|
11761
11762
|
});
|
|
11762
11763
|
|
|
11763
11764
|
return {
|
|
11764
|
-
file: options.file ? options.file.split(/[/\\]/).pop() :
|
|
11765
|
-
sources: [options.source ? getRelativePath$3(options.file || '', options.source) :
|
|
11766
|
-
sourcesContent: options.includeContent ? [this.original] :
|
|
11765
|
+
file: options.file ? options.file.split(/[/\\]/).pop() : undefined,
|
|
11766
|
+
sources: [options.source ? getRelativePath$3(options.file || '', options.source) : (options.file || '')],
|
|
11767
|
+
sourcesContent: options.includeContent ? [this.original] : undefined,
|
|
11767
11768
|
names,
|
|
11768
11769
|
mappings: mappings.raw,
|
|
11770
|
+
x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined
|
|
11769
11771
|
};
|
|
11770
11772
|
}
|
|
11771
11773
|
|
|
@@ -20104,6 +20106,40 @@ const getTypeReferenceLocation = (typeName, tsNode) => {
|
|
|
20104
20106
|
location: 'global',
|
|
20105
20107
|
};
|
|
20106
20108
|
};
|
|
20109
|
+
/**
|
|
20110
|
+
* Resolve a type annotation, using the TypeScript typechecker to convert a
|
|
20111
|
+
* {@link ts.Type} record to a string.
|
|
20112
|
+
*
|
|
20113
|
+
* For instance, assume there's a module `foo.ts` which exports a type `Foo`
|
|
20114
|
+
* which looks like this:
|
|
20115
|
+
*
|
|
20116
|
+
* ```ts
|
|
20117
|
+
* // foo.ts
|
|
20118
|
+
* type Foo = (b: string) => boolean;
|
|
20119
|
+
* ```
|
|
20120
|
+
*
|
|
20121
|
+
* and then a module `bar.ts` which imports `Foo` and uses it to annotate a
|
|
20122
|
+
* variable declaration like so:
|
|
20123
|
+
*
|
|
20124
|
+
* ```ts
|
|
20125
|
+
* // bar.ts
|
|
20126
|
+
* import { Foo } from './foo';
|
|
20127
|
+
*
|
|
20128
|
+
* let foo: Foo | undefined;
|
|
20129
|
+
* ```
|
|
20130
|
+
*
|
|
20131
|
+
* If this function is called with the {@link ts.Type} object corresponding to
|
|
20132
|
+
* the {@link ts.Node} object for the `foo` variable, it will return something
|
|
20133
|
+
* like:
|
|
20134
|
+
*
|
|
20135
|
+
* ```ts
|
|
20136
|
+
* "(b: string) => boolean | undefined";
|
|
20137
|
+
* ```
|
|
20138
|
+
*
|
|
20139
|
+
* @param checker a typescript typechecker
|
|
20140
|
+
* @param type the type to resolve
|
|
20141
|
+
* @returns a resolved, user-readable string
|
|
20142
|
+
*/
|
|
20107
20143
|
const resolveType = (checker, type) => {
|
|
20108
20144
|
const set = new Set();
|
|
20109
20145
|
parseDocsType(checker, type, set);
|
|
@@ -20114,7 +20150,7 @@ const resolveType = (checker, type) => {
|
|
|
20114
20150
|
set.add('boolean');
|
|
20115
20151
|
}
|
|
20116
20152
|
let parts = Array.from(set.keys()).sort();
|
|
20117
|
-
// TODO: Get this section of code under tests that directly
|
|
20153
|
+
// TODO: Get this section of code under tests that directly exercise this behavior
|
|
20118
20154
|
if (parts.length > 1) {
|
|
20119
20155
|
parts = parts.map((p) => (p.indexOf('=>') >= 0 ? `(${p})` : p));
|
|
20120
20156
|
}
|
|
@@ -20127,6 +20163,7 @@ const resolveType = (checker, type) => {
|
|
|
20127
20163
|
};
|
|
20128
20164
|
/**
|
|
20129
20165
|
* Formats a TypeScript `Type` entity as a string
|
|
20166
|
+
*
|
|
20130
20167
|
* @param checker a reference to the TypeScript type checker
|
|
20131
20168
|
* @param type a TypeScript `Type` entity to format
|
|
20132
20169
|
* @returns the formatted string
|
|
@@ -20135,6 +20172,18 @@ const typeToString = (checker, type) => {
|
|
|
20135
20172
|
const TYPE_FORMAT_FLAGS = t.TypeFormatFlags.NoTruncation | t.TypeFormatFlags.InTypeAlias | t.TypeFormatFlags.InElementType;
|
|
20136
20173
|
return checker.typeToString(type, undefined, TYPE_FORMAT_FLAGS);
|
|
20137
20174
|
};
|
|
20175
|
+
/**
|
|
20176
|
+
* Parse a type into its component parts, recursively dealing with each variant
|
|
20177
|
+
* if it is a union type.
|
|
20178
|
+
*
|
|
20179
|
+
* **Note**: this function will mutate the `parts` set, adding new strings for
|
|
20180
|
+
* any types it finds.
|
|
20181
|
+
*
|
|
20182
|
+
* @param checker a TypeScript typechecker instance
|
|
20183
|
+
* @param type a TypeScript type
|
|
20184
|
+
* @param parts an out param that holds parts of the type annotation we're
|
|
20185
|
+
* assembling
|
|
20186
|
+
*/
|
|
20138
20187
|
const parseDocsType = (checker, type, parts) => {
|
|
20139
20188
|
if (type.isUnion()) {
|
|
20140
20189
|
type.types.forEach((t) => {
|
|
@@ -61770,7 +61819,7 @@ const getBundleId = async (config, entryKey, shouldHash, code, sufix) => {
|
|
|
61770
61819
|
};
|
|
61771
61820
|
|
|
61772
61821
|
const generateLazyModules = async (config, compilerCtx, buildCtx, outputTargetType, destinations, results, sourceTarget, isBrowserBuild, sufix) => {
|
|
61773
|
-
var _a;
|
|
61822
|
+
var _a, _b;
|
|
61774
61823
|
if (!Array.isArray(destinations) || destinations.length === 0) {
|
|
61775
61824
|
return [];
|
|
61776
61825
|
}
|
|
@@ -61781,7 +61830,7 @@ const generateLazyModules = async (config, compilerCtx, buildCtx, outputTargetTy
|
|
|
61781
61830
|
const bundleModules = await Promise.all(entryComponentsResults.map((rollupResult) => {
|
|
61782
61831
|
return generateLazyEntryModule(config, compilerCtx, buildCtx, rollupResult, outputTargetType, destinations, sourceTarget, shouldMinify, isBrowserBuild, sufix);
|
|
61783
61832
|
}));
|
|
61784
|
-
if (!!((_a = config.extras) === null || _a === void 0 ? void 0 : _a.experimentalImportInjection) && !isBrowserBuild) {
|
|
61833
|
+
if ((!!((_a = config.extras) === null || _a === void 0 ? void 0 : _a.experimentalImportInjection) || !!((_b = config.extras) === null || _b === void 0 ? void 0 : _b.enableImportInjection)) && !isBrowserBuild) {
|
|
61785
61834
|
addStaticImports(rollupResults, bundleModules);
|
|
61786
61835
|
}
|
|
61787
61836
|
await Promise.all(chunkResults.map((rollupResult) => {
|
|
@@ -73676,10 +73725,12 @@ const transpileModule = (config, input, transformOpts) => {
|
|
|
73676
73725
|
return normalizePath$2(fileName) === normalizePath$2(sourceFilePath) ? sourceFile : undefined;
|
|
73677
73726
|
},
|
|
73678
73727
|
writeFile: (name, text) => {
|
|
73679
|
-
if (name.endsWith('.js.map')) {
|
|
73728
|
+
if (name.endsWith('.js.map') || name.endsWith('.mjs.map')) {
|
|
73680
73729
|
results.map = text;
|
|
73681
73730
|
}
|
|
73682
|
-
else if (name.endsWith('.js')) {
|
|
73731
|
+
else if (name.endsWith('.js') || name.endsWith('.mjs')) {
|
|
73732
|
+
// if the source file is an ES module w/ `.mjs` extension then
|
|
73733
|
+
// TypeScript will output a `.mjs` file
|
|
73683
73734
|
results.code = text;
|
|
73684
73735
|
}
|
|
73685
73736
|
},
|