# All files / lib index.js

100% Statements 75/75
100% Branches 4/4
100% Functions 0/0
100% Lines 75/75

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    766x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    2x
    2x
    2x
    1x
    1x
    2x
    6x
    6x
    6x
    6x
    6x
    1x
    1x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
    6x
     import createTree from './tree/create';
    import parseNewTree from './tasks/parse-new-tree';
    import reconcileTrees from './tasks/reconcile-trees';
    import internals from './util/internals';
    import parse from './util/parse';
    import { $$diffHTML } from './util/symbols';
    import globalThis from './util/global';
    import innerHTML from './inner-html';
    import outerHTML from './outer-html';
    import toString from './to-string';
    import { defaultTasks } from './transaction';
    import html from './html';
    import release from './release';
    import use from './use';
    import { addTransitionState, removeTransitionState } from './transition';
    import { __VERSION__ as VERSION } from './version';

    // At startup inject the HTML parser into the default set of tasks.
    defaultTasks.splice(defaultTasks.indexOf(reconcileTrees), 0, parseNewTree);

    // Add build flavor internals when executed.
    internals.parse = parse;
    internals.VERSION = VERSION;

    // Build up the full public API.
    const api = {};

    api.VERSION = VERSION;
    api.addTransitionState = addTransitionState;
    api.removeTransitionState = removeTransitionState;
    api.release = release;
    api.createTree = createTree;
    api.use = use;
    api.outerHTML = outerHTML;
    api.innerHTML = innerHTML;
    api.toString = toString;
    api.html = html;
    api.Internals = internals;

    /** @type {any} */
    const global = globalThis;

    // Bind the API into the global scope. Allows middleware and other code to
    // reference the core API. Once import maps are more mainstream, we can
    // deprecate this.
    if ($$diffHTML in globalThis) {
      const existingApi = global[$$diffHTML];

      if (VERSION !== existingApi.VERSION) {
        console.log(`Loaded ${VERSION} after ${existingApi.VERSION}`);
      }
    }

    global[$$diffHTML] = api;

    // Automatically hook up to DevTools if they are present.
    if (global.devTools) {
      global.unsubscribeDevTools = use(global.devTools(internals));
    }

    export {
      VERSION,
      addTransitionState,
      removeTransitionState,
      release,
      createTree,
      use,
      outerHTML,
      innerHTML,
      toString,
      html,
      internals as Internals,
    };

    export default api;