Skip to content

Commit

Permalink
👽️ Apply changes from external libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
skerit committed Jul 25, 2024
1 parent 41c448c commit b245ee0
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 20 deletions.
2 changes: 1 addition & 1 deletion lib/app/helper/alchemy_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ Alchemy.setMethod(function segment(options, data) {
route;

if (Blast.isNode) {
conduit = that.view.server_var('conduit');
conduit = that.view.serverVar('conduit');

if (!conduit) {
return next(null, '<!-- Failed to render segment ' + options.name + ': no conduit found -->');
Expand Down
27 changes: 17 additions & 10 deletions lib/app/helper/router_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,19 @@ Router.setProperty(function current_url() {
*
* @author Jelle De Loecker <[email protected]>
* @since 1.3.10
* @version 1.3.10
* @version 1.4.0
*
* @type {Object}
*/
Router.setProperty(function current_route() {

let route_name = this.view_render?.variables?.__route;
const variables = this.view_render?.variables;

if (!variables) {
return;
}

let route_name = variables.get('__route');

if (!route_name) {
return;
Expand Down Expand Up @@ -157,7 +163,7 @@ Router.setMethod(function applyDirective(element, name, options) {
let variables = element[Hawkejs.VARIABLES];

if (variables) {
val = variables[key];
val = variables.get(key);
}
}

Expand Down Expand Up @@ -215,7 +221,7 @@ Router.setMethod(function applyDirective(element, name, options) {
element.setAttribute('hreflang', url._chosen_prefix);
}

if (config && this.renderer.variables.__route) {
if (config && this.renderer.variables.get('__route')) {
let route = this.current_route;

if (route && route.section != config.section) {
Expand Down Expand Up @@ -792,20 +798,21 @@ Router.setMethod(function getAnchor(name, parameters, options) {
*
* @author Jelle De Loecker <[email protected]>
* @since 1.2.5
* @version 1.2.5
* @version 1.4.0
*
* @return {Object}
*/
Router.setMethod(function getRouteVariables() {

const variables = this.view_render?.variables;

let params,
route,
route = variables?.get?.('__route'),
url;

if (this.view_render?.variables?.__route) {
route = this.view_render.variables.__route;
params = this.view_render.variables.__urlparams;
url = this.view_render.variables.__url;
if (route) {
params = variables.get('__urlparams');
url = variables.get('__url');
} else if (Blast.isBrowser) {
route = alchemy.current_route;
params = alchemy.current_url_params;
Expand Down
4 changes: 2 additions & 2 deletions lib/app/helper_datasource/schema_operational_context.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const SchemaContext = Function.inherits('Alchemy.OperationalContext.DatasourceOp
* @since 1.4.0
* @version 1.4.0
*
* @param {Object} string
* @param {string} sub_schema_path
*/
SchemaContext.setContextProperty('sub_schema_path');

Expand Down Expand Up @@ -49,7 +49,7 @@ SchemaContext.setContextProperty('value_property_name');
* @since 1.4.0
* @version 1.4.0
*
* @param {string} value_property_name
* @param {string} local_value
*/
SchemaContext.setContextProperty('local_value');

Expand Down
9 changes: 4 additions & 5 deletions lib/app/helper_model/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,14 @@ Document.setStatic(function getDocumentClass(model_param) {
let model = Blast.Classes.Alchemy.Client.Model.Model.getClass(model_name);

if (model && model.super) {
parent = model.super.name;
parent = model.super.model_name;
}
} else if (Blast.isNode) {
config = alchemy.getModel(model_name, false);

if (config && config.super) {
config = {
parent : config.super.name
parent : config.super.model_name
};
}
}
Expand All @@ -317,9 +317,8 @@ Document.setStatic(function getDocumentClass(model_param) {

if (parent && parent != 'Model') {
// Make sure the parent class exists
getDocumentClass(parent);

parent_path += '.' + parent;
let parent_constructor = getDocumentClass(parent);
parent_path = parent_constructor.namespace + '.' + parent_constructor.name;
}

DocClass = Function.inherits(parent_path, target_ns, doc_constructor);
Expand Down
4 changes: 2 additions & 2 deletions lib/class/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ RouterClass.setMethod(function use(_paths, _fnc, _options) {
*
* @author Jelle De Loecker <[email protected]>
* @since 1.1.0
* @version 1.3.0
* @version 1.4.0
*
* @param {string} module_name The name of the dependency
* @param {Object} options The options or single string
Expand Down Expand Up @@ -744,7 +744,7 @@ RouterClass.setMethod(function serveDependencyFile(module_name, options) {
// Cache this file so earlier middleware can handle this from now on
alchemy.getCache('files.assets').set(req.url, {path: options.path});

req.conduit.serveFile(options.path);
req.conduit.serveFile(options.path, options?.serve_options);
});
});

Expand Down
1 change: 1 addition & 0 deletions lib/class/schema_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@ Schema.setMethod(function addIndex(_field, _options) {
// Set the default options
options = Object.assign({}, this.indexOptions, options);

// @TODO: Set the `this.indexes` properly, even when a name is given
const setIndexName = () => {

if (options.name) {
Expand Down
4 changes: 4 additions & 0 deletions lib/core/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,10 @@ Alchemy.setMethod(function minifyScript(path, options, callback) {
mangle: {
keep_fnames : true,
keep_classnames : true,

// We have to prevent `Blast` variable names from being
// mangled, or our replacement trickery will break things
reserved : ['Blast'],
},
output: {
// Do not wrap functions that are arguments in parenthesis
Expand Down
2 changes: 2 additions & 0 deletions lib/stages/50-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const hawkejs = routes.createStage('hawkejs', () => {
create_source_map : alchemy.getSetting('debugging.create_source_map'),
enable_coverage : !!global.__coverage__,
debug : alchemy.getSetting('debugging.debug'),
environment : alchemy.environment,
}).done(gotClientFile);

function gotClientFile(err, path) {
Expand Down Expand Up @@ -81,6 +82,7 @@ const hawkejs = routes.createStage('hawkejs', () => {
ua : req.conduit.headers.useragent,
create_source_map : alchemy.getSetting('debugging.create_source_map'),
debug : alchemy.getSetting('debugging.debug'),
environment : alchemy.environment,
}).done(gotClientFile);
}
});
Expand Down

0 comments on commit b245ee0

Please sign in to comment.