User commonjs export

This commit is contained in:
Renan Castro
2021-05-19 11:00:50 -03:00
parent 08fd20ec91
commit 685e321fac
3 changed files with 58 additions and 54 deletions

View File

@@ -998,65 +998,65 @@ compiler.eachUsedUnibuild = function (
export function isIsobuildFeaturePackage(packageName) {
return packageName.startsWith('isobuild:');
}
exports.KNOWN_ISOBUILD_FEATURE_PACKAGES =
// If you update this data structure to add more feature packages, you should
// update the wiki page here:
// https://docs.meteor.com/api/packagejs.html#isobuild-features
export const KNOWN_ISOBUILD_FEATURE_PACKAGES = {
// This package directly calls Plugin.registerCompiler. Package authors
// must explicitly depend on this feature package to use the API.
'isobuild:compiler-plugin': ['1.0.0'],
{
// This package directly calls Plugin.registerCompiler. Package authors
// must explicitly depend on this feature package to use the API.
'isobuild:compiler-plugin': ['1.0.0'],
// This package directly calls Plugin.registerMinifier. Package authors
// must explicitly depend on this feature package to use the API.
'isobuild:minifier-plugin': ['1.0.0'],
// This package directly calls Plugin.registerMinifier. Package authors
// must explicitly depend on this feature package to use the API.
'isobuild:minifier-plugin': ['1.0.0'],
// This package directly calls Plugin.registerLinter. Package authors
// must explicitly depend on this feature package to use the API.
'isobuild:linter-plugin': ['1.0.0'],
// This package directly calls Plugin.registerLinter. Package authors
// must explicitly depend on this feature package to use the API.
'isobuild:linter-plugin': ['1.0.0'],
// This package is only published in the isopack-2 format, not isopack-1 or
// older. ie, it contains "source" files for compiler plugins, not just
// JS/CSS/static assets/head/body.
// This is implicitly added at publish time to any such package; package
// authors don't have to add it explicitly. It isn't relevant for local
// packages, which can be rebuilt if possible by the older tool.
//
// Specifically, this is to avoid the case where a package is published with a
// dependency like `api.use('less@1.0.0 || 2.0.0')` and the publication
// selects the newer compiler plugin version to generate the isopack. The
// published package (if this feature package wasn't implicitly included)
// could still be selected by the Version Solver to be used with an old
// Isobuild... just because less@2.0.0 depends on isobuild:compiler-plugin
// doesn't mean it couldn't choose less@1.0.0, which is not actually
// compatible with this published package. (Constraints of the form described
// above are not very helpful, but at least we can prevent old Isobuilds from
// choking on confusing packages.)
//
// (Why not isobuild:isopack@2.0.0? Well, that would imply that Version Solver
// would have to choose only one isobuild:isopack feature version, which
// doesn't make sense here.)
'isobuild:isopack-2': ['1.0.0'],
// This package is only published in the isopack-2 format, not isopack-1 or
// older. ie, it contains "source" files for compiler plugins, not just
// JS/CSS/static assets/head/body.
// This is implicitly added at publish time to any such package; package
// authors don't have to add it explicitly. It isn't relevant for local
// packages, which can be rebuilt if possible by the older tool.
//
// Specifically, this is to avoid the case where a package is published with a
// dependency like `api.use('less@1.0.0 || 2.0.0')` and the publication
// selects the newer compiler plugin version to generate the isopack. The
// published package (if this feature package wasn't implicitly included)
// could still be selected by the Version Solver to be used with an old
// Isobuild... just because less@2.0.0 depends on isobuild:compiler-plugin
// doesn't mean it couldn't choose less@1.0.0, which is not actually
// compatible with this published package. (Constraints of the form described
// above are not very helpful, but at least we can prevent old Isobuilds from
// choking on confusing packages.)
//
// (Why not isobuild:isopack@2.0.0? Well, that would imply that Version Solver
// would have to choose only one isobuild:isopack feature version, which
// doesn't make sense here.)
'isobuild:isopack-2': ['1.0.0'],
// This package uses the `prodOnly` metadata flag, which causes it to
// automatically depend on the `isobuild:prod-only` feature package.
'isobuild:prod-only': ['1.0.0'],
// This package uses the `prodOnly` metadata flag, which causes it to
// automatically depend on the `isobuild:prod-only` feature package.
'isobuild:prod-only': ['1.0.0'],
// This package depends on a specific version of Cordova. Package authors must
// explicitly depend on this feature package to indicate that they are not
// compatible with earlier Cordova versions, which is most likely a result of
// the Cordova plugins they depend on.
// One scenario is a package depending on a Cordova plugin or version
// that is only available on npm, which means downloading the plugin is not
// supported on versions of Cordova below 5.0.0.
'isobuild:cordova': ['5.4.0'],
// This package depends on a specific version of Cordova. Package authors must
// explicitly depend on this feature package to indicate that they are not
// compatible with earlier Cordova versions, which is most likely a result of
// the Cordova plugins they depend on.
// One scenario is a package depending on a Cordova plugin or version
// that is only available on npm, which means downloading the plugin is not
// supported on versions of Cordova below 5.0.0.
'isobuild:cordova': ['5.4.0'],
// This package requires functionality introduced in meteor-tool@1.5.0
// to enable dynamic module fetching via import(...).
'isobuild:dynamic-import': ['1.5.0'],
// This package requires functionality introduced in meteor-tool@1.5.0
// to enable dynamic module fetching via import(...).
'isobuild:dynamic-import': ['1.5.0'],
// This package ensures that processFilesFor{Bundle,Target,Package} are
// allowed to return a Promise instead of having to await async
// compilation using fibers and/or futures.
'isobuild:async-plugins': ['1.6.1'],
};
// This package ensures that processFilesFor{Bundle,Target,Package} are
// allowed to return a Promise instead of having to await async
// compilation using fibers and/or futures.
'isobuild:async-plugins': ['1.6.1'],
};

View File

@@ -1,9 +1,11 @@
var _ = require('underscore');
var buildmessage = require('../../utils/buildmessage.js');
var files = require('../../fs/files');
var watch = require('../../fs/watch');
var KNOWN_ISOBUILD_FEATURE_PACKAGES = require('../../isobuild/compiler.js').KNOWN_ISOBUILD_FEATURE_PACKAGES;
var PackageSource = require('../../isobuild/package-source.js');
import { KNOWN_ISOBUILD_FEATURE_PACKAGES } from '../../isobuild/compiler.js';
import { sync as glob } from "glob";
import { Profile } from "../../tool-env/profile";
import {

View File

@@ -1,3 +1,4 @@
var assert = require("assert");
var _ = require('underscore');
@@ -15,7 +16,8 @@ var tropohouse = require('./packaging/tropohouse.js');
var utils = require('./utils/utils.js');
var watch = require('./fs/watch');
var Profile = require('./tool-env/profile').Profile;
import { KNOWN_ISOBUILD_FEATURE_PACKAGES } from './isobuild/compiler.js';
var KNOWN_ISOBUILD_FEATURE_PACKAGES = require('./isobuild/compiler.js').KNOWN_ISOBUILD_FEATURE_PACKAGES
import {
optimisticReadJsonOrNull,