jspm / generator

JSPM Import Map Generator
Apache License 2.0
166 stars 21 forks source link

Extra spacing in generated map and link output in HTML file #128

Closed zachsa closed 2 years ago

zachsa commented 2 years ago

With an HTML file as input:

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />

  <title>SOMISANA</title>
  <meta name="description" content="Sustainable Ocean Modelling Initiative: A South African Approach" />

  <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
  <link rel="manifest" href="/site.webmanifest">

  <script>
    window.process = {
      env: {},
    }
  </script>

  <!-- Global site tag (gtag.js) - Google Analytics -->
  <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXX"></script>
  <script>
    window.dataLayer = window.dataLayer || [];
    function gtag() { dataLayer.push(arguments); }
    gtag('js', new Date());

    gtag('config', 'G-XXX');
  </script>

  <script type="module" src="index.somisana.js" defer></script>
</head>

<body>
  <div id="root"></div>
</body>

</html>

The output contains extra line breaks (one line break per import / script):

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />

  <title>SOMISANA</title>
  <meta name="description" content="Sustainable Ocean Modelling Initiative: A South African Approach" />

  <!-- Generated by @jspm/generator - https://github.com/jspm/generator -->

  <script async src="https://ga.jspm.io/npm:es-module-shims@1.5.5/dist/es-module-shims.js" crossorigin="anonymous" integrity="sha384-Zt+0efULC2q2dftjz0uNzXeTpPVuSLLekXQv9HoRuigkAyLPaUFvPVpYYhu2Xc/t"></script>

  <script type="importmap">

  {

    "scopes": {

      "../": {

        "@apollo/client": "https://ga.jspm.io/npm:@apollo/client@3.6.4/index.js",

        "@emotion/cache": "https://ga.jspm.io/npm:@emotion/cache@11.7.1/dist/emotion-cache.browser.esm.js",
        ...

        "react-router-dom": "https://ga.jspm.io/npm:react-router-dom@6.3.0/index.js",

        "react/jsx-runtime": "https://ga.jspm.io/npm:react@18.1.0/dev.jsx-runtime.js"

      },

      "https://ga.jspm.io/": {

        "#ClassNameGenerator": "https://ga.jspm.io/npm:@mui/private-classnames@5.7.0/ClassNameGenerator/index.js",

        "#FormControlUnstyled": "https://ga.jspm.io/npm:@mui/base@5.0.0-alpha.80/FormControlUnstyled/index.js",

        "#GlobalStyles": "https://ga.jspm.io/npm:@mui/styled-engine@5.7.0/GlobalStyles/index.js",

        "#ListboxUnstyled": "https://ga.jspm.io/npm:@mui/base@5.0.0-alpha.80/ListboxUnstyled/index.js",

          ...

        "ts-invariant/process/index.js": "https://ga.jspm.io/npm:ts-invariant@0.10.3/process/index.js",

        "tslib": "https://ga.jspm.io/npm:tslib@2.4.0/tslib.es6.js",

        "zen-observable-ts": "https://ga.jspm.io/npm:zen-observable-ts@1.2.5/module.js"

      },

      "https://ga.jspm.io/npm:hoist-non-react-statics@3.3.2/": {

        "react-is": "https://ga.jspm.io/npm:react-is@16.13.1/index.js"

      },

      "https://ga.jspm.io/npm:prop-types@15.8.1/": {

        "react-is": "https://ga.jspm.io/npm:react-is@16.13.1/index.js"

      }

    }

  }

  </script>

  <link rel="modulepreload" href="./index.somisana.js" integrity="sha384-z1vWy8qqTzDKy8J8EFSp8rtf1kBbqHayjhS4ihAxe7ornK0ByKy7FLtoZRi9qseH" />

  <link rel="modulepreload" href="./main-b4ab368d.js" integrity="sha384-QmTLF6XyqVTRyNsN5A8JW2XZVXmEzVpGKm5bkLY1MzlEMv4gMMALH170f7YH1C8U" />

  <link rel="modulepreload" href="./ssr.somisana.js" integrity="sha384-4WOXRviMs5AtM2MEYvIchu1TTX6dXoSB9co5NW06A6i8Ih6hIYQUsUdCJXxh3jnU" />

  <link rel="modulepreload" href="https://ga.jspm.io/npm:@apollo/client@3.6.4/_/6a0c4423.js" integrity="sha384-T/iDOjanLd9hKPLGipMJNBwBlNNdpTjHo/L2xIUmTK/qkF4vpBjrktNd8QAkhqtG" />

  <link rel="modulepreload" href="https://ga.jspm.io/npm:@apollo/client@3.6.4/_/9611e092.js" integrity="sha384-ISmmIiEzFqDTVPAwGOyHp1ibtpOOPI7de9yBbtKd9zxUh92wbpxY6puPsg80ayWv" />

  <link rel="modulepreload" href="https://ga.jspm.io/npm:@apollo/client@3.6.4/cache/index.js" integrity="sha384-actyPVyMG2c8T7RIe9zdu3NHJNWqkl9TQ9aShjOdeG8oMg4CoN+0qqbS0KY3jKz/" />

  <link rel="modulepreload" href="https://ga.jspm.io/npm:@apollo/client@3.6.4/cache/inmemory/helpers.js" integrity="sha384-rTr/rXg3lFQWkFiWdjzwqmh5gBoqhS3UA9EP+NZR74snh0OfCLqT2jk5ir7prIjB" />

  <link rel="modulepreload" href="https://ga.jspm.io/npm:@apollo/client@3.6.4/cache/inmemory/types.js" integrity="sha384-7GZOiJ7WwbJ2PKz3iZ2Vt/NHNz65guUjQZ/uo6o2LYkbO/Al8pImelhUBJCReJw+" />

  <link rel="modulepreload" href="https://ga.jspm.io/npm:@apollo/client@3.6.4/core/LocalState.js" integrity="sha384-XdWLHAXctY3vKh5KI8PY6H9EPZqHfUwxfUHlR1mepn74NY9pDYpa6aXYa4ZrTPYX" />

  <link rel="modulepreload" href="https://ga.jspm.io/npm:@apollo/client@3.6.4/core/index.js" integrity="sha384-krWzbCNV/OeEHjjP77VhaQXI0zFhJCOiFZAKKUlZ/BSa1upQxm44uSiYwvaqOUAX" />

  <link rel="modulepreload" href="https://ga.jspm.io/npm:@apollo/client@3.6.4/errors/index.js" integrity="sha384-OVYQ74N2Nut3eCzTZI0taASq6B6l0QBiKkghrOUFnr+K1SeDqd6jwEbXzuVwTvne" />

  <link rel="modulepreload" href="https://ga.jspm.io/npm:@apollo/client@3.6.4/index.js" integrity="sha384-dB3xckvGXW6meItuSHpXazlTWQGghzay4LaM8VaK5PQLpNieFHOhcJ8ttz9CDs+C" />

  <link rel="modulepreload" href="https://ga.jspm.io/npm:@apollo/client@3.6.4/link/core/ApolloLink.js" integrity="sha384-Os+xn5TDM1byfquZCE68kqSv3hnUpvG9Kbaj2Rf0CNjAbsjU7K/Xmm6Ybmg9uAju" />

  <link rel="modulepreload" href="https://ga.jspm.io/npm:@apollo/client@3.6.4/link/core/index.js" integrity="sha384-F6HBtGq9WbUQaflOcnN+XpB5TYAQ9cP0dm79h+xSiImc3rgLeHiJtBQU+yK4lzhC" />

  <link rel="modulepreload" href="https://ga.jspm.io/npm:@apollo/client@3.6.4/link/http/index.js" integrity="sha384-D6q8xx/DGKUCmb9t9G2vkrB9IcrEhHPqCWERSfcbX8LkY8/khjqLc8GZZGMgayRV" />

  <link rel="modulepreload" href="https://ga.jspm.io/npm:@apollo/client@3.6.4/link/utils/index.js" integrity="sha384-pfAMLDxDF6tp/R2mhi6p2ry1WYkgs3wSrJMC2q2xYrzhfKIkfbe9gTtYhsY7e/6h" />

  <link rel="modulepreload" href="https://ga.jspm.io/npm:@apollo/client@3.6.4/react/context/ApolloContext.js" integrity="sha384-RFvcr9uf61xRIQWUJdzfVcOYuffaGrcGvGscj+/DU0EUXp2nD6s1/NdDQjFhaLEV" />

  <link rel="modulepreload" href="https://ga.jspm.io/npm:@apollo/client@3.6.4/react/context/index.js" integrity="sha384-YgLd/aE96+YxoX5wKB3ea+U0xtc3KYaSu6nVu0bcHZED82RhkXFCJsl6H4Z9M2yl" />

  <link rel="modulepreload" href="https://ga.jspm.io/npm:@apollo/client@3.6.4/react/hooks/index.js" integrity="sha384-+lfmY760hEw8sDjciPQvtQ2VllaqwfKj6LgNt9mkAjHescK5IBmqQcNPnBLKYMjT" />

  <link rel="modulepreload" href="https://ga.jspm.io/npm:@apollo/client@3.6.4/react/hooks/useApolloClient.js" integrity="sha384-aWI9iiTuksheZUW0pSmy4jrH62KHhVysWDRtd1ZsPxinGfZJ6UqLwwuoLvdF7s9N" />

  <link rel="modulepreload" href="https://ga.jspm.io/npm:@apollo/client@3.6.4/react/hooks/useLazyQuery.js" integrity="sha384-J54Tv8Z0CPfw2bkF4Fh7SmCBYuXl1A/JWL1DkVwQjHGmyO8r+KzMmDG54QjzA+8Z" />

 ... ...

  <link rel="modulepreload" href="https://ga.jspm.io/npm:zen-observable-ts@1.2.5/module.js" integrity="sha384-uSpG7wH3LNsX7pd+tUH7NETgCMwRgHMvzrU7KNfcdSkLtKNH4LV8aUlBaWEM/ou+" />

  <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
  <link rel="manifest" href="/site.webmanifest">

  <script>
    window.process = {
      env: {},
    }
  </script>

  <!-- Global site tag (gtag.js) - Google Analytics -->
  <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXX"></script>
  <script>
    window.dataLayer = window.dataLayer || [];
    function gtag() { dataLayer.push(arguments); }
    gtag('js', new Date());

    gtag('config', 'G-XXX');
  </script>

  <script type="module" src="index.somisana.js" defer> integrity="sha384-z1vWy8qqTzDKy8J8EFSp8rtf1kBbqHayjhS4ihAxe7ornK0ByKy7FLtoZRi9qseH"</script>
</head>

<body>
  <div id="root"></div>
</body>

</html>

This occurred when I added tags:

  <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
  <link rel="manifest" href="/site.webmanifest">
zachsa commented 2 years ago

When I move the link tags to the bottom the header, the problem is solved