Skip to content

An analysis of http archive data, showing JS library usage over time.

Notifications You must be signed in to change notification settings

tdresser/js-library-usage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js-library-usage

An analysis of http archive data, showing JS library usage over time.

See interactive graph here.

Graph

BigQuery, based on queries here. Query can be found here.

#standardSQL
CREATE TEMPORARY FUNCTION getJsLibs(payload STRING)
RETURNS ARRAY<STRUCT<name STRING, version STRING>>
LANGUAGE js AS """
  try {
    const $ = JSON.parse(payload);
    const libs = JSON.parse($['_third-parties']);
    return Array.isArray(libs) ? libs : [];
  } catch (e) {
    return [];
  }
""";

SELECT
  date,
  client,
  lib.name AS library,
  COUNT(DISTINCT url) AS frequency
FROM (
  SELECT
    REPLACE(SUBSTR(_TABLE_SUFFIX, 0, 10), '_', '-') AS date,
    IF(ENDS_WITH(_TABLE_SUFFIX, 'desktop'), 'desktop', 'mobile') AS client,
    url,
    getJsLibs(payload) AS libs
  FROM
    `httparchive.pages.*`),
  UNNEST(libs) AS lib
GROUP BY
  date,
  client,
  library
ORDER BY
  date,
  client,
  library

About

An analysis of http archive data, showing JS library usage over time.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published