Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Rename alias!$data to alias!$aliases-data #1660

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.bladerunnerjs.api.model.exception.UnresolvableRequirePathException;
import org.bladerunnerjs.api.model.exception.request.ContentProcessingException;
import org.bladerunnerjs.api.spec.engine.SpecTest;
import org.bladerunnerjs.plugin.plugins.require.AliasDataSourceModule;
import org.bladerunnerjs.utility.BundleSetBuilder;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -373,7 +374,7 @@ public void badRequiresAreLoggedWhenStrictCheckingIsDisabled() throws Exception
@Test
public void badRequiresAreNotLoggedForNoneScopeEnforcedSourceModules() throws Exception {
given(aspect).indexPageRequires("appns/b1/Blade1Class")
.and(blade1InDefaultBladeset).classRequires("Blade1Class", "alias!$data")
.and(blade1InDefaultBladeset).classRequires("Blade1Class", AliasDataSourceModule.PRIMARY_REQUIRE_PATH)
.and(logging).enabled();
when(aspect).requestReceivedInDev("js/dev/combined/bundle.js", response);
then(logging).doesNotContainWarnMessage(BundleSetBuilder.INVALID_REQUIRE_MSG);
Expand Down
2 changes: 1 addition & 1 deletion brjs-sdk/sdk/libs/javascript/br/src/br/AliasRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ var AliasRegistryClass = require('br/AliasRegistryClass');
/**
* @type module:br/AliasRegistryClass
*/
module.exports = new AliasRegistryClass(require('alias!$data'));
module.exports = new AliasRegistryClass(require('alias!$aliases-data'));
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

public class AliasDataSourceModule implements CommonJsSourceModule {
private final BundlableNode bundlableNode;
public static final String PRIMARY_REQUIRE_PATH = "alias!$data";
public static final String PRIMARY_REQUIRE_PATH = "alias!$aliases-data";

public AliasDataSourceModule(BundlableNode bundlableNode) {
this.bundlableNode = bundlableNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.bladerunnerjs.plugin.bundlers.aliasing.AmbiguousAliasException;
import org.bladerunnerjs.plugin.bundlers.aliasing.IncompleteAliasException;
import org.bladerunnerjs.plugin.bundlers.aliasing.UnresolvableAliasException;
import org.bladerunnerjs.plugin.plugins.require.AliasDataSourceModule;
import org.bladerunnerjs.utility.FileUtils;
import org.junit.Before;
import org.junit.Ignore;
Expand Down Expand Up @@ -336,7 +337,7 @@ public void aliasesAreNotSetIfTheAliasRegistryClassIsNotUsed() throws Exception
@Test
public void theAliasBlobIsEmptyIfNoAliasesAreUsed() throws Exception
{
given(aspect).classRequires("appns/Class1", "alias!$data")
given(aspect).classRequires("appns/Class1", AliasDataSourceModule.PRIMARY_REQUIRE_PATH)
.and(aspectAliasesFile).hasAlias("the-alias", "appns.Class1")
.and(aspect).indexPageRefersTo("appns.Class1");
when(aspect).requestReceivedInDev("js/dev/combined/bundle.js", response);
Expand All @@ -346,7 +347,7 @@ public void theAliasBlobIsEmptyIfNoAliasesAreUsed() throws Exception
@Test
public void theAliasBlobContainsAClassReferencedByAlias() throws Exception
{
given(aspect).classRequires("appns/Class1", "alias!$data")
given(aspect).classRequires("appns/Class1", AliasDataSourceModule.PRIMARY_REQUIRE_PATH)
.and(aspectAliasesFile).hasAlias("the-alias", "appns.Class1")
.and(aspect).indexPageHasAliasReferences("the-alias");
when(aspect).requestReceivedInDev("js/dev/combined/bundle.js", response);
Expand Down Expand Up @@ -564,7 +565,7 @@ public void aliasDataIsIncludedInTheBundleWhenAliasesAreUsedInANamespacedJsAspec
.and(aspect).hasClass("appns.ServiceClass")
.and(aspect).indexPageRefersTo("appns.App");
when(aspect).requestReceivedInDev("js/dev/combined/bundle.js", response);
then(response).containsText("define('alias!$data'")
then(response).containsText("define('" + AliasDataSourceModule.PRIMARY_REQUIRE_PATH + "'")
.and(response).containsText("define('alias!some.service'");
}

Expand All @@ -577,7 +578,7 @@ public void aliasDataIsIncludedInTheBundleWhenServicesAreUsedInANamespacedJsAspe
.and(aspect).classFileHasContent("appns.App", "ServiceRegistry.getService('some.service')")
.and(aspect).indexPageRefersTo("appns.App");
when(aspect).requestReceivedInDev("js/dev/combined/bundle.js", response);
then(response).containsText("define('alias!$data'")
then(response).containsText("define('" + AliasDataSourceModule.PRIMARY_REQUIRE_PATH + "'")
.and(response).containsText("define('alias!some.service'");
}

Expand All @@ -590,7 +591,7 @@ public void aliasesAndDataIsIncludedInTheBundleWhenServicesFromACommonJSLibraryA
.and(aspect).classFileHasContent("appns.App", "ServiceRegistry.getService('br.service')")
.and(aspect).indexPageRefersTo("appns.App");
when(aspect).requestReceivedInDev("js/dev/combined/bundle.js", response);
then(response).containsText("define('alias!$data'")
then(response).containsText("define('" + AliasDataSourceModule.PRIMARY_REQUIRE_PATH + "'")
.and(response).containsText("define('alias!br.service'");
}

Expand All @@ -604,7 +605,7 @@ public void aliasesAndDataIsIncludedInTheBundleWhenServicesFromANamespacedSLibra
.and(aspect).classFileHasContent("appns.App", "ServiceRegistry.getService('br.service')")
.and(aspect).indexPageRefersTo("appns.App");
when(aspect).requestReceivedInDev("js/dev/combined/bundle.js", response);
then(response).containsText("define('alias!$data'")
then(response).containsText("define('" + AliasDataSourceModule.PRIMARY_REQUIRE_PATH + "'")
.and(response).containsText("define('alias!br.service'");
}

Expand All @@ -621,7 +622,7 @@ public void aliasesAndDataIsIncludedInTheBundleWhenServicesFromANamespacedJSLibr
.and(aspect).classFileHasContent("appns.App", "otherBrLib.ServiceUser();")
.and(aspect).indexPageRefersTo("appns.App");
when(aspect).requestReceivedInDev("js/dev/combined/bundle.js", response);
then(response).containsText("define('alias!$data'")
then(response).containsText("define('" + AliasDataSourceModule.PRIMARY_REQUIRE_PATH + "'")
.and(response).containsText("define('alias!lib.service'")
.and(response).containsText("otherBrLib.ServiceUser();");
}
Expand All @@ -640,7 +641,7 @@ public void scenarioAliasesAndDataIsIncludedInTheBundleWhenServicesFromANamespac
.and(aspect).classFileHasContent("appns.App", "otherBrLib.ServiceUser();")
.and(aspect).indexPageRefersTo("appns.App");
when(aspect).requestReceivedInDev("js/dev/combined/bundle.js", response);
then(response).containsText("define('alias!$data'")
then(response).containsText("define('" + AliasDataSourceModule.PRIMARY_REQUIRE_PATH + "'")
.and(response).containsText("define('alias!lib.service'")
.and(response).containsText("otherBrLib.ServiceUser();");
}
Expand All @@ -663,7 +664,7 @@ public void theLocaleSwitcherAliasCanBeOverridden() throws Exception {
brLibAliasDefinitionsFile = new AliasDefinitionsFileBuilder(this, aliasDefinitionsFile(brLib, "resources"));
given(brLocaleLib).classFileHasContent("switcher", "require('service!br.locale-switcher').switchLocale();")
.and(servicesLib).classFileHasContent("br/ServiceRegistry", "require('./AliasRegistry');")
.and(servicesLib).classFileHasContent("br/AliasRegistry", "require('alias!$data');")
.and(servicesLib).classFileHasContent("br/AliasRegistry", "require('" + AliasDataSourceModule.PRIMARY_REQUIRE_PATH + "');")
.and(brLib).hasClasses("br/services/LocaleSwitcher")
.and(brLib).classFileHasContent("br/services/BRLocaleLoadingSwitcher", "require('br/services/LocaleSwitcher');")
.and(brLib).classFileHasContent("br/services/BRLocaleForwardingSwitcher", "require('br/services/LocaleSwitcher');")
Expand Down Expand Up @@ -1026,13 +1027,13 @@ public void nestedAliasDefinitionsFilesCanBeUsedInResourcesDirectories() throws

@Test
public void testPackBundlesCanBeCreatedForAspectDefaultTechTestsWhereAliasRegistryIsUsed() throws Exception {
given(aspect).classRequires("appns/Class1", "alias!$data")
given(aspect).classRequires("appns/Class1", AliasDataSourceModule.PRIMARY_REQUIRE_PATH)
.and( aspect.testType("unit").defaultTestTech() ).hasNamespacedJsPackageStyle()
.and( aspect.testType("unit").defaultTestTech() ).testRefersTo("pkg/test.js", "appns.Class1")
.and( aspect.testType("unit").defaultTestTech() ).containsResourceFileWithContents("en.properties", "appns.prop=val")
.and(sdkLib).hasClass("br/AliasRegistry");
when( aspect.testType("unit").defaultTestTech() ).requestReceivedInDev("js/dev/combined/bundle.js", response);
then(response).containsText("define('alias!$data'")
then(response).containsText("define('" + AliasDataSourceModule.PRIMARY_REQUIRE_PATH + "'")
.and(response).containsText("define('appns/Class1'");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.bladerunnerjs.api.spec.engine.SpecTest;
import org.bladerunnerjs.model.SdkJsLib;
import org.bladerunnerjs.plugin.commands.standard.ApplicationDepsCommand;
import org.bladerunnerjs.plugin.plugins.require.AliasDataSourceModule;
import org.bladerunnerjs.spec.aliasing.AliasDefinitionsFileBuilder;
import org.bladerunnerjs.spec.aliasing.AliasesFileBuilder;
import org.junit.Before;
Expand Down Expand Up @@ -270,7 +271,7 @@ public void incompleteAliasedDependenciesAreCorrectlyDisplayed() throws Exceptio
" +--- '../../libs/javascript/br/src/br/UnknownClass.js'",
" +--- 'alias!appns.bs.b1.alias-ref' (alias dep.)",
" | \\--- 'default-aspect/src/appns/Interface.js' (static dep.)",
" | \\--- 'alias!$data' (static dep.)",
" | \\--- '" + AliasDataSourceModule.PRIMARY_REQUIRE_PATH + "' (static dep.)",
" +--- 'default-aspect/index.html' (seed file)");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.bladerunnerjs.api.model.exception.command.NodeDoesNotExistException;
import org.bladerunnerjs.api.spec.engine.SpecTest;
import org.bladerunnerjs.plugin.commands.standard.DepInsightCommand;
import org.bladerunnerjs.plugin.plugins.require.AliasDataSourceModule;
import org.bladerunnerjs.spec.aliasing.AliasDefinitionsFileBuilder;
import org.bladerunnerjs.spec.aliasing.AliasesFileBuilder;
import org.junit.Before;
Expand Down Expand Up @@ -272,7 +273,7 @@ public void aliasedDependenciesAreCorrectlyDisplayed() throws Exception {
" | \\--- 'alias!alias-ref' (alias dep.)",
" | | \\--- 'default-aspect/index.html' (seed file)",
" +--- 'default-aspect/src/appns/Class.js'",
" +--- 'alias!$data' (alias dep.)");
" +--- '" + AliasDataSourceModule.PRIMARY_REQUIRE_PATH + "' (alias dep.)");
}

