Skip to content

Latest commit

History

History
44 lines (38 loc) 路 1.42 KB

File metadata and controls

44 lines (38 loc) 路 1.42 KB
(function() {
  const detected = [];

  // Common global checks
  const checks = {
    React: () => !!window.React || !!document.querySelector('[data-reactroot], [data-reactid]'),
    Vue: () => !!window.Vue,
    AngularJS: () => !!window.angular,
    Angular: () => document.querySelector('[ng-version]'),
    jQuery: () => !!window.jQuery,
    Svelte: () => !!document.querySelector('[data-svelte-h]'),
    Ember: () => !!window.Ember,
    Backbone: () => !!window.Backbone,
    Lodash: () => !!window._ && !!_.VERSION,
    D3: () => !!window.d3,
    Bootstrap: () => !!document.querySelector('[class*="bootstrap"]') || !!window.bootstrap,
    Moment: () => !!window.moment,
    RxJS: () => !!window.rxjs,
    ThreeJS: () => !!window.THREE
  };

  // Run checks
  for (const [name, test] of Object.entries(checks)) {
    try {
      if (test()) detected.push(name);
    } catch (err) {}
  }

  // Find loaded scripts
  const scripts = Array.from(document.scripts).map(s => s.src).filter(Boolean);

  console.log("馃 Detected Libraries:", detected.length ? detected : "None detected");
  console.log("馃摐 Script sources found:", scripts);

  // Try to extract package names from URLs
  const libNames = scripts.map(url => {
    const match = url.match(/(?:\/|@)([a-zA-Z0-9_.-]+)(?:@|\/|\.min|\.js)/);
    return match ? match[1] : null;
  }).filter(Boolean);

  console.log("馃攳 Possible library/package names:", [...new Set(libNames)]);
})();