@jsenv/core 40.8.1 → 40.8.3
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/dist/build/build.js +263 -130
- package/dist/build/jsenv_core_packages.js +2 -1
- package/dist/start_dev_server/jsenv_core_packages.js +2 -1
- package/dist/start_dev_server/start_dev_server.js +264 -130
- package/package.json +8 -8
- package/src/build/build.js +3 -0
- package/src/dev/start_dev_server.js +4 -0
- package/src/plugins/plugins.js +8 -1
- package/src/plugins/resolution_node_esm/jsenv_plugin_node_esm_resolution.js +9 -0
- package/src/plugins/resolution_node_esm/node_esm_resolver.js +243 -129
|
@@ -5552,11 +5552,13 @@ const createNodeEsmResolver = ({
|
|
|
5552
5552
|
runtimeCompat,
|
|
5553
5553
|
rootDirectoryUrl,
|
|
5554
5554
|
packageConditions = {},
|
|
5555
|
+
packageConditionsConfig,
|
|
5555
5556
|
preservesSymlink,
|
|
5556
5557
|
}) => {
|
|
5557
5558
|
const buildPackageConditions = createBuildPackageConditions(
|
|
5558
5559
|
packageConditions,
|
|
5559
5560
|
{
|
|
5561
|
+
packageConditionsConfig,
|
|
5560
5562
|
rootDirectoryUrl,
|
|
5561
5563
|
runtimeCompat,
|
|
5562
5564
|
},
|
|
@@ -5588,26 +5590,43 @@ const createNodeEsmResolver = ({
|
|
|
5588
5590
|
const webResolutionFallback =
|
|
5589
5591
|
ownerUrlInfo.type !== "js_module" ||
|
|
5590
5592
|
reference.type === "sourcemap_comment";
|
|
5593
|
+
|
|
5594
|
+
const resolveNodeEsmFallbackOnWeb = createResolverWithFallbackOnError(
|
|
5595
|
+
applyNodeEsmResolution,
|
|
5596
|
+
({ specifier, parentUrl }) => {
|
|
5597
|
+
const url = new URL(specifier, parentUrl).href;
|
|
5598
|
+
return { url };
|
|
5599
|
+
},
|
|
5600
|
+
);
|
|
5601
|
+
const DELEGATE_TO_WEB_RESOLUTION_PLUGIN = {};
|
|
5602
|
+
const resolveNodeEsmFallbackNullToDelegateToWebPlugin =
|
|
5603
|
+
createResolverWithFallbackOnError(
|
|
5604
|
+
applyNodeEsmResolution,
|
|
5605
|
+
|
|
5606
|
+
() => DELEGATE_TO_WEB_RESOLUTION_PLUGIN,
|
|
5607
|
+
);
|
|
5608
|
+
|
|
5591
5609
|
const conditions = buildPackageConditions(specifier, parentUrl, {
|
|
5592
5610
|
webResolutionFallback,
|
|
5611
|
+
resolver: webResolutionFallback
|
|
5612
|
+
? resolveNodeEsmFallbackOnWeb
|
|
5613
|
+
: applyNodeEsmResolution,
|
|
5593
5614
|
});
|
|
5594
|
-
|
|
5595
|
-
|
|
5615
|
+
const resolver = webResolutionFallback
|
|
5616
|
+
? resolveNodeEsmFallbackNullToDelegateToWebPlugin
|
|
5617
|
+
: applyNodeEsmResolution;
|
|
5618
|
+
|
|
5619
|
+
const result = resolver({
|
|
5596
5620
|
conditions,
|
|
5597
5621
|
parentUrl,
|
|
5598
5622
|
specifier,
|
|
5599
5623
|
preservesSymlink,
|
|
5600
|
-
};
|
|
5601
|
-
if (
|
|
5602
|
-
|
|
5603
|
-
resolution = applyNodeEsmResolution(nodeEsmResolutionParams);
|
|
5604
|
-
} catch {
|
|
5605
|
-
return null; // delegate to web_resolution plugin
|
|
5606
|
-
}
|
|
5607
|
-
} else {
|
|
5608
|
-
resolution = applyNodeEsmResolution(nodeEsmResolutionParams);
|
|
5624
|
+
});
|
|
5625
|
+
if (result === DELEGATE_TO_WEB_RESOLUTION_PLUGIN) {
|
|
5626
|
+
return null;
|
|
5609
5627
|
}
|
|
5610
|
-
|
|
5628
|
+
|
|
5629
|
+
const { url, type, isMain, packageDirectoryUrl } = result;
|
|
5611
5630
|
// try to give a more meaningful filename after build
|
|
5612
5631
|
if (isMain && packageDirectoryUrl) {
|
|
5613
5632
|
const basename = urlToBasename(url);
|
|
@@ -5671,147 +5690,232 @@ const createNodeEsmResolver = ({
|
|
|
5671
5690
|
|
|
5672
5691
|
const createBuildPackageConditions = (
|
|
5673
5692
|
packageConditions,
|
|
5674
|
-
{ rootDirectoryUrl, runtimeCompat },
|
|
5693
|
+
{ packageConditionsConfig, rootDirectoryUrl, runtimeCompat },
|
|
5675
5694
|
) => {
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5695
|
+
let resolveConditionsFromSpecifier = () => null;
|
|
5696
|
+
let resolveConditionsFromContext = () => [];
|
|
5697
|
+
from_specifier: {
|
|
5698
|
+
if (!packageConditionsConfig) {
|
|
5699
|
+
break from_specifier;
|
|
5700
|
+
}
|
|
5701
|
+
const keys = Object.keys(packageConditionsConfig);
|
|
5702
|
+
if (keys.length === 0) {
|
|
5703
|
+
break from_specifier;
|
|
5704
|
+
}
|
|
5705
|
+
|
|
5706
|
+
const associationsRaw = {};
|
|
5707
|
+
for (const key of keys) {
|
|
5708
|
+
const associatedValue = packageConditionsConfig[key];
|
|
5709
|
+
|
|
5710
|
+
if (!isBareSpecifier(key)) {
|
|
5711
|
+
const url = new URL(key, rootDirectoryUrl);
|
|
5712
|
+
associationsRaw[url] = associatedValue;
|
|
5713
|
+
continue;
|
|
5714
|
+
}
|
|
5715
|
+
try {
|
|
5716
|
+
if (key.endsWith("/")) {
|
|
5717
|
+
const { packageDirectoryUrl } = applyNodeEsmResolution({
|
|
5718
|
+
specifier: key.slice(0, -1), // avoid package path not exported
|
|
5719
|
+
parentUrl: rootDirectoryUrl,
|
|
5687
5720
|
});
|
|
5688
|
-
url =
|
|
5689
|
-
|
|
5690
|
-
|
|
5721
|
+
const url = packageDirectoryUrl;
|
|
5722
|
+
associationsRaw[url] = associatedValue;
|
|
5723
|
+
continue;
|
|
5691
5724
|
}
|
|
5725
|
+
const { url } = applyNodeEsmResolution({
|
|
5726
|
+
specifier: key,
|
|
5727
|
+
parentUrl: rootDirectoryUrl,
|
|
5728
|
+
});
|
|
5729
|
+
associationsRaw[url] = associatedValue;
|
|
5730
|
+
} catch {
|
|
5731
|
+
const url = new URL(key, rootDirectoryUrl);
|
|
5732
|
+
associationsRaw[url] = associatedValue;
|
|
5733
|
+
}
|
|
5734
|
+
}
|
|
5735
|
+
const associations = URL_META.resolveAssociations(
|
|
5736
|
+
{
|
|
5737
|
+
conditions: associationsRaw,
|
|
5738
|
+
},
|
|
5739
|
+
rootDirectoryUrl,
|
|
5740
|
+
);
|
|
5741
|
+
resolveConditionsFromSpecifier = (specifier, importer, { resolver }) => {
|
|
5742
|
+
let associatedValue;
|
|
5743
|
+
if (isBareSpecifier(specifier)) {
|
|
5744
|
+
const { url } = resolver({
|
|
5745
|
+
specifier,
|
|
5746
|
+
parentUrl: importer,
|
|
5747
|
+
});
|
|
5748
|
+
associatedValue = URL_META.applyAssociations({ url, associations });
|
|
5692
5749
|
} else {
|
|
5693
|
-
|
|
5750
|
+
associatedValue = URL_META.applyAssociations({
|
|
5751
|
+
url: importer,
|
|
5752
|
+
associations,
|
|
5753
|
+
});
|
|
5754
|
+
}
|
|
5755
|
+
if (!associatedValue) {
|
|
5756
|
+
return undefined;
|
|
5757
|
+
}
|
|
5758
|
+
if (associatedValue.conditions) {
|
|
5759
|
+
return associatedValue.conditions;
|
|
5760
|
+
}
|
|
5761
|
+
return undefined;
|
|
5762
|
+
};
|
|
5763
|
+
}
|
|
5764
|
+
{
|
|
5765
|
+
const nodeRuntimeEnabled = Object.keys(runtimeCompat).includes("node");
|
|
5766
|
+
// https://nodejs.org/api/esm.html#resolver-algorithm-specification
|
|
5767
|
+
const devResolver = (specifier, importer, { resolver }) => {
|
|
5768
|
+
if (isBareSpecifier(specifier)) {
|
|
5769
|
+
const { url } = resolver({
|
|
5694
5770
|
specifier,
|
|
5695
5771
|
parentUrl: importer,
|
|
5696
5772
|
});
|
|
5697
|
-
url
|
|
5773
|
+
return !url.includes("/node_modules/");
|
|
5698
5774
|
}
|
|
5699
|
-
return !
|
|
5700
|
-
}
|
|
5701
|
-
return !importer.includes("/node_modules/");
|
|
5702
|
-
};
|
|
5775
|
+
return !importer.includes("/node_modules/");
|
|
5776
|
+
};
|
|
5703
5777
|
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5778
|
+
const conditionDefaultResolvers = {
|
|
5779
|
+
"dev:*": devResolver,
|
|
5780
|
+
"development": devResolver,
|
|
5781
|
+
"node": nodeRuntimeEnabled,
|
|
5782
|
+
"browser": !nodeRuntimeEnabled,
|
|
5783
|
+
"import": true,
|
|
5784
|
+
};
|
|
5785
|
+
const conditionResolvers = {
|
|
5786
|
+
...conditionDefaultResolvers,
|
|
5787
|
+
};
|
|
5714
5788
|
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
);
|
|
5722
|
-
if (conditionRegex.test(condition)) {
|
|
5723
|
-
const existingResolver =
|
|
5724
|
-
conditionDefaultResolvers[conditionCandidate];
|
|
5725
|
-
wildcardToRemoveSet.add(conditionCandidate);
|
|
5726
|
-
conditionResolvers[condition] = combineTwoPackageConditionResolvers(
|
|
5727
|
-
existingResolver,
|
|
5728
|
-
customResolver,
|
|
5789
|
+
let wildcardToRemoveSet = new Set();
|
|
5790
|
+
const addCustomResolver = (condition, customResolver) => {
|
|
5791
|
+
for (const conditionCandidate of Object.keys(conditionDefaultResolvers)) {
|
|
5792
|
+
if (conditionCandidate.includes("*")) {
|
|
5793
|
+
const conditionRegex = new RegExp(
|
|
5794
|
+
`^${conditionCandidate.replace(/\*/g, "(.*)")}$`,
|
|
5729
5795
|
);
|
|
5730
|
-
|
|
5796
|
+
if (conditionRegex.test(condition)) {
|
|
5797
|
+
const existingResolver =
|
|
5798
|
+
conditionDefaultResolvers[conditionCandidate];
|
|
5799
|
+
wildcardToRemoveSet.add(conditionCandidate);
|
|
5800
|
+
conditionResolvers[condition] = combineTwoPackageConditionResolvers(
|
|
5801
|
+
existingResolver,
|
|
5802
|
+
customResolver,
|
|
5803
|
+
);
|
|
5804
|
+
return;
|
|
5805
|
+
}
|
|
5731
5806
|
}
|
|
5732
5807
|
}
|
|
5808
|
+
const existingResolver = conditionDefaultResolvers[condition];
|
|
5809
|
+
if (existingResolver) {
|
|
5810
|
+
conditionResolvers[condition] = combineTwoPackageConditionResolvers(
|
|
5811
|
+
existingResolver,
|
|
5812
|
+
customResolver,
|
|
5813
|
+
);
|
|
5814
|
+
return;
|
|
5815
|
+
}
|
|
5816
|
+
conditionResolvers[condition] = customResolver;
|
|
5817
|
+
};
|
|
5818
|
+
{
|
|
5819
|
+
const processArgConditions = readCustomConditionsFromProcessArgs();
|
|
5820
|
+
for (const processArgCondition of processArgConditions) {
|
|
5821
|
+
addCustomResolver(processArgCondition, true);
|
|
5822
|
+
}
|
|
5733
5823
|
}
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
specifier: pattern.slice(0, -1),
|
|
5761
|
-
parentUrl: rootDirectoryUrl,
|
|
5762
|
-
});
|
|
5763
|
-
return packageDirectoryUrl;
|
|
5824
|
+
{
|
|
5825
|
+
for (const key of Object.keys(packageConditions)) {
|
|
5826
|
+
const value = packageConditions[key];
|
|
5827
|
+
let customResolver;
|
|
5828
|
+
if (typeof value === "object") {
|
|
5829
|
+
const associations = URL_META.resolveAssociations(
|
|
5830
|
+
{ applies: value },
|
|
5831
|
+
(pattern) => {
|
|
5832
|
+
if (isBareSpecifier(pattern)) {
|
|
5833
|
+
try {
|
|
5834
|
+
if (pattern.endsWith("/")) {
|
|
5835
|
+
// avoid package path not exported
|
|
5836
|
+
const { packageDirectoryUrl } = applyNodeEsmResolution({
|
|
5837
|
+
specifier: pattern.slice(0, -1),
|
|
5838
|
+
parentUrl: rootDirectoryUrl,
|
|
5839
|
+
});
|
|
5840
|
+
return packageDirectoryUrl;
|
|
5841
|
+
}
|
|
5842
|
+
const { url } = applyNodeEsmResolution({
|
|
5843
|
+
specifier: pattern,
|
|
5844
|
+
parentUrl: rootDirectoryUrl,
|
|
5845
|
+
});
|
|
5846
|
+
return url;
|
|
5847
|
+
} catch {
|
|
5848
|
+
return new URL(pattern, rootDirectoryUrl);
|
|
5849
|
+
}
|
|
5764
5850
|
}
|
|
5765
|
-
const { url } = applyNodeEsmResolution({
|
|
5766
|
-
specifier: pattern,
|
|
5767
|
-
parentUrl: rootDirectoryUrl,
|
|
5768
|
-
});
|
|
5769
|
-
return url;
|
|
5770
|
-
} catch {
|
|
5771
5851
|
return new URL(pattern, rootDirectoryUrl);
|
|
5852
|
+
},
|
|
5853
|
+
);
|
|
5854
|
+
customResolver = (specifier, importer, { resolver }) => {
|
|
5855
|
+
if (isBareSpecifier(specifier)) {
|
|
5856
|
+
const { url } = resolver({
|
|
5857
|
+
specifier,
|
|
5858
|
+
parentUrl: importer,
|
|
5859
|
+
});
|
|
5860
|
+
const { applies } = URL_META.applyAssociations({
|
|
5861
|
+
url,
|
|
5862
|
+
associations,
|
|
5863
|
+
});
|
|
5864
|
+
return applies;
|
|
5772
5865
|
}
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
const { applies } = URL_META.applyAssociations({ url, associations });
|
|
5784
|
-
return applies;
|
|
5866
|
+
const { applies } = URL_META.applyAssociations({
|
|
5867
|
+
url: importer,
|
|
5868
|
+
associations,
|
|
5869
|
+
});
|
|
5870
|
+
return applies;
|
|
5871
|
+
};
|
|
5872
|
+
} else if (typeof value === "function") {
|
|
5873
|
+
customResolver = value;
|
|
5874
|
+
} else {
|
|
5875
|
+
customResolver = value;
|
|
5785
5876
|
}
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
} else {
|
|
5792
|
-
customResolver = value;
|
|
5877
|
+
addCustomResolver(key, customResolver);
|
|
5878
|
+
}
|
|
5879
|
+
}
|
|
5880
|
+
for (const wildcardToRemove of wildcardToRemoveSet) {
|
|
5881
|
+
delete conditionResolvers[wildcardToRemove];
|
|
5793
5882
|
}
|
|
5794
|
-
addCustomResolver(customCondition, customResolver);
|
|
5795
|
-
}
|
|
5796
|
-
|
|
5797
|
-
for (const wildcardToRemove of wildcardToRemoveSet) {
|
|
5798
|
-
delete conditionResolvers[wildcardToRemove];
|
|
5799
|
-
}
|
|
5800
5883
|
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5884
|
+
const conditionCandidateArray = Object.keys(conditionResolvers);
|
|
5885
|
+
resolveConditionsFromContext = (specifier, importer, params) => {
|
|
5886
|
+
const conditions = [];
|
|
5887
|
+
for (const conditionCandidate of conditionCandidateArray) {
|
|
5888
|
+
const conditionResolver = conditionResolvers[conditionCandidate];
|
|
5889
|
+
if (typeof conditionResolver === "function") {
|
|
5890
|
+
if (conditionResolver(specifier, importer, params)) {
|
|
5891
|
+
conditions.push(conditionCandidate);
|
|
5892
|
+
}
|
|
5893
|
+
} else if (conditionResolver) {
|
|
5808
5894
|
conditions.push(conditionCandidate);
|
|
5809
5895
|
}
|
|
5810
|
-
} else if (conditionResolver) {
|
|
5811
|
-
conditions.push(conditionCandidate);
|
|
5812
5896
|
}
|
|
5897
|
+
return conditions;
|
|
5898
|
+
};
|
|
5899
|
+
}
|
|
5900
|
+
|
|
5901
|
+
return (specifier, importer, params) => {
|
|
5902
|
+
const conditionsForThisSpecifier = resolveConditionsFromSpecifier(
|
|
5903
|
+
specifier,
|
|
5904
|
+
importer,
|
|
5905
|
+
params,
|
|
5906
|
+
);
|
|
5907
|
+
if (conditionsForThisSpecifier) {
|
|
5908
|
+
return conditionsForThisSpecifier;
|
|
5813
5909
|
}
|
|
5814
|
-
|
|
5910
|
+
const conditionsFromContext = resolveConditionsFromContext(
|
|
5911
|
+
specifier,
|
|
5912
|
+
importer,
|
|
5913
|
+
params,
|
|
5914
|
+
);
|
|
5915
|
+
if (conditionsFromContext) {
|
|
5916
|
+
return conditionsFromContext;
|
|
5917
|
+
}
|
|
5918
|
+
return [];
|
|
5815
5919
|
};
|
|
5816
5920
|
};
|
|
5817
5921
|
|
|
@@ -5865,6 +5969,16 @@ const addRelationshipWithPackageJson = ({
|
|
|
5865
5969
|
}
|
|
5866
5970
|
};
|
|
5867
5971
|
|
|
5972
|
+
const createResolverWithFallbackOnError = (mainResolver, fallbackResolver) => {
|
|
5973
|
+
return (params) => {
|
|
5974
|
+
try {
|
|
5975
|
+
return mainResolver(params);
|
|
5976
|
+
} catch {
|
|
5977
|
+
return fallbackResolver(params);
|
|
5978
|
+
}
|
|
5979
|
+
};
|
|
5980
|
+
};
|
|
5981
|
+
|
|
5868
5982
|
const isBareSpecifier = (specifier) => {
|
|
5869
5983
|
if (
|
|
5870
5984
|
specifier[0] === "/" ||
|
|
@@ -5885,6 +5999,7 @@ const isBareSpecifier = (specifier) => {
|
|
|
5885
5999
|
const jsenvPluginNodeEsmResolution = (
|
|
5886
6000
|
resolutionConfig = {},
|
|
5887
6001
|
packageConditions,
|
|
6002
|
+
packageConditionsConfig = {},
|
|
5888
6003
|
) => {
|
|
5889
6004
|
let nodeEsmResolverDefault;
|
|
5890
6005
|
const resolverMap = new Map();
|
|
@@ -5907,6 +6022,10 @@ const jsenvPluginNodeEsmResolution = (
|
|
|
5907
6022
|
runtimeCompat: kitchenContext.runtimeCompat,
|
|
5908
6023
|
rootDirectoryUrl: kitchenContext.rootDirectoryUrl,
|
|
5909
6024
|
packageConditions,
|
|
6025
|
+
packageConditionsConfig: {
|
|
6026
|
+
...kitchenContext.packageConditionsConfig,
|
|
6027
|
+
...packageConditionsConfig,
|
|
6028
|
+
},
|
|
5910
6029
|
preservesSymlink,
|
|
5911
6030
|
});
|
|
5912
6031
|
};
|
|
@@ -5921,6 +6040,10 @@ const jsenvPluginNodeEsmResolution = (
|
|
|
5921
6040
|
rootDirectoryUrl: kitchenContext.rootDirectoryUrl,
|
|
5922
6041
|
preservesSymlink: true,
|
|
5923
6042
|
packageConditions,
|
|
6043
|
+
packageConditionsConfig: {
|
|
6044
|
+
...kitchenContext.packageConditionsConfig,
|
|
6045
|
+
...packageConditionsConfig,
|
|
6046
|
+
},
|
|
5924
6047
|
});
|
|
5925
6048
|
for (const urlType of Object.keys(resolutionConfig)) {
|
|
5926
6049
|
let resolver;
|
|
@@ -9007,6 +9130,7 @@ const getCorePlugins = ({
|
|
|
9007
9130
|
referenceAnalysis = {},
|
|
9008
9131
|
nodeEsmResolution = {},
|
|
9009
9132
|
packageConditions,
|
|
9133
|
+
packageConditionsConfig,
|
|
9010
9134
|
magicExtensions,
|
|
9011
9135
|
magicDirectoryIndex,
|
|
9012
9136
|
directoryListing = true,
|
|
@@ -9082,7 +9206,13 @@ const getCorePlugins = ({
|
|
|
9082
9206
|
},
|
|
9083
9207
|
},
|
|
9084
9208
|
...(nodeEsmResolution
|
|
9085
|
-
? [
|
|
9209
|
+
? [
|
|
9210
|
+
jsenvPluginNodeEsmResolution(
|
|
9211
|
+
nodeEsmResolution,
|
|
9212
|
+
packageConditions,
|
|
9213
|
+
packageConditionsConfig,
|
|
9214
|
+
),
|
|
9215
|
+
]
|
|
9086
9216
|
: []),
|
|
9087
9217
|
jsenvPluginWebResolution(),
|
|
9088
9218
|
jsenvPluginDirectoryReferenceEffect(directoryReferenceEffect, {
|
|
@@ -9293,6 +9423,8 @@ const startDevServer = async ({
|
|
|
9293
9423
|
plugins = [],
|
|
9294
9424
|
referenceAnalysis = {},
|
|
9295
9425
|
nodeEsmResolution,
|
|
9426
|
+
packageConditions,
|
|
9427
|
+
packageConditionsConfig,
|
|
9296
9428
|
supervisor = true,
|
|
9297
9429
|
magicExtensions,
|
|
9298
9430
|
magicDirectoryIndex,
|
|
@@ -9466,6 +9598,8 @@ const startDevServer = async ({
|
|
|
9466
9598
|
|
|
9467
9599
|
referenceAnalysis,
|
|
9468
9600
|
nodeEsmResolution,
|
|
9601
|
+
packageConditions,
|
|
9602
|
+
packageConditionsConfig,
|
|
9469
9603
|
magicExtensions,
|
|
9470
9604
|
magicDirectoryIndex,
|
|
9471
9605
|
directoryListing,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "40.8.
|
|
3
|
+
"version": "40.8.3",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -75,14 +75,14 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@financial-times/polyfill-useragent-normaliser": "1.10.2",
|
|
78
|
-
"@jsenv/ast": "6.7.
|
|
79
|
-
"@jsenv/js-module-fallback": "1.4.
|
|
80
|
-
"@jsenv/plugin-bundling": "2.9.
|
|
78
|
+
"@jsenv/ast": "6.7.8",
|
|
79
|
+
"@jsenv/js-module-fallback": "1.4.20",
|
|
80
|
+
"@jsenv/plugin-bundling": "2.9.10",
|
|
81
81
|
"@jsenv/plugin-minification": "1.7.0",
|
|
82
|
-
"@jsenv/plugin-supervisor": "1.7.
|
|
83
|
-
"@jsenv/plugin-transpilation": "1.5.
|
|
84
|
-
"@jsenv/server": "16.
|
|
85
|
-
"@jsenv/sourcemap": "1.3.
|
|
82
|
+
"@jsenv/plugin-supervisor": "1.7.5",
|
|
83
|
+
"@jsenv/plugin-transpilation": "1.5.52",
|
|
84
|
+
"@jsenv/server": "16.2.0",
|
|
85
|
+
"@jsenv/sourcemap": "1.3.10",
|
|
86
86
|
"react-table": "7.8.0"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
package/src/build/build.js
CHANGED
|
@@ -888,6 +888,7 @@ const entryPointDefaultParams = {
|
|
|
888
888
|
referenceAnalysis: {},
|
|
889
889
|
nodeEsmResolution: undefined,
|
|
890
890
|
packageConditions: undefined,
|
|
891
|
+
packageConditionsConfig: undefined,
|
|
891
892
|
magicExtensions: undefined,
|
|
892
893
|
magicDirectoryIndex: undefined,
|
|
893
894
|
directoryReferenceEffect: undefined,
|
|
@@ -940,6 +941,7 @@ const prepareEntryPointBuild = async (
|
|
|
940
941
|
referenceAnalysis,
|
|
941
942
|
nodeEsmResolution,
|
|
942
943
|
packageConditions,
|
|
944
|
+
packageConditionsConfig,
|
|
943
945
|
magicExtensions,
|
|
944
946
|
magicDirectoryIndex,
|
|
945
947
|
directoryReferenceEffect,
|
|
@@ -1091,6 +1093,7 @@ const prepareEntryPointBuild = async (
|
|
|
1091
1093
|
referenceAnalysis,
|
|
1092
1094
|
nodeEsmResolution,
|
|
1093
1095
|
packageConditions,
|
|
1096
|
+
packageConditionsConfig,
|
|
1094
1097
|
magicExtensions,
|
|
1095
1098
|
magicDirectoryIndex,
|
|
1096
1099
|
directoryReferenceEffect,
|
|
@@ -86,6 +86,8 @@ export const startDevServer = async ({
|
|
|
86
86
|
plugins = [],
|
|
87
87
|
referenceAnalysis = {},
|
|
88
88
|
nodeEsmResolution,
|
|
89
|
+
packageConditions,
|
|
90
|
+
packageConditionsConfig,
|
|
89
91
|
supervisor = true,
|
|
90
92
|
magicExtensions,
|
|
91
93
|
magicDirectoryIndex,
|
|
@@ -260,6 +262,8 @@ export const startDevServer = async ({
|
|
|
260
262
|
|
|
261
263
|
referenceAnalysis,
|
|
262
264
|
nodeEsmResolution,
|
|
265
|
+
packageConditions,
|
|
266
|
+
packageConditionsConfig,
|
|
263
267
|
magicExtensions,
|
|
264
268
|
magicDirectoryIndex,
|
|
265
269
|
directoryListing,
|
package/src/plugins/plugins.js
CHANGED
|
@@ -38,6 +38,7 @@ export const getCorePlugins = ({
|
|
|
38
38
|
referenceAnalysis = {},
|
|
39
39
|
nodeEsmResolution = {},
|
|
40
40
|
packageConditions,
|
|
41
|
+
packageConditionsConfig,
|
|
41
42
|
magicExtensions,
|
|
42
43
|
magicDirectoryIndex,
|
|
43
44
|
directoryListing = true,
|
|
@@ -113,7 +114,13 @@ export const getCorePlugins = ({
|
|
|
113
114
|
},
|
|
114
115
|
},
|
|
115
116
|
...(nodeEsmResolution
|
|
116
|
-
? [
|
|
117
|
+
? [
|
|
118
|
+
jsenvPluginNodeEsmResolution(
|
|
119
|
+
nodeEsmResolution,
|
|
120
|
+
packageConditions,
|
|
121
|
+
packageConditionsConfig,
|
|
122
|
+
),
|
|
123
|
+
]
|
|
117
124
|
: []),
|
|
118
125
|
jsenvPluginWebResolution(),
|
|
119
126
|
jsenvPluginDirectoryReferenceEffect(directoryReferenceEffect, {
|
|
@@ -3,6 +3,7 @@ import { createNodeEsmResolver } from "./node_esm_resolver.js";
|
|
|
3
3
|
export const jsenvPluginNodeEsmResolution = (
|
|
4
4
|
resolutionConfig = {},
|
|
5
5
|
packageConditions,
|
|
6
|
+
packageConditionsConfig = {},
|
|
6
7
|
) => {
|
|
7
8
|
let nodeEsmResolverDefault;
|
|
8
9
|
const resolverMap = new Map();
|
|
@@ -25,6 +26,10 @@ export const jsenvPluginNodeEsmResolution = (
|
|
|
25
26
|
runtimeCompat: kitchenContext.runtimeCompat,
|
|
26
27
|
rootDirectoryUrl: kitchenContext.rootDirectoryUrl,
|
|
27
28
|
packageConditions,
|
|
29
|
+
packageConditionsConfig: {
|
|
30
|
+
...kitchenContext.packageConditionsConfig,
|
|
31
|
+
...packageConditionsConfig,
|
|
32
|
+
},
|
|
28
33
|
preservesSymlink,
|
|
29
34
|
});
|
|
30
35
|
};
|
|
@@ -39,6 +44,10 @@ export const jsenvPluginNodeEsmResolution = (
|
|
|
39
44
|
rootDirectoryUrl: kitchenContext.rootDirectoryUrl,
|
|
40
45
|
preservesSymlink: true,
|
|
41
46
|
packageConditions,
|
|
47
|
+
packageConditionsConfig: {
|
|
48
|
+
...kitchenContext.packageConditionsConfig,
|
|
49
|
+
...packageConditionsConfig,
|
|
50
|
+
},
|
|
42
51
|
});
|
|
43
52
|
for (const urlType of Object.keys(resolutionConfig)) {
|
|
44
53
|
let resolver;
|