@Test
Expand All @@ -287,7 +288,7 @@ public void weCanShowDependenciesForAnAliasToo() throws Exception {
" | \\--- 'alias!alias-ref' (alias dep.)",
" | | \\--- 'default-aspect/index.html' (seed file)",
" +--- 'default-aspect/src/appns/Class.js'",
" +--- 'alias!$data' (alias dep.)");
" +--- '" + AliasDataSourceModule.PRIMARY_REQUIRE_PATH + "' (alias dep.)");
}

@Test
Expand All @@ -302,7 +303,7 @@ public void anAliasNameWithASpaceIsntMistakenlyRecognizedAsAnAspect() throws Exc
" | \\--- 'alias!alias ref' (alias dep.)",
" | | \\--- 'default-aspect/index.html' (seed file)",
" +--- 'default-aspect/src/appns/Class.js'",
" +--- 'alias!$data' (alias dep.)");
" +--- '" + AliasDataSourceModule.PRIMARY_REQUIRE_PATH + "' (alias dep.)");
}

@Ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.bladerunnerjs.api.BladeWorkbench;
import org.bladerunnerjs.plugin.bundlers.aliasing.AliasDefinitionsFile;
import org.bladerunnerjs.plugin.commands.standard.WorkbenchDepsCommand;
import org.bladerunnerjs.plugin.plugins.require.AliasDataSourceModule;
import org.bladerunnerjs.spec.aliasing.AliasDefinitionsFileBuilder;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -191,7 +192,7 @@ public void dependenciesAreShownForWorkbenchUsingAliasWhenAllArgumentsAreValid()
" +--- 'alias!br.alias' (alias dep.)",
" | \\--- '../../libs/javascript/ServicesLib/src/br/AliasRegistry.js' (static dep.)",
" | \\--- '../../libs/javascript/br/src/br/Class2.js' (static dep.)",
" | \\--- 'alias!$data' (static dep.)",
" | \\--- '" + AliasDataSourceModule.PRIMARY_REQUIRE_PATH + "' (static dep.)",
" +--- 'bladeset-bladeset/blades/blade/src/appns/bladeset/blade/Class1.js'",
" +--- 'bladeset-bladeset/blades/blade/workbench/index.html' (seed file)");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.bladerunnerjs.api.App;
import org.bladerunnerjs.api.Aspect;
import org.bladerunnerjs.api.spec.engine.SpecTest;
import org.bladerunnerjs.plugin.plugins.require.AliasDataSourceModule;
import org.junit.Before;
import org.junit.Test;

