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

merge master #6

Merged
merged 46 commits into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
f26ae66
Automatad Bid Adapter: changes to ajax request options for bid reques…
May 31, 2022
0354c00
Various Magnite Adapters: GVL ID update (#8501)
bretg May 31, 2022
97f2a8b
Adf adapter: avoid preflight request (#8498)
braizhas May 31, 2022
fffd1f3
Hadron RTD module: use internal methods (#8496)
jlaso May 31, 2022
611338b
using internal methods for loading external scripts in medianetRtdPro…
monis0395 Jun 1, 2022
74e7d20
Criteo - Update Publisher Tag version referenced by prebid adapter (#…
leonardlabat Jun 1, 2022
60d8fd6
Kargo Bid Adapter: onTimeout Support (#8449)
jsadwith Jun 1, 2022
4a8d6d0
Prebid 6.28.0 release
prebidjs-release Jun 1, 2022
08622d3
Increment version to 6.29.0-pre
prebidjs-release Jun 1, 2022
72732f8
CAPT-74: Pass ext section of each bid for prebid slot ID and GPID (#8…
ecammit Jun 1, 2022
f97f3df
Insticator Bid adapter: Adds Support for Video (#8452)
EugeneVigonny Jun 1, 2022
5ece4bb
Gdpr Enforcement module and sharedId/pubCommonId modules: vendor cons…
goldun Jun 2, 2022
11fd250
PubMatic Analytics Adapter : Added support for logging multiple bids …
pm-azhar-mulla Jun 6, 2022
80f86b1
AdOcean bid adapter: support for SupplyChain object (#8518)
mmuras Jun 6, 2022
2118146
Taboola Bid Adapter: api support for https (#8520)
mikizi Jun 6, 2022
2e940b1
ixBidAdapter: change to new endpoint and README (#8529)
ix-peiyuan Jun 7, 2022
a2fcadf
Vidazoo bid adapter: fix spurious test failure (#8515)
dgirardi Jun 7, 2022
302411b
Added support for IDs for multiple sources (#8499)
Nick-Merkle Jun 7, 2022
4d786ee
Prebid 6.29.0 release
prebidjs-release Jun 8, 2022
105ef94
Increment version to 7.0.0-pre
prebidjs-release Jun 8, 2022
6f4fb5b
Prebid 7 (#8530)
patmmccann Jun 8, 2022
ee86cb0
Prebid 7.0.0 release
prebidjs-release Jun 8, 2022
f3fe2aa
Increment version to 7.1.0-pre
prebidjs-release Jun 8, 2022
3b4fce8
Consent management: update GDPR example (#8525)
dgirardi Jun 8, 2022
f5cf0eb
AdxPremium analytics adapter: do not generate network activity after …
dgirardi Jun 8, 2022
9f14ab2
Triplelift Bid Adapter: get opeCloud data from local storage (#8542)
nllerandi3lift Jun 8, 2022
5f9d9d0
* add floor prices to the prebid request (#8507)
MichaelErmer Jun 9, 2022
ee8ab7b
Aduptech bid adapter: fix failing test (#8548)
dgirardi Jun 9, 2022
2eee11d
Cwire Bid Adapter: fix cwcreative parameter conversion (#8544)
espen-j Jun 9, 2022
ba28444
Prebid core: fix logic detecting if prebid is already loaded (#8549)
dgirardi Jun 9, 2022
6d66da7
TrafficGate Bid Adapter: add new bid adapter (#8328)
vlaktion Jun 10, 2022
5584057
Add piano dmp analytics adapter (#8413)
DmitriyMishutin Jun 10, 2022
f2f87e7
CAPT-252: Synacormedia bid adapter: add tmax to requests based upon p…
ecammit Jun 10, 2022
c607656
Consent management: use last consent provided by CMP on timeout (#8524)
dgirardi Jun 13, 2022
90c9d77
Prebid Core: Library support (#8527)
karimMourra Jun 14, 2022
c4fb4e6
Prebid 7.1.0 release
prebidjs-release Jun 14, 2022
8dc235c
Increment version to 7.2.0-pre
prebidjs-release Jun 14, 2022
033eac2
[criteoBidAdapter] Update HEM collection documentation (#8556)
FlorentDancy Jun 14, 2022
9858633
IX Bid Adapter: Outstream Video Float Support (#8528)
lksharma Jun 14, 2022
c31d51a
StroeerCore bid adapter: add page URL to bid request (#8469)
philipwatson Jun 14, 2022
da46bf2
Prebid core: automatic dynamic loading of debugging module (#8106)
dgirardi Jun 14, 2022
dc7d8d3
Prebid Core: Resolved warning in console during allowedAlternateBidde…
pm-azhar-mulla Jun 14, 2022
48ad719
Reset ID system at end of parrable tests (#8560)
dgirardi Jun 14, 2022
f7dca5b
Criteo Id System: add support for user sync pixels (#8555)
afewcc Jun 14, 2022
28b429b
Blueconic RTD submodule: initial release (#8419)
Soni-Goyal Jun 14, 2022
5e1c581
IDX Bid Adaper: added new bid adapter (#8531)
ffqs Jun 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions PR_REVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ Follow steps above for general review process. In addition:
- Consider whether the kind of data the module is obtaining could have privacy implications. If so, make sure they're utilizing the `consent` data passed to them.
- Make sure there's a docs pull request

### Reviewing changes to the `debugging` module

The debugging module cannot import from core in the same way that other modules can. See this [warning](https://github.com/prebid/Prebid.js/blob/master/modules/debugging/WARNING.md) for more details.

## Ticket Coordinator

Each week, Prebid Org assigns one person to keep an eye on incoming issues and PRs. Every Monday morning a reminder is sent to the prebid-js slack channel with a link to the spreadsheet. If you're on rotation, please check that list each Monday to see if you're on-duty.
Expand Down
6 changes: 3 additions & 3 deletions babelConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function useLocal(module) {
})
}

module.exports = function (test = false) {
module.exports = function (options = {}) {
return {
'presets': [
[
Expand All @@ -18,12 +18,12 @@ module.exports = function (test = false) {
'useBuiltIns': 'entry',
'corejs': '3.13.0',
// a lot of tests use sinon.stub & others that stopped working on ES6 modules with webpack 5
'modules': test ? 'commonjs' : 'auto',
'modules': options.test ? 'commonjs' : 'auto',
}
]
],
'plugins': [
path.resolve(__dirname, './plugins/pbjsGlobals.js'),
[path.resolve(__dirname, './plugins/pbjsGlobals.js'), options],
useLocal('babel-plugin-transform-object-assign'),
],
}
Expand Down
16 changes: 16 additions & 0 deletions bundle-template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* <%= prebid.name %> v<%= prebid.version %>
Updated: <%= (new Date()).toISOString().substring(0, 10) %>
Modules: <%= modules %> */

if (!window.<%= prebid.globalVarName %> || !window.<%= prebid.globalVarName %>.libLoaded) {
$$PREBID_SOURCE$$
<% if(enable) {%>
<%= prebid.globalVarName %>.processQueue();
<% } %>
} else {
try {
if(window.<%= prebid.globalVarName %>.getConfig('debug')) {
console.warn('Attempted to load a copy of Prebid.js that clashes with the existing \'<%= prebid.globalVarName %>\' instance. Load aborted.');
}
} catch (e) {}
}
69 changes: 53 additions & 16 deletions gulpHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ const MANIFEST = 'package.json';
const through = require('through2');
const _ = require('lodash');
const gutil = require('gulp-util');
const submodules = require('./modules/.submodules.json');
const dependencyMap = require('./modules/.submodules.json');
const submodules = dependencyMap.parentModules;
const libraries = dependencyMap.libraries;

const MODULE_PATH = './modules';
const LIBRARY_PATH = './libraries';
const BUILD_PATH = './build/dist';
const DEV_PATH = './build/dev';
const ANALYTICS_PATH = '../analytics';
Expand Down Expand Up @@ -68,34 +71,68 @@ module.exports = {
}
});

Object.keys(libraries).forEach(library => {
if (!modules.includes(library) && modules.some(module => libraries[library].dependants.includes(module))) {
modules.unshift(library);
}
});

return modules;
},
getParentLibraries(moduleName) {
const libraryNames = [];
Object.keys(libraries).forEach(libraryName => {
const library = libraries[libraryName];
if (library.dependants.includes(moduleName)) {
libraryNames.push(libraryName);
}
});
return libraryNames;
},
getLibraryFiles(name) {
const library = libraries[name];
const files = library.files.map(file => require.resolve(file, {paths: ['./libraries/' + name + '/']}));
return files;
},
isLibrary(name) {
return !!libraries[name];
},
getModules: _.memoize(function(externalModules) {
externalModules = externalModules || [];
var internalModules;
try {
var getInternalModules = function(absolutePath) {
return fs.readdirSync(absolutePath)
.filter(file => (/^[^\.]+(\.js)?$/).test(file))
.reduce((memo, file) => {
var moduleName = file.split(new RegExp('[.\\' + path.sep + ']'))[0];
var modulePath = path.join(absolutePath, file);
if (fs.lstatSync(modulePath).isDirectory()) {
modulePath = path.join(modulePath, 'index.js')
}
if (fs.existsSync(modulePath)) {
memo[modulePath] = moduleName;
}
return memo;
}, {});
};

var absoluteModulePath = path.join(__dirname, MODULE_PATH);
internalModules = fs.readdirSync(absoluteModulePath)
.filter(file => (/^[^\.]+(\.js)?$/).test(file))
.reduce((memo, file) => {
var moduleName = file.split(new RegExp('[.\\' + path.sep + ']'))[0];
var modulePath = path.join(absoluteModulePath, file);
if (fs.lstatSync(modulePath).isDirectory()) {
modulePath = path.join(modulePath, 'index.js')
}
if (fs.existsSync(modulePath)) {
memo[modulePath] = moduleName;
}
return memo;
}, {});
var absoluteLibraryPath = path.join(__dirname, LIBRARY_PATH);

internalModules = getInternalModules(absoluteModulePath);
var internalLibraries = getInternalModules(absoluteLibraryPath);
Object.assign(internalModules, internalLibraries);
} catch (err) {
internalModules = {};
}
return Object.assign(externalModules.reduce((memo, module) => {
try {
// prefer internal project modules before looking at project dependencies
var modulePath = require.resolve(module, {paths: ['./modules']});
if (modulePath === '') modulePath = require.resolve(module);
var modulePath = require.resolve(module, {paths: [MODULE_PATH, LIBRARY_PATH]});
if (modulePath === '') {
modulePath = require.resolve(module);
}

memo[modulePath] = module;
} catch (err) {
Expand Down
87 changes: 62 additions & 25 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ var opens = require('opn');
var webpackConfig = require('./webpack.conf.js');
var helpers = require('./gulpHelpers.js');
var concat = require('gulp-concat');
var header = require('gulp-header');
var footer = require('gulp-footer');
var replace = require('gulp-replace');
var shell = require('gulp-shell');
var eslint = require('gulp-eslint');
Expand All @@ -27,10 +25,10 @@ var fs = require('fs');
var jsEscape = require('gulp-js-escape');
const path = require('path');
const execa = require('execa');
const {minify} = require('terser');
const Vinyl = require('vinyl');

var prebid = require('./package.json');
var dateString = 'Updated : ' + (new Date()).toISOString().substring(0, 10);
var banner = '/* <%= prebid.name %> v<%= prebid.version %>\n' + dateString + '*/\n';
var port = 9999;
const INTEG_SERVER_HOST = argv.host ? argv.host : 'localhost';
const INTEG_SERVER_PORT = 4444;
Expand Down Expand Up @@ -73,6 +71,7 @@ function lint(done) {
return gulp.src([
'src/**/*.js',
'modules/**/*.js',
'libraries/**/*.js',
'test/**/*.js',
'plugins/**/*.js',
'!plugins/**/node_modules/**',
Expand Down Expand Up @@ -120,6 +119,15 @@ function makeDevpackPkg() {
devtool: 'source-map',
mode: 'development'
})

const babelConfig = require('./babelConfig.js')({prebidDistUrlBase: '/build/dev/'});

// update babel config to set local dist url
cloned.module.rules
.flatMap((rule) => rule.use)
.filter((use) => use.loader === 'babel-loader')
.forEach((use) => use.options = Object.assign({}, use.options, babelConfig));

var externalModules = helpers.getArgModules();

const analyticsSources = helpers.getAnalyticsSources();
Expand Down Expand Up @@ -149,18 +157,12 @@ function makeWebpackPkg() {
.pipe(gulp.dest('build/dist'));
}

function addBanner() {
const sm = argv.sourceMaps;

return gulp.src(['build/dist/prebid-core.js'])
.pipe(gulpif(sm, sourcemaps.init({loadMaps: true})))
.pipe(header(banner, {prebid}))
.pipe(gulpif(sm, sourcemaps.write('.')))
.pipe(gulp.dest('build/dist'))
}

function getModulesListToAddInBanner(modules) {
return (modules.length > 0) ? modules.join(', ') : 'All available modules in current version.';
if (!modules || modules.length === helpers.getModuleNames().length) {
return 'All available modules for this version.'
} else {
return modules.join(', ')
}
}

function gulpBundle(dev) {
Expand All @@ -180,6 +182,47 @@ function nodeBundle(modules, dev = false) {
});
}

function wrapWithHeaderAndFooter(dev, modules) {
// NOTE: gulp-header, gulp-footer & gulp-wrap do not play nice with source maps.
// gulp-concat does; for that reason we are prepending and appending the source stream with "fake" header & footer files.
function memoryVinyl(name, contents) {
return new Vinyl({
cwd: '',
base: 'generated',
path: name,
contents: Buffer.from(contents, 'utf-8')
});
}
return function wrap(stream) {
const wrapped = through.obj();
const placeholder = '$$PREBID_SOURCE$$';
const tpl = _.template(fs.readFileSync('./bundle-template.txt'))({
prebid,
modules: getModulesListToAddInBanner(modules),
enable: !argv.manualEnable
});
(dev ? Promise.resolve(tpl) : minify(tpl, {format: {comments: true}}).then((res) => res.code))
.then((tpl) => {
// wrap source placeholder in an IIFE to make it an expression (so that it works with minify output)
const parts = tpl.replace(placeholder, `(function(){$$${placeholder}$$})()`).split(placeholder);
if (parts.length !== 2) {
throw new Error(`Cannot parse bundle template; it must contain exactly one instance of '${placeholder}'`);
}
const [header, footer] = parts;
wrapped.push(memoryVinyl('prebid-header.js', header));
stream.pipe(wrapped, {end: false});
stream.on('end', () => {
wrapped.push(memoryVinyl('prebid-footer.js', footer));
wrapped.push(null);
});
})
.catch((err) => {
wrapped.destroy(err);
});
return wrapped;
}
}

function bundle(dev, moduleArr) {
var modules = moduleArr || helpers.getArgModules();
var allModules = helpers.getModuleNames(modules);
Expand Down Expand Up @@ -210,17 +253,10 @@ function bundle(dev, moduleArr) {
gutil.log('Appending ' + prebid.globalVarName + '.processQueue();');
gutil.log('Generating bundle:', outputFileName);

return gulp.src(
entries
)
// Need to uodate the "Modules: ..." section in comment with the current modules list
.pipe(replace(/(Modules: )(.*?)(\*\/)/, ('$1' + getModulesListToAddInBanner(helpers.getArgModules()) + ' $3')))
const wrap = wrapWithHeaderAndFooter(dev, modules);
return wrap(gulp.src(entries))
.pipe(gulpif(sm, sourcemaps.init({ loadMaps: true })))
.pipe(concat(outputFileName))
.pipe(gulpif(!argv.manualEnable, footer('\n<%= global %>.processQueue();', {
global: prebid.globalVarName
}
)))
.pipe(gulpif(sm, sourcemaps.write('.')));
}

Expand Down Expand Up @@ -389,7 +425,7 @@ gulp.task(clean);
gulp.task(escapePostbidConfig);

gulp.task('build-bundle-dev', gulp.series(makeDevpackPkg, gulpBundle.bind(null, true)));
gulp.task('build-bundle-prod', gulp.series(makeWebpackPkg, addBanner, gulpBundle.bind(null, false)));
gulp.task('build-bundle-prod', gulp.series(makeWebpackPkg, gulpBundle.bind(null, false)));

// public tasks (dependencies are needed for each task since they can be ran on their own)
gulp.task('test-only', test);
Expand All @@ -405,6 +441,7 @@ gulp.task('build-postbid', gulp.series(escapePostbidConfig, buildPostbid));

gulp.task('serve', gulp.series(clean, lint, gulp.parallel('build-bundle-dev', watch, test)));
gulp.task('serve-fast', gulp.series(clean, gulp.parallel('build-bundle-dev', watchFast)));
gulp.task('serve-prod', gulp.series(clean, gulp.parallel('build-bundle-prod', startLocalServer)));
gulp.task('serve-and-test', gulp.series(clean, gulp.parallel('build-bundle-dev', watchFast, testTaskMaker({watch: true}))));
gulp.task('serve-e2e', gulp.series(clean, 'build-bundle-prod', gulp.parallel(() => startIntegServer(), startLocalServer)))
gulp.task('serve-e2e-dev', gulp.series(clean, 'build-bundle-dev', gulp.parallel(() => startIntegServer(true), startLocalServer)))
Expand Down
Loading