Expand Down Expand Up @@ -45,7 +46,7 @@ public void wrappingFunctionShouldNotAddNewLine() throws Exception
given(aspect).hasCommonJsPackageStyle();
when(aspect).requestReceivedInDev("js/dev/combined/bundle.js", response);
then(response).doesNotContainText("define('br/AliasRegistry', function(require, exports, module) {\n");
then(response).doesNotContainText("define('alias!$data', function(require, exports, module) {\n");
then(response).doesNotContainText("define('alias!$data', function(require, exports, module) {\n");
then(response).doesNotContainText("define('" + AliasDataSourceModule.PRIMARY_REQUIRE_PATH + "', function(require, exports, module) {\n");
then(response).doesNotContainText("define('" + AliasDataSourceModule.PRIMARY_REQUIRE_PATH + "', function(require, exports, module) {\n");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.bladerunnerjs.api.Aspect;
import org.bladerunnerjs.api.spec.engine.SpecTest;
import org.bladerunnerjs.model.SdkJsLib;
import org.bladerunnerjs.plugin.plugins.require.AliasDataSourceModule;
import org.bladerunnerjs.spec.aliasing.AliasesFileBuilder;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -87,7 +88,7 @@ public void wrappingFunctionShouldNotAddNewLine() throws Exception
given(aspect).hasNamespacedJsPackageStyle();
when(aspect).requestReceivedInDev("js/dev/combined/bundle.js", response);
then(response).doesNotContainText("define('br/AliasRegistry', function(require, exports, module) {\n");
then(response).doesNotContainText("define('alias!$data', function(require, exports, module) {\n");
then(response).doesNotContainText("define('alias!$data', function(require, exports, module) {\n");
then(response).doesNotContainText("define('" + AliasDataSourceModule.PRIMARY_REQUIRE_PATH + "', function(require, exports, module) {\n");
then(response).doesNotContainText("define('" + AliasDataSourceModule.PRIMARY_REQUIRE_PATH + "', function(require, exports, module) {\n");
}